[rdkb][common][bsp][Refactor and sync wifi from openwrt]
[Description]
3a2eef0b [MAC80211][Release][Update release note for Filogic 880/860 MLO Beta release]
cfbd2411 [MAC80211][Release][Filogic 880/860 MLO Beta release]
6c180e3f [MAC80211][WiFi7][misc][Add Eagle BE14000 efem default bin]
a55f34db [MAC80211][Release][Prepare for Filogic 880/860 release]
5b45ebca [MAC80211][WiFi7][hostapd][Add puncture bitmap to ucode]
95bbea73 [MAC80211][WiFi6][mt76][Add PID to only report data-frame TX rate]
b15ced26 [MAC80211][WiFi6][hostapd][Fix DFS channel selection issue]
d59133cb [MAC80211][WiFi6][mt76][Fix pse info not correct information]
3921b4b2 [MAC80211][WiFi6][mt76][Fix incomplete QoS-map setting to FW]
4e7690c7 [MAC80211][WiFi6/7][app][Change ATECHANNEL mapping cmd]
eb37af90 [MAC80211][WiFi7][app][Add support for per-packet bw & primary selection]
0ea82adf [MAC80211][WiFi6][core][Fix DFS CAC issue after CSA]
[Release-log]
Change-Id: I9bec97ec1b2e1c49ed43a812a07a5b21fcbb70a6
diff --git a/recipes-wifi/linux-mt76/files/0118-fixup-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch b/recipes-wifi/linux-mt76/files/0118-fixup-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch
deleted file mode 100644
index 5179acf..0000000
--- a/recipes-wifi/linux-mt76/files/0118-fixup-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 74b58da2fc1d7f264300417939702f068d8c4f27 Mon Sep 17 00:00:00 2001
-From: Shayne Chen <shayne.chen@mediatek.com>
-Date: Mon, 29 Apr 2024 15:59:44 +0800
-Subject: [PATCH] fixup! wifi: mt76: mt7996: temp support for single wiphy
-
-Change-Id: Idb4d417064826dedca6b64873d0d1a7dc6525c0b
----
- mt7996/main.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/mt7996/main.c b/mt7996/main.c
-index ea230921..57786413 100644
---- a/mt7996/main.c
-+++ b/mt7996/main.c
-@@ -466,8 +466,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
- /* TODO: temporaily set this to prevent some crashes */
- mvif->deflink.phy = phy;
-
-- if (vif->type == NL80211_IFTYPE_STATION)
-- ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
-+ ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
- mutex_unlock(&dev->mt76.mutex);
-
- return ret;
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0001-mtk-Revert-wifi-mt76-mt7996-fill-txd-by-host-driver.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0001-mtk-Revert-wifi-mt76-mt7996-fill-txd-by-host-driver.patch
index 84e8b97..e4da7ad 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0001-mtk-Revert-wifi-mt76-mt7996-fill-txd-by-host-driver.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0001-mtk-Revert-wifi-mt76-mt7996-fill-txd-by-host-driver.patch
@@ -1,7 +1,7 @@
-From 803b79d47849d9f35f797f86efc63d57758a1dbd Mon Sep 17 00:00:00 2001
+From bb24b3476e4f4eef8a283159d62af7d9736dbcf5 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 19 Sep 2023 11:21:23 +0800
-Subject: [PATCH 001/116] mtk: Revert "wifi: mt76: mt7996: fill txd by host
+Subject: [PATCH 001/199] mtk: Revert "wifi: mt76: mt7996: fill txd by host
driver"
This reverts commit 325a0c4931990d553487024c4f76c776492bdcc2.
@@ -10,7 +10,7 @@
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index bc7111a..3afdd7e 100644
+index bc7111a7..3afdd7eb 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -938,8 +938,11 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0002-bp-sync-upstream-changes.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0002-bp-sync-upstream-changes.patch
deleted file mode 100644
index cc34f3c..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0002-bp-sync-upstream-changes.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 33b7b4702d0666eb4e1535ea99bcf1f4316c2ab2 Mon Sep 17 00:00:00 2001
-From: Shayne Chen <shayne.chen@mediatek.com>
-Date: Thu, 21 Mar 2024 12:14:20 +0800
-Subject: [PATCH 002/116] bp: sync upstream changes
-
-Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
----
- mac80211.c | 6 +++---
- mt7615/mcu.c | 2 +-
- mt7915/mcu.c | 2 +-
- mt7996/mcu.c | 2 +-
- 4 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/mac80211.c b/mac80211.c
-index 4871355..e4675bf 100644
---- a/mac80211.c
-+++ b/mac80211.c
-@@ -1614,8 +1614,8 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
- static void
- __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
- {
-- if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
-- ieee80211_csa_finish(vif);
-+ if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif, 0))
-+ ieee80211_csa_finish(vif, 0);
- }
-
- void mt76_csa_finish(struct mt76_dev *dev)
-@@ -1639,7 +1639,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
- if (!vif->bss_conf.csa_active)
- return;
-
-- dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
-+ dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif, 0);
- }
-
- void mt76_csa_check(struct mt76_dev *dev)
-diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index ae34d01..c807bd8 100644
---- a/mt7615/mcu.c
-+++ b/mt7615/mcu.c
-@@ -353,7 +353,7 @@ static void
- mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
- {
- if (vif->bss_conf.csa_active)
-- ieee80211_csa_finish(vif);
-+ ieee80211_csa_finish(vif, 0);
- }
-
- static void
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 29e9d66..fc194e0 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -228,7 +228,7 @@ mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
- if (!vif->bss_conf.csa_active || vif->type == NL80211_IFTYPE_STATION)
- return;
-
-- ieee80211_csa_finish(vif);
-+ ieee80211_csa_finish(vif, 0);
- }
-
- static void
-diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 4588696..4bd74e1 100644
---- a/mt7996/mcu.c
-+++ b/mt7996/mcu.c
-@@ -341,7 +341,7 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
- if (!vif->bss_conf.csa_active || vif->type == NL80211_IFTYPE_STATION)
- return;
-
-- ieee80211_csa_finish(vif);
-+ ieee80211_csa_finish(vif, 0);
- }
-
- static void
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0003-wifi-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0002-mtk-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch
similarity index 84%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0003-wifi-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0002-mtk-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch
index e1fdf6b..af32ef5 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0003-wifi-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0002-mtk-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch
@@ -1,7 +1,7 @@
-From e9039f548952da4aa2f91d125da157974d0c0fa7 Mon Sep 17 00:00:00 2001
+From 30225c66317a43f8e881300f2e431d8b6bf54985 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 10 Apr 2024 14:05:12 +0800
-Subject: [PATCH 003/116] wifi: mt76: mt7996: use hweight16 to get correct
+Subject: [PATCH 002/199] mtk: mt76: mt7996: use hweight16 to get correct
tx_ant
The chainmask is u16 so using hweight8 cannot get correct tx_ant.
@@ -16,7 +16,7 @@
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 4bd74e1..239b64a 100644
+index 3590e43f..73c3cc2d 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1653,7 +1653,7 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0004-mtk-wifi-mt76-mt7996-fix-MBSS.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0003-mtk-mt76-mt7996-fix-MBSS.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0004-mtk-wifi-mt76-mt7996-fix-MBSS.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0003-mtk-mt76-mt7996-fix-MBSS.patch
index 9684e8b..6042e11 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0004-mtk-wifi-mt76-mt7996-fix-MBSS.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0003-mtk-mt76-mt7996-fix-MBSS.patch
@@ -1,7 +1,7 @@
-From 3fc5e746e7fb33b2d2206f5fd3c5e9cd65b302f3 Mon Sep 17 00:00:00 2001
+From d62e705d71d755dd420564e09f1686f908fd9c98 Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Thu, 18 Apr 2024 14:19:21 +0800
-Subject: [PATCH 004/116] mtk: wifi: mt76: mt7996: fix MBSS
+Subject: [PATCH 003/199] mtk: mt76: mt7996: fix MBSS
Refactor 11v mbss unicmd flow
case1(disable->enable) : when we enable 11v MBSS, we have to add 11v mbss tlv(UNI_BSS_INFO_11V_MBSSID)
@@ -14,7 +14,7 @@
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 239b64a..ceff487 100644
+index 73c3cc2d..6d5bbe5b 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -822,7 +822,7 @@ mt7996_mcu_bss_mbssid_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0005-wifi-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0004-mtk-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch
similarity index 83%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0005-wifi-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0004-mtk-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch
index 371bdf0..e29be50 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0005-wifi-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0004-mtk-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch
@@ -1,24 +1,17 @@
-From 0a8c7ea3be6987390e2567a63659fec93aa3269c Mon Sep 17 00:00:00 2001
+From 184f146afaddb73c3fd0afc60338f5ed73d5b450 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Tue, 12 Mar 2024 09:07:52 +0800
-Subject: [PATCH 005/116] wifi: mt76: mt7996: fix HE and EHT phy cap
+Subject: [PATCH 004/199] mtk: mt76: mt7996: fix HE and EHT phy cap
-This commit fix he and eht phy capabailties ie. For HE phy cap, fix
-correct beamform capabilities for station vif. For EHT phy cap, remove
-unsupported capabilities.
-
-Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi7 (802.11be) devices")
-Fixes: 348533eb968d ("wifi: mt76: mt7996: add EHT capability init")
-Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
---
mt7996/init.c | 65 ++++++++++++++++++++++++++++++++++-----------------
1 file changed, 43 insertions(+), 22 deletions(-)
diff --git a/mt7996/init.c b/mt7996/init.c
-index 9aa97e4..c264d50 100644
+index 283df84f..a98dcb40 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -1010,8 +1010,6 @@ mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
+@@ -1011,8 +1011,6 @@ mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
return;
elem->phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
@@ -27,7 +20,7 @@
c = FIELD_PREP(IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
sts - 1) |
-@@ -1019,6 +1017,11 @@ mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
+@@ -1020,6 +1018,11 @@ mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
sts - 1);
elem->phy_cap_info[5] |= c;
@@ -39,7 +32,7 @@
c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB;
elem->phy_cap_info[6] |= c;
-@@ -1178,7 +1181,6 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+@@ -1179,7 +1182,6 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
IEEE80211_EHT_MAC_CAP0_OM_CONTROL;
eht_cap_elem->phy_cap_info[0] =
@@ -47,7 +40,7 @@
IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI |
IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER |
IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE;
-@@ -1192,30 +1194,36 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+@@ -1193,30 +1195,36 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
u8_encode_bits(u8_get_bits(val, GENMASK(2, 1)),
IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK) |
u8_encode_bits(val,
@@ -94,7 +87,7 @@
u8_encode_bits(IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US,
IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK) |
u8_encode_bits(u8_get_bits(0x11, GENMASK(1, 0)),
-@@ -1229,14 +1237,6 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+@@ -1230,14 +1238,6 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK) |
u8_encode_bits(val, IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK);
@@ -109,7 +102,7 @@
val = u8_encode_bits(nss, IEEE80211_EHT_MCS_NSS_RX) |
u8_encode_bits(nss, IEEE80211_EHT_MCS_NSS_TX);
#define SET_EHT_MAX_NSS(_bw, _val) do { \
-@@ -1247,8 +1247,29 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+@@ -1248,8 +1248,29 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
SET_EHT_MAX_NSS(80, val);
SET_EHT_MAX_NSS(160, val);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0006-mtk-wifi-mt76-mt7996-adjust-Beamformee-SS-capability.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0005-mtk-mt76-mt7996-adjust-Beamformee-SS-capability.patch
similarity index 86%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0006-mtk-wifi-mt76-mt7996-adjust-Beamformee-SS-capability.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0005-mtk-mt76-mt7996-adjust-Beamformee-SS-capability.patch
index 9b56c52..9d4cf83 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0006-mtk-wifi-mt76-mt7996-adjust-Beamformee-SS-capability.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0005-mtk-mt76-mt7996-adjust-Beamformee-SS-capability.patch
@@ -1,8 +1,7 @@
-From 346eb89054af1f40dcceec43d128d8775081fd9a Mon Sep 17 00:00:00 2001
+From 070859af14a0c57a521e9efc5d4ae275666679d9 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Tue, 27 Feb 2024 14:50:20 +0800
-Subject: [PATCH 006/116] mtk: wifi: mt76: mt7996: adjust Beamformee SS
- capability
+Subject: [PATCH 005/199] mtk: mt76: mt7996: adjust Beamformee SS capability
This commit includes two changes to adjust beamformee ss capability.
First, configure the beamformee ss capability for mt7992 chipsets.
@@ -15,10 +14,10 @@
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/mt7996/init.c b/mt7996/init.c
-index c264d50..ab9445c 100644
+index a98dcb40..7d8d1e7b 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -940,8 +940,12 @@ void mt7996_set_stream_vht_txbf_caps(struct mt7996_phy *phy)
+@@ -941,8 +941,12 @@ void mt7996_set_stream_vht_txbf_caps(struct mt7996_phy *phy)
cap = &phy->mt76->sband_5g.sband.vht_cap.cap;
*cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
@@ -33,7 +32,7 @@
*cap &= ~(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK |
IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
-@@ -986,9 +990,15 @@ mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
+@@ -987,9 +991,15 @@ mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO;
elem->phy_cap_info[2] |= c;
@@ -52,7 +51,7 @@
elem->phy_cap_info[4] |= c;
/* do not support NG16 due to spec D4.0 changes subcarrier idx */
-@@ -1185,7 +1195,8 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+@@ -1186,7 +1196,8 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER |
IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0006-mtk-mt76-mt7996-add-support-for-IEEE-802.11-fragment.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0006-mtk-mt76-mt7996-add-support-for-IEEE-802.11-fragment.patch
new file mode 100644
index 0000000..d9f38b2
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0006-mtk-mt76-mt7996-add-support-for-IEEE-802.11-fragment.patch
@@ -0,0 +1,73 @@
+From f875fc2725a26aee415ffde4ba0822f69403bdf2 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Fri, 12 Jul 2024 16:05:50 +0800
+Subject: [PATCH 006/199] mtk: mt76: mt7996: add support for IEEE 802.11
+ fragmentation
+
+Add fragment index into TXD.DW2 to support IEEE 802.11 fragmentation.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt76_connac3_mac.h | 7 +++++++
+ mt7996/mac.c | 13 +++++++++++--
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/mt76_connac3_mac.h b/mt76_connac3_mac.h
+index 353e6606..3fc94bd7 100644
+--- a/mt76_connac3_mac.h
++++ b/mt76_connac3_mac.h
+@@ -197,6 +197,13 @@ enum tx_mgnt_type {
+ MT_TX_ADDBA,
+ };
+
++enum tx_frag_idx {
++ MT_TX_FRAG_NONE,
++ MT_TX_FRAG_FIRST,
++ MT_TX_FRAG_MID,
++ MT_TX_FRAG_LAST
++};
++
+ #define MT_CT_INFO_APPLY_TXD BIT(0)
+ #define MT_CT_INFO_COPY_HOST_TXD_ALL BIT(1)
+ #define MT_CT_INFO_MGMT_FRAME BIT(2)
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 3afdd7eb..b3f9591f 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -746,7 +746,7 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ bool multicast = is_multicast_ether_addr(hdr->addr1);
+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
+- __le16 fc = hdr->frame_control;
++ __le16 fc = hdr->frame_control, sc = hdr->seq_ctrl;
+ u8 fc_type, fc_stype;
+ u32 val;
+
+@@ -780,6 +780,15 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ val = FIELD_PREP(MT_TXD2_FRAME_TYPE, fc_type) |
+ FIELD_PREP(MT_TXD2_SUB_TYPE, fc_stype);
+
++ if (ieee80211_has_morefrags(fc) && ieee80211_is_first_frag(sc))
++ val |= FIELD_PREP(MT_TXD2_FRAG, MT_TX_FRAG_FIRST);
++ else if (ieee80211_has_morefrags(fc) && !ieee80211_is_first_frag(sc))
++ val |= FIELD_PREP(MT_TXD2_FRAG, MT_TX_FRAG_MID);
++ else if (!ieee80211_has_morefrags(fc) && !ieee80211_is_first_frag(sc))
++ val |= FIELD_PREP(MT_TXD2_FRAG, MT_TX_FRAG_LAST);
++ else
++ val |= FIELD_PREP(MT_TXD2_FRAG, MT_TX_FRAG_NONE);
++
+ txwi[2] |= cpu_to_le32(val);
+
+ txwi[3] |= cpu_to_le32(FIELD_PREP(MT_TXD3_BCM, multicast));
+@@ -789,7 +798,7 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ }
+
+ if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+- u16 seqno = le16_to_cpu(hdr->seq_ctrl);
++ u16 seqno = le16_to_cpu(sc);
+
+ if (ieee80211_is_back_req(hdr->frame_control)) {
+ struct ieee80211_bar *bar;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0007-mtk-mt76-mt7996-set-rx-path-when-channel-switch.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0007-mtk-mt76-mt7996-set-rx-path-when-channel-switch.patch
new file mode 100644
index 0000000..3e1400f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0007-mtk-mt76-mt7996-set-rx-path-when-channel-switch.patch
@@ -0,0 +1,33 @@
+From a76084f12577a97b1b06db539a2e928845e5a9ff Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 26 Jul 2024 15:55:01 +0800
+Subject: [PATCH 007/199] mtk: mt76: mt7996: set rx path when channel switch
+
+When scanning, driver need to send this tag to fw to notify scanning is
+start or stop. FW would stop mac tx when scanning is started and resume
+mac tx when scanning is done. Without this tag, hw needs more time to
+resume traffic when scanning is done.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/main.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 7c97140d..15d880ef 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -307,6 +307,10 @@ int mt7996_set_channel(struct mt7996_phy *phy)
+ if (ret)
+ goto out;
+
++ ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_RX_PATH);
++ if (ret)
++ goto out;
++
+ ret = mt7996_dfs_init_radar_detector(phy);
+ mt7996_mac_cca_stats_reset(phy);
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0008-mtk-mt76-mt7996-set-station-s-wmm-index-to-3.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0008-mtk-mt76-mt7996-set-station-s-wmm-index-to-3.patch
new file mode 100644
index 0000000..81739b6
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0008-mtk-mt76-mt7996-set-station-s-wmm-index-to-3.patch
@@ -0,0 +1,29 @@
+From ce5a75d5fb6414c0ccc0c461f0ff2bb09501275e Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 19 Jul 2024 11:50:21 +0800
+Subject: [PATCH 008/199] mtk: mt76: mt7996: set station's wmm index to 3
+
+According to HW design, the AP's WMM index is 0 and the station's wmm
+index is 3.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 15d880ef..2b094b33 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -206,7 +206,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
+ mvif->mt76.omac_idx = idx;
+ mvif->phy = phy;
+ mvif->mt76.band_idx = band_idx;
+- mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
++ mvif->mt76.wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
+
+ ret = mt7996_mcu_add_dev_info(phy, vif, true);
+ if (ret)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0009-mtk-mt76-mt7996-fix-rxd-checksum-offload-offset.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0009-mtk-mt76-mt7996-fix-rxd-checksum-offload-offset.patch
new file mode 100644
index 0000000..c5c0717
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0009-mtk-mt76-mt7996-fix-rxd-checksum-offload-offset.patch
@@ -0,0 +1,58 @@
+From 1d799d5548538dcf501f7fb99b1f529ef001b4c8 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 26 Jul 2024 09:27:45 +0800
+Subject: [PATCH 009/199] mtk: mt76: mt7996: fix rxd checksum offload offset
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76_connac3_mac.h | 4 ++--
+ mt7996/mac.c | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/mt76_connac3_mac.h b/mt76_connac3_mac.h
+index 3fc94bd7..db0c29e6 100644
+--- a/mt76_connac3_mac.h
++++ b/mt76_connac3_mac.h
+@@ -28,8 +28,6 @@ enum {
+ #define MT_RXD0_MESH BIT(18)
+ #define MT_RXD0_MHCP BIT(19)
+ #define MT_RXD0_NORMAL_ETH_TYPE_OFS GENMASK(22, 16)
+-#define MT_RXD0_NORMAL_IP_SUM BIT(23)
+-#define MT_RXD0_NORMAL_UDP_TCP_SUM BIT(24)
+
+ #define MT_RXD0_SW_PKT_TYPE_MASK GENMASK(31, 16)
+ #define MT_RXD0_SW_PKT_TYPE_MAP 0x380F
+@@ -80,6 +78,8 @@ enum {
+ #define MT_RXD3_NORMAL_BEACON_UC BIT(21)
+ #define MT_RXD3_NORMAL_CO_ANT BIT(22)
+ #define MT_RXD3_NORMAL_FCS_ERR BIT(24)
++#define MT_RXD3_NORMAL_IP_SUM BIT(26)
++#define MT_RXD3_NORMAL_UDP_TCP_SUM BIT(27)
+ #define MT_RXD3_NORMAL_VLAN2ETH BIT(31)
+
+ /* RXD DW4 */
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index b3f9591f..109a74a9 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -435,7 +435,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ u32 rxd2 = le32_to_cpu(rxd[2]);
+ u32 rxd3 = le32_to_cpu(rxd[3]);
+ u32 rxd4 = le32_to_cpu(rxd[4]);
+- u32 csum_mask = MT_RXD0_NORMAL_IP_SUM | MT_RXD0_NORMAL_UDP_TCP_SUM;
++ u32 csum_mask = MT_RXD3_NORMAL_IP_SUM | MT_RXD3_NORMAL_UDP_TCP_SUM;
+ u32 csum_status = *(u32 *)skb->cb;
+ u32 mesh_mask = MT_RXD0_MESH | MT_RXD0_MHCP;
+ bool is_mesh = (rxd0 & mesh_mask) == mesh_mask;
+@@ -497,7 +497,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ if (!sband->channels)
+ return -EINVAL;
+
+- if ((rxd0 & csum_mask) == csum_mask &&
++ if ((rxd3 & csum_mask) == csum_mask &&
+ !(csum_status & (BIT(0) | BIT(2) | BIT(3))))
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0010-mtk-mt76-mt7996-fix-EHT-Beamforming-capability-check.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0010-mtk-mt76-mt7996-fix-EHT-Beamforming-capability-check.patch
new file mode 100644
index 0000000..95afaf1
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0010-mtk-mt76-mt7996-fix-EHT-Beamforming-capability-check.patch
@@ -0,0 +1,30 @@
+From 18583c512c569a45767cbdb3b93dcb688158bfe6 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 28 Jun 2024 11:05:26 +0800
+Subject: [PATCH 010/199] mtk: mt76: mt7996: fix EHT Beamforming capability
+ check
+
+---
+ mt7996/mcu.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 6d5bbe5b..39963a36 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -1429,10 +1429,10 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+
+ if (bfee)
+ return vif->bss_conf.eht_su_beamformee &&
+- EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]);
++ EHT_PHY(CAP0_SU_BEAMFORMER, pe->phy_cap_info[0]);
+ else
+ return vif->bss_conf.eht_su_beamformer &&
+- EHT_PHY(CAP0_SU_BEAMFORMER, pe->phy_cap_info[0]);
++ EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]);
+ }
+
+ if (sta->deflink.he_cap.has_he) {
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0011-mtk-mt76-mt7996-fix-amsdu-information.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0011-mtk-mt76-mt7996-fix-amsdu-information.patch
new file mode 100644
index 0000000..0afd075
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0011-mtk-mt76-mt7996-fix-amsdu-information.patch
@@ -0,0 +1,109 @@
+From aff4c26706fa1403abca8067cd0073db88c9f6cf Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 17 May 2024 15:28:06 +0800
+Subject: [PATCH 011/199] mtk: mt76: mt7996: fix amsdu information
+
+The amsdu information is common information for all bands so maintain
+it by main phy instead of calculating by each phy.
+Without this patch, the statistics of tx_amsdu_cnt and tx_amsdu would
+be incorrect.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76.h | 3 ++-
+ mt7996/debugfs.c | 13 -------------
+ mt7996/mac.c | 15 +++++++++------
+ 3 files changed, 11 insertions(+), 20 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index 5c9d6c64..45039377 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -916,6 +916,7 @@ struct mt76_dev {
+ };
+ };
+
++#define MT76_MAX_AMSDU_NUM 8
+ /* per-phy stats. */
+ struct mt76_mib_stats {
+ u32 ack_fail_cnt;
+@@ -975,7 +976,7 @@ struct mt76_mib_stats {
+ u32 rx_vec_queue_overflow_drop_cnt;
+ u32 rx_ba_cnt;
+
+- u32 tx_amsdu[8];
++ u32 tx_amsdu[MT76_MAX_AMSDU_NUM];
+ u32 tx_amsdu_cnt;
+
+ /* mcu_muru_stats */
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 62c03d08..a17c99a2 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -530,7 +530,6 @@ mt7996_tx_stats_show(struct seq_file *file, void *data)
+ struct mt7996_phy *phy = file->private;
+ struct mt7996_dev *dev = phy->dev;
+ struct mt76_mib_stats *mib = &phy->mib;
+- int i;
+ u32 attempts, success, per;
+
+ mutex_lock(&dev->mt76.mutex);
+@@ -547,18 +546,6 @@ mt7996_tx_stats_show(struct seq_file *file, void *data)
+
+ mt7996_txbf_stat_read_phy(phy, file);
+
+- /* Tx amsdu info */
+- seq_puts(file, "Tx MSDU statistics:\n");
+- for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
+- seq_printf(file, "AMSDU pack count of %d MSDU in TXD: %8d ",
+- i + 1, mib->tx_amsdu[i]);
+- if (mib->tx_amsdu_cnt)
+- seq_printf(file, "(%3d%%)\n",
+- mib->tx_amsdu[i] * 100 / mib->tx_amsdu_cnt);
+- else
+- seq_puts(file, "\n");
+- }
+-
+ mutex_unlock(&dev->mt76.mutex);
+
+ return 0;
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 109a74a9..503e92c0 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2103,10 +2103,19 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy)
+ {
+ struct mt76_mib_stats *mib = &phy->mib;
+ struct mt7996_dev *dev = phy->dev;
++ struct mt76_mib_stats *main_mib = &dev->phy.mib;
+ u8 band_idx = phy->mt76->band_idx;
+ u32 cnt;
+ int i;
+
++ /* Update per-dev structures */
++ for (i = 0; i < ARRAY_SIZE(main_mib->tx_amsdu); i++) {
++ cnt = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i));
++ main_mib->tx_amsdu[i] += cnt;
++ main_mib->tx_amsdu_cnt += cnt;
++ }
++
++ /* Update per-phy structures */
+ cnt = mt76_rr(dev, MT_MIB_RSCR1(band_idx));
+ mib->fcs_err_cnt += cnt;
+
+@@ -2212,12 +2221,6 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy)
+ cnt = mt76_rr(dev, MT_MIB_BSCR17(band_idx));
+ mib->tx_bf_fb_cpl_cnt += cnt;
+
+- for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
+- cnt = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i));
+- mib->tx_amsdu[i] += cnt;
+- mib->tx_amsdu_cnt += cnt;
+- }
+-
+ /* rts count */
+ cnt = mt76_rr(dev, MT_MIB_BTSCR5(band_idx));
+ mib->rts_cnt += cnt;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0113-mtk-wifi-mt76-mt7996-add-beacon_int_min_gcd-to-suppo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0012-mtk-mt76-mt7996-add-beacon_int_min_gcd-to-support-di.patch
similarity index 74%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0113-mtk-wifi-mt76-mt7996-add-beacon_int_min_gcd-to-suppo.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0012-mtk-mt76-mt7996-add-beacon_int_min_gcd-to-support-di.patch
index 273a130..c8c218a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0113-mtk-wifi-mt76-mt7996-add-beacon_int_min_gcd-to-suppo.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0012-mtk-mt76-mt7996-add-beacon_int_min_gcd-to-support-di.patch
@@ -1,8 +1,8 @@
-From fde0acbc9ad0c869da1a075c408946ba1e7b91d1 Mon Sep 17 00:00:00 2001
+From 0230f41ebd90270be685fc813d23a150afbfc823 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 19 Apr 2024 11:01:21 +0800
-Subject: [PATCH 113/116] mtk: wifi: mt76: mt7996: add beacon_int_min_gcd to
- support different beacon interval
+Subject: [PATCH 012/199] mtk: mt76: mt7996: add beacon_int_min_gcd to support
+ different beacon interval
When beacon_int_min_gcd is zero, all beacon intervals for different
interfaces should be same. If beacon_int_min_gcd is larger than zero,
@@ -18,10 +18,10 @@
1 file changed, 1 insertion(+)
diff --git a/mt7996/init.c b/mt7996/init.c
-index 0dee659..3af9d02 100644
+index 7d8d1e7b..5e969732 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -41,6 +41,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
+@@ -42,6 +42,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
BIT(NL80211_CHAN_WIDTH_40) |
BIT(NL80211_CHAN_WIDTH_80) |
BIT(NL80211_CHAN_WIDTH_160),
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0007-wifi-mt76-mt7992-adjust-beamform-mcu-cmd-configurati.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0013-mtk-mt76-adjust-beamform-mcu-cmd-configuration-for-m.patch
similarity index 75%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0007-wifi-mt76-mt7992-adjust-beamform-mcu-cmd-configurati.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0013-mtk-mt76-adjust-beamform-mcu-cmd-configuration-for-m.patch
index 6608130..28511c6 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0007-wifi-mt76-mt7992-adjust-beamform-mcu-cmd-configurati.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0013-mtk-mt76-adjust-beamform-mcu-cmd-configuration-for-m.patch
@@ -1,8 +1,8 @@
-From e4f7c4696b0701162b5bef4bf699b13313f9c9f5 Mon Sep 17 00:00:00 2001
+From 46245bf2b1adb748f52772cb7550c85733aa6db7 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 18 Mar 2024 11:13:56 +0800
-Subject: [PATCH 007/116] wifi: mt76: mt7992: adjust beamform mcu cmd
- configuration for mt7992
+Subject: [PATCH 013/199] mtk: mt76: adjust beamform mcu cmd configuration for
+ mt7992
Adjust the correct beamform mcu cmd configuration for mt7992 chipsets.
@@ -12,10 +12,10 @@
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index ceff487..0e5ddf6 100644
+index 39963a36..3816b5a5 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3920,8 +3920,9 @@ int mt7996_mcu_set_txbf(struct mt7996_dev *dev, u8 action)
+@@ -3923,8 +3923,9 @@ int mt7996_mcu_set_txbf(struct mt7996_dev *dev, u8 action)
tlv = mt7996_mcu_add_uni_tlv(skb, action, sizeof(*req_mod_en));
req_mod_en = (struct bf_mod_en_ctrl *)tlv;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0008-mtk-wifi-mt76-mt7996-add-preamble-puncture-support-f.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0014-mtk-mt76-mt7996-add-preamble-puncture-support-for-mt.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0008-mtk-wifi-mt76-mt7996-add-preamble-puncture-support-f.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0014-mtk-mt76-mt7996-add-preamble-puncture-support-for-mt.patch
index 8a29fda..26f0118 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0008-mtk-wifi-mt76-mt7996-add-preamble-puncture-support-f.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0014-mtk-mt76-mt7996-add-preamble-puncture-support-for-mt.patch
@@ -1,8 +1,8 @@
-From f8092ef14eb9b03588ea29ac1b5a3a023f34c705 Mon Sep 17 00:00:00 2001
+From 2ee799d7d81869c1eb1d3a332bd223670c2523e5 Mon Sep 17 00:00:00 2001
From: Allen Ye <allen.ye@mediatek.com>
Date: Thu, 18 Apr 2024 11:16:24 +0800
-Subject: [PATCH 008/116] mtk: wifi: mt76: mt7996: add preamble puncture
- support for mt7996
+Subject: [PATCH 014/199] mtk: mt76: mt7996: add preamble puncture support for
+ mt7996
Add support configure preamble puncture feature through mcu commands.
@@ -19,10 +19,10 @@
6 files changed, 61 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 915eb3a..1e187a8 100644
+index 4242d436..a7cb33d2 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1273,6 +1273,7 @@ enum {
+@@ -1283,6 +1283,7 @@ enum {
MCU_UNI_CMD_CHANNEL_SWITCH = 0x34,
MCU_UNI_CMD_THERMAL = 0x35,
MCU_UNI_CMD_VOW = 0x37,
@@ -31,10 +31,10 @@
MCU_UNI_CMD_RRO = 0x57,
MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
diff --git a/mt7996/init.c b/mt7996/init.c
-index ab9445c..afe8a0a 100644
+index 5e969732..a47b578c 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -387,6 +387,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -389,6 +389,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
@@ -43,10 +43,10 @@
if (!mdev->dev->of_node ||
!of_property_read_bool(mdev->dev->of_node,
diff --git a/mt7996/main.c b/mt7996/main.c
-index 40ccfdc..1791335 100644
+index 2b094b33..8d2b0ee7 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -411,6 +411,11 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
+@@ -415,6 +415,11 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
int ret;
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
@@ -59,10 +59,10 @@
ret = mt7996_set_channel(phy);
if (ret)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 0e5ddf6..1f99b2d 100644
+index 3816b5a5..e01457de 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -4550,3 +4550,43 @@ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode)
+@@ -4553,3 +4553,43 @@ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode)
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_EXT_CMD(CP_SUPPORT),
&cp_mode, sizeof(cp_mode), true);
}
@@ -107,7 +107,7 @@
+ &req, sizeof(req), false);
+}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index a9ba63d..2052555 100644
+index 43468bca..df42c0f8 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -923,6 +923,16 @@ enum {
@@ -128,7 +128,7 @@
#define MT7996_PATCH_SCRAMBLE_KEY GENMASK(15, 8)
#define MT7996_PATCH_AES_KEY GENMASK(7, 0)
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 177cfff..58fa6b4 100644
+index 177cfff3..58fa6b45 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -237,6 +237,9 @@ struct mt7996_phy {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0009-mtk-wifi-mt76-mt7996-add-driver-support-for-wpa3-ocv.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0015-mtk-mt76-mt7996-add-driver-support-for-wpa3-ocv-and-.patch
similarity index 74%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0009-mtk-wifi-mt76-mt7996-add-driver-support-for-wpa3-ocv.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0015-mtk-mt76-mt7996-add-driver-support-for-wpa3-ocv-and-.patch
index 93ab989..5bebed3 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0009-mtk-wifi-mt76-mt7996-add-driver-support-for-wpa3-ocv.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0015-mtk-mt76-mt7996-add-driver-support-for-wpa3-ocv-and-.patch
@@ -1,8 +1,8 @@
-From f0e002bc52cfc5fe8d32fe647baef94920d212d6 Mon Sep 17 00:00:00 2001
+From 1dc23dac31d10114a55409bd7e29fb1710b6b3ff Mon Sep 17 00:00:00 2001
From: mtk23510 <rudra.shahi@mediatek.com>
Date: Fri, 24 Mar 2023 19:18:53 +0800
-Subject: [PATCH 009/116] mtk: wifi: mt76: mt7996: add driver support for wpa3
- ocv and bp mt76
+Subject: [PATCH 015/199] mtk: mt76: mt7996: add driver support for wpa3 ocv
+ and bp mt76
Signed-off-by: mtk23510 <rudra.shahi@mediatek.com>
---
@@ -10,10 +10,10 @@
1 file changed, 2 insertions(+)
diff --git a/mt7996/init.c b/mt7996/init.c
-index afe8a0a..ab2e17e 100644
+index a47b578c..2d7f42f7 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -389,6 +389,8 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -391,6 +391,8 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_PUNCT);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0015-mtk-wifi-mt76-mt7996-Fixed-null-pointer-dereference-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0015-mtk-wifi-mt76-mt7996-Fixed-null-pointer-dereference-.patch
deleted file mode 100644
index a029391..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0015-mtk-wifi-mt76-mt7996-Fixed-null-pointer-dereference-.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From c8d653d2b80ec1d58e9efd947196ee9d0fbf871b Mon Sep 17 00:00:00 2001
-From: MeiChia Chiu <meichia.chiu@mediatek.com>
-Date: Thu, 26 Oct 2023 10:08:10 +0800
-Subject: [PATCH 015/116] mtk: wifi: mt76: mt7996: Fixed null pointer
- dereference issue
-
-Without this patch, when the station is still in Authentication stage and
-sends a "Notify bandwidth change action frame" to AP at the same time,
-there will be a race condition that causes a crash to occur because the AP
-access "msta->vif" that has not been fully initialized.
-
-Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
-Signed-off-by: Money Wang <money.wang@mediatek.com>
-Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
----
- mt7996/main.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/mt7996/main.c b/mt7996/main.c
-index 0e8abe7..e66c607 100644
---- a/mt7996/main.c
-+++ b/mt7996/main.c
-@@ -1079,9 +1079,16 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
- struct ieee80211_sta *sta,
- u32 changed)
- {
-+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- struct mt7996_phy *phy = mt7996_hw_phy(hw);
- struct mt7996_dev *dev = phy->dev;
-
-+ if (!msta->vif) {
-+ dev_warn(dev->mt76.dev, "Un-initialized STA %pM wcid %d in rc_work\n",
-+ sta->addr, msta->wcid.idx);
-+ return;
-+ }
-+
- mt7996_sta_rc_work(&changed, sta);
- ieee80211_queue_work(hw, &dev->rc_work);
- }
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0010-mtk-wifi-mt76-mt7996-enable-ser-query.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0016-mtk-mt76-mt7996-enable-ser-query.patch
similarity index 71%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0010-mtk-wifi-mt76-mt7996-enable-ser-query.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0016-mtk-mt76-mt7996-enable-ser-query.patch
index 1ac9d59..26d632b 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0010-mtk-wifi-mt76-mt7996-enable-ser-query.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0016-mtk-mt76-mt7996-enable-ser-query.patch
@@ -1,7 +1,7 @@
-From 55c395dcb6ab95671cc0830e31b71c3aa8fa91c5 Mon Sep 17 00:00:00 2001
+From 60bf48a22df088e5d26f0433b6f28621d73f7240 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 30 Oct 2023 20:19:41 +0800
-Subject: [PATCH 010/116] mtk: wifi: mt76: mt7996: enable ser query
+Subject: [PATCH 016/199] mtk: mt76: mt7996: enable ser query
Do not return -EINVAL when action is UNI_CMD_SER_QUERY for user
to dump SER information from FW.
@@ -12,10 +12,10 @@
1 file changed, 2 insertions(+)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 1f99b2d..9ed8638 100644
+index e01457de..0c300b81 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3865,6 +3865,8 @@ int mt7996_mcu_set_ser(struct mt7996_dev *dev, u8 action, u8 val, u8 band)
+@@ -3868,6 +3868,8 @@ int mt7996_mcu_set_ser(struct mt7996_dev *dev, u8 action, u8 val, u8 band)
};
switch (action) {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0011-mtk-wifi-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0017-mtk-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG_GENE.patch
similarity index 84%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0011-mtk-wifi-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0017-mtk-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG_GENE.patch
index ca8e083..8044c01 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0011-mtk-wifi-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0017-mtk-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG_GENE.patch
@@ -1,7 +1,7 @@
-From df056f10532395d83a9bdb199ff609817840dfab Mon Sep 17 00:00:00 2001
+From ad30c992771e60b4150511435ea4f8935b978f02 Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Thu, 18 Apr 2024 17:21:22 +0800
-Subject: [PATCH 011/116] mtk: wifi: mt76: mt7996: set key flag
+Subject: [PATCH 017/199] mtk: mt76: mt7996: set key flag
'IEEE80211_KEY_FLAG_GENERATE_MMIE' for other ciphers
When beacon protection is enabled, FW checks MMIE tag & length in the
@@ -15,10 +15,10 @@
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 1791335..dc8014e 100644
+index 8d2b0ee7..40281c5b 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -360,14 +360,14 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -364,14 +364,14 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
case WLAN_CIPHER_SUITE_SMS4:
break;
case WLAN_CIPHER_SUITE_AES_CMAC:
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0012-mtk-wifi-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0018-mtk-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch
similarity index 77%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0012-mtk-wifi-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0018-mtk-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch
index 3f105a8..19d0b38 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0012-mtk-wifi-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0018-mtk-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch
@@ -1,7 +1,7 @@
-From 6992fbb2128d9df358760e654a7797b3f89efcb9 Mon Sep 17 00:00:00 2001
+From 805f8428e1f5d7fc4d466d66c9104588df0c65c5 Mon Sep 17 00:00:00 2001
From: mtk27745 <rex.lu@mediatek.com>
Date: Fri, 17 Nov 2023 11:01:04 +0800
-Subject: [PATCH 012/116] mtk: wifi: mt76: mt7996: Fix TGax HE-4.51.1_24G fail
+Subject: [PATCH 018/199] mtk: mt76: mt7996: Fix TGax HE-4.51.1_24G fail
According to sta capability to decide to enable/disable wed pao when create ppe entry.
without this patch, TGax HE-4.51.1_24G will test fail
@@ -12,10 +12,10 @@
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index dc8014e..0e8abe7 100644
+index 40281c5b..cbe8b009 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -1463,7 +1463,12 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1467,7 +1467,12 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
path->mtk_wdma.queue = 0;
path->mtk_wdma.wcid = msta->wcid.idx;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0013-mtk-wifi-mt76-mt7996-add-support-for-different-varia.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0019-mtk-mt76-mt7996-add-support-for-different-variants.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0013-mtk-wifi-mt76-mt7996-add-support-for-different-varia.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0019-mtk-mt76-mt7996-add-support-for-different-variants.patch
index 4f690df..3b06798 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0013-mtk-wifi-mt76-mt7996-add-support-for-different-varia.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0019-mtk-mt76-mt7996-add-support-for-different-variants.patch
@@ -1,8 +1,7 @@
-From f269d62b33ba484c31db69d71b9ebcac8e2fc094 Mon Sep 17 00:00:00 2001
+From 56eef7fe97e8010ac211973868ab9f5753fb56d3 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 20 Jul 2023 17:27:22 +0800
-Subject: [PATCH 013/116] mtk: wifi: mt76: mt7996: add support for different
- variants
+Subject: [PATCH 019/199] mtk: mt76: mt7996: add support for different variants
Add fem type (2i5i, 2i5e, 2e5e, ...)
Add Kite default bin for each fem type since loading wrong default bin
@@ -14,16 +13,17 @@
Chip manufactoring factories may transfer, which leads to different adie chip versions,
so we add this efuse check to avoid 7976c recognition failure.
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
GPIO ADie Combination of BE5040 should be considered as don't care
instead of 0
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
Only check eeprom chip id when fem type (= MT7996_FEM_UNSET) is not determined yet
Without this fix, mt7996_check_eeprom will return EINVAL in mt7996_eeprom_check_fw_mode
+Align the naming rule of the default eeprom bin
+efem: XX_DEFAULT
+ifem: XX_DEFAULT_INT
+mixed fem: XX_DEFAULT_MIX
+
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
mt7996/eeprom.c | 40 +++++++++++++++++++++++++++++--
@@ -35,7 +35,7 @@
6 files changed, 155 insertions(+), 6 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 4a82371..3260d1f 100644
+index 4a823711..f38629e3 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -9,14 +9,33 @@
@@ -84,14 +84,14 @@
- return MT7992_EEPROM_DEFAULT;
+ if (dev->chip_sku == MT7992_SKU_23) {
+ if (dev->fem_type == MT7996_FEM_INT)
-+ return MT7992_EEPROM_DEFAULT_23;
-+ return MT7992_EEPROM_DEFAULT_23_EXT;
++ return MT7992_EEPROM_DEFAULT_23_INT;
++ return MT7992_EEPROM_DEFAULT_23;
+ } else if (dev->chip_sku == MT7992_SKU_44) {
+ if (dev->fem_type == MT7996_FEM_INT)
-+ return MT7992_EEPROM_DEFAULT;
++ return MT7992_EEPROM_DEFAULT_INT;
+ else if (dev->fem_type == MT7996_FEM_MIX)
+ return MT7992_EEPROM_DEFAULT_MIX;
-+ return MT7992_EEPROM_DEFAULT_EXT;
++ return MT7992_EEPROM_DEFAULT;
+ }
+ return MT7992_EEPROM_DEFAULT_24;
default:
@@ -109,7 +109,7 @@
if (ret < 0) {
if (ret != -EINVAL)
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 412d6e2..72c38ad 100644
+index 412d6e2f..72c38ad3 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -29,6 +29,7 @@ enum mt7996_eeprom_field {
@@ -121,10 +121,10 @@
#define MT_EE_WIFI_CONF1_TX_PATH_BAND0 GENMASK(5, 3)
#define MT_EE_WIFI_CONF2_TX_PATH_BAND1 GENMASK(2, 0)
diff --git a/mt7996/init.c b/mt7996/init.c
-index ab2e17e..d58335a 100644
+index 2d7f42f7..f80fba28 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -885,6 +885,65 @@ out:
+@@ -887,6 +887,65 @@ out:
#endif
}
@@ -190,7 +190,7 @@
static int mt7996_init_hardware(struct mt7996_dev *dev)
{
int ret, idx;
-@@ -900,6 +959,10 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
+@@ -902,6 +961,10 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
INIT_LIST_HEAD(&dev->wed_rro.poll_list);
spin_lock_init(&dev->wed_rro.lock);
@@ -202,7 +202,7 @@
if (ret)
return ret;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 9ed8638..fb6ee7c 100644
+index 0c300b81..ae01a4eb 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -14,7 +14,12 @@
@@ -220,7 +220,7 @@
case 0x7990: \
default: \
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 58fa6b4..b7197dc 100644
+index 58fa6b45..16cefeac 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -39,8 +39,24 @@
@@ -240,12 +240,12 @@
#define MT7996_EEPROM_DEFAULT "mediatek/mt7996/mt7996_eeprom.bin"
-#define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom.bin"
+#define MT7996_EEPROM_DEFAULT_404 "mediatek/mt7996/mt7996_eeprom_dual_404.bin"
-+#define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
-+#define MT7992_EEPROM_DEFAULT_EXT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
++#define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
++#define MT7992_EEPROM_DEFAULT_INT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
+#define MT7992_EEPROM_DEFAULT_MIX "mediatek/mt7996/mt7992_eeprom_2i5e.bin"
+#define MT7992_EEPROM_DEFAULT_24 "mediatek/mt7996/mt7992_eeprom_24_2i5i.bin"
-+#define MT7992_EEPROM_DEFAULT_23 "mediatek/mt7996/mt7992_eeprom_23_2i5i.bin"
-+#define MT7992_EEPROM_DEFAULT_23_EXT "mediatek/mt7996/mt7992_eeprom_23_2e5e.bin"
++#define MT7992_EEPROM_DEFAULT_23 "mediatek/mt7996/mt7992_eeprom_23_2e5e.bin"
++#define MT7992_EEPROM_DEFAULT_23_INT "mediatek/mt7996/mt7992_eeprom_23_2i5i.bin"
#define MT7996_EEPROM_SIZE 7680
#define MT7996_EEPROM_BLOCK_SIZE 16
#define MT7996_TOKEN_SIZE 16384
@@ -303,7 +303,7 @@
int mt7996_run(struct ieee80211_hw *hw);
int mt7996_mcu_init(struct mt7996_dev *dev);
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index 47b429d..cf12c5e 100644
+index 47b429d8..cf12c5e0 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -662,6 +662,13 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0014-mtk-wifi-mt76-mt7996-ACS-channel-time-too-long-on-du.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0020-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0014-mtk-wifi-mt76-mt7996-ACS-channel-time-too-long-on-du.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0020-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch
index 6bcf893..81fecd3 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0014-mtk-wifi-mt76-mt7996-ACS-channel-time-too-long-on-du.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0020-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch
@@ -1,8 +1,8 @@
-From d2d45d00e7644e62f366203a17924f0e2025853a Mon Sep 17 00:00:00 2001
+From 1879c122435092c63eb0e8156f6e75d8e147fa13 Mon Sep 17 00:00:00 2001
From: "fancy.liu" <fancy.liu@mediatek.com>
Date: Tue, 14 Nov 2023 10:13:24 +0800
-Subject: [PATCH 014/116] mtk: wifi: mt76: mt7996: ACS channel time too long on
- duty channel
+Subject: [PATCH 020/199] mtk: mt76: mt7996: ACS channel time too long on duty
+ channel
Step and issue:
1. Set channel to 36 in hostapd config;
@@ -16,8 +16,6 @@
Solution:
When scan start, need to reset chan_stat in each channel switch.
-Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
-
Issue:
There's a chance that the channel time for duty channel is zero in ACS
scan.
@@ -43,7 +41,7 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mac80211.c b/mac80211.c
-index e4675bf..d291caa 100644
+index 6d47b26d..9df9109f 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -928,6 +928,7 @@ void mt76_set_channel(struct mt76_phy *phy)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0021-mtk-mt76-mt7996-Fixed-null-pointer-dereference-issue.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0021-mtk-mt76-mt7996-Fixed-null-pointer-dereference-issue.patch
new file mode 100644
index 0000000..31a8dd2
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0021-mtk-mt76-mt7996-Fixed-null-pointer-dereference-issue.patch
@@ -0,0 +1,34 @@
+From 7384dd7ed2828f0681ce1d765007d3f1976e8760 Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <meichia.chiu@mediatek.com>
+Date: Thu, 26 Oct 2023 10:08:10 +0800
+Subject: [PATCH 021/199] mtk: mt76: mt7996: Fixed null pointer dereference
+ issue
+
+---
+ mt7996/main.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index cbe8b009..72232994 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1083,9 +1083,16 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
+ struct ieee80211_sta *sta,
+ u32 changed)
+ {
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_dev *dev = phy->dev;
+
++ if (!msta->vif) {
++ dev_warn(dev->mt76.dev, "Un-initialized STA %pM wcid %d in rc_work\n",
++ sta->addr, msta->wcid.idx);
++ return;
++ }
++
+ mt7996_sta_rc_work(&changed, sta);
+ ieee80211_queue_work(hw, &dev->rc_work);
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0016-mtk-wifi-mt76-add-sanity-check-to-prevent-kernel-cra.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0022-mtk-mt76-add-sanity-check-to-prevent-kernel-crash.patch
similarity index 82%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0016-mtk-wifi-mt76-add-sanity-check-to-prevent-kernel-cra.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0022-mtk-mt76-add-sanity-check-to-prevent-kernel-crash.patch
index ebca1e8..feb14a6 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0016-mtk-wifi-mt76-add-sanity-check-to-prevent-kernel-cra.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0022-mtk-mt76-add-sanity-check-to-prevent-kernel-crash.patch
@@ -1,8 +1,7 @@
-From cfac6751faf2d57e1d02c44984f220b770ac6cf3 Mon Sep 17 00:00:00 2001
+From 8c9cbc14f8956087c0262f0e9e943689a6b6b00a Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 30 Oct 2023 11:06:19 +0800
-Subject: [PATCH 016/116] mtk: wifi: mt76: add sanity check to prevent kernel
- crash
+Subject: [PATCH 022/199] mtk: mt76: add sanity check to prevent kernel crash
wcid may not be initialized when mac80211 calls mt76.tx and it would lead to
kernel crash.
@@ -13,7 +12,7 @@
1 file changed, 8 insertions(+)
diff --git a/tx.c b/tx.c
-index 5cf6ede..ab42f69 100644
+index 5cf6edee..ab42f69b 100644
--- a/tx.c
+++ b/tx.c
@@ -345,6 +345,14 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0017-mtk-wifi-mt76-mt7996-add-firmware-WA-s-coredump.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0023-mtk-mt76-mt7996-add-firmware-WA-s-coredump.patch
similarity index 96%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0017-mtk-wifi-mt76-mt7996-add-firmware-WA-s-coredump.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0023-mtk-mt76-mt7996-add-firmware-WA-s-coredump.patch
index 7ab6d8f..dfa716b 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0017-mtk-wifi-mt76-mt7996-add-firmware-WA-s-coredump.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0023-mtk-mt76-mt7996-add-firmware-WA-s-coredump.patch
@@ -1,7 +1,7 @@
-From 06ea431d801676bc203ee274503cdb876abcf73c Mon Sep 17 00:00:00 2001
+From 107e29828372478e61e6f01f96148ab89c164c82 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Fri, 19 May 2023 14:16:50 +0800
-Subject: [PATCH 017/116] mtk: wifi: mt76: mt7996: add firmware WA's coredump.
+Subject: [PATCH 023/199] mtk: mt76: mt7996: add firmware WA's coredump.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -14,7 +14,7 @@
6 files changed, 182 insertions(+), 83 deletions(-)
diff --git a/mt7996/coredump.c b/mt7996/coredump.c
-index ccab0d7..60b8808 100644
+index ccab0d7b..60b88085 100644
--- a/mt7996/coredump.c
+++ b/mt7996/coredump.c
@@ -7,11 +7,11 @@
@@ -335,7 +335,7 @@
}
diff --git a/mt7996/coredump.h b/mt7996/coredump.h
-index af2ba21..01ed373 100644
+index af2ba219..01ed3731 100644
--- a/mt7996/coredump.h
+++ b/mt7996/coredump.h
@@ -6,10 +6,13 @@
@@ -428,10 +428,10 @@
return NULL;
}
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 3afdd7e..d88bbfb 100644
+index 503e92c0..00396c82 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1998,28 +1998,25 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -2007,28 +2007,25 @@ void mt7996_mac_reset_work(struct work_struct *work)
}
/* firmware coredump */
@@ -464,7 +464,7 @@
if (!mem_region || !crash_data->memdump_buf_len) {
mutex_unlock(&dev->dump_mutex);
goto skip_memdump;
-@@ -2029,6 +2026,9 @@ void mt7996_mac_dump_work(struct work_struct *work)
+@@ -2038,6 +2035,9 @@ void mt7996_mac_dump_work(struct work_struct *work)
buf_len = crash_data->memdump_buf_len;
/* dumping memory content... */
@@ -474,7 +474,7 @@
memset(buf, 0, buf_len);
for (i = 0; i < num; i++) {
if (mem_region->len > buf_len) {
-@@ -2045,6 +2045,7 @@ void mt7996_mac_dump_work(struct work_struct *work)
+@@ -2054,6 +2054,7 @@ void mt7996_mac_dump_work(struct work_struct *work)
mt7996_memcpy_fromio(dev, buf, mem_region->start,
mem_region->len);
@@ -482,7 +482,7 @@
hdr->start = mem_region->start;
hdr->len = mem_region->len;
-@@ -2061,8 +2062,20 @@ void mt7996_mac_dump_work(struct work_struct *work)
+@@ -2070,8 +2071,20 @@ void mt7996_mac_dump_work(struct work_struct *work)
mutex_unlock(&dev->dump_mutex);
skip_memdump:
@@ -506,10 +506,10 @@
}
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index fb6ee7c..f4bbb78 100644
+index ae01a4eb..da92b33e 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -2704,6 +2704,8 @@ static int mt7996_load_patch(struct mt7996_dev *dev)
+@@ -2707,6 +2707,8 @@ static int mt7996_load_patch(struct mt7996_dev *dev)
dev_info(dev->mt76.dev, "HW/SW Version: 0x%x, Build Time: %.16s\n",
be32_to_cpu(hdr->hw_sw_ver), hdr->build_date);
@@ -518,7 +518,7 @@
for (i = 0; i < be32_to_cpu(hdr->desc.n_region); i++) {
struct mt7996_patch_sec *sec;
-@@ -2830,6 +2832,9 @@ static int __mt7996_load_ram(struct mt7996_dev *dev, const char *fw_type,
+@@ -2833,6 +2835,9 @@ static int __mt7996_load_ram(struct mt7996_dev *dev, const char *fw_type,
}
hdr = (const void *)(fw->data + fw->size - sizeof(*hdr));
@@ -529,7 +529,7 @@
fw_type, hdr->fw_ver, hdr->build_date);
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index b7197dc..e12ad31 100644
+index 16cefeac..7c2e6894 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -84,6 +84,8 @@
@@ -563,7 +563,7 @@
struct list_head sta_rc_list;
struct list_head twt_list;
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index cf12c5e..4c20a67 100644
+index cf12c5e0..4c20a67d 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -597,7 +597,8 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0018-mtk-wifi-mt76-mt7996-for-build-pass.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0024-mtk-mt76-mt7996-for-build-pass.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0018-mtk-wifi-mt76-mt7996-for-build-pass.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0024-mtk-mt76-mt7996-for-build-pass.patch
index 001f887..b790e63 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0018-mtk-wifi-mt76-mt7996-for-build-pass.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0024-mtk-mt76-mt7996-for-build-pass.patch
@@ -1,7 +1,7 @@
-From e3182cb0870f1d702a01deecdf62493832ab4fd9 Mon Sep 17 00:00:00 2001
+From 2b0fed32f1dcb4b51cc061816ece60647e497af8 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 3 Nov 2022 00:27:17 +0800
-Subject: [PATCH 018/116] mtk: wifi: mt76: mt7996: for build pass
+Subject: [PATCH 024/199] mtk: mt76: mt7996: for build pass
---
debugfs.c | 3 +++
@@ -16,7 +16,7 @@
9 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/debugfs.c b/debugfs.c
-index c4649ba..ac5207e 100644
+index c4649ba0..ac5207e5 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -33,8 +33,11 @@ mt76_napi_threaded_set(void *data, u64 val)
@@ -32,7 +32,7 @@
return 0;
}
diff --git a/dma.c b/dma.c
-index f4f88c4..5604463 100644
+index f4f88c44..56044639 100644
--- a/dma.c
+++ b/dma.c
@@ -883,7 +883,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
@@ -45,7 +45,7 @@
goto free_frag;
diff --git a/mcu.c b/mcu.c
-index a8cafa3..fa4b054 100644
+index a8cafa39..fa4b0544 100644
--- a/mcu.c
+++ b/mcu.c
@@ -4,6 +4,7 @@
@@ -57,7 +57,7 @@
struct sk_buff *
__mt76_mcu_msg_alloc(struct mt76_dev *dev, const void *data,
diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index c807bd8..a931066 100644
+index d50d9678..18176e78 100644
--- a/mt7615/mcu.c
+++ b/mt7615/mcu.c
@@ -10,6 +10,7 @@
@@ -69,7 +69,7 @@
static bool prefer_offload_fw = true;
module_param(prefer_offload_fw, bool, 0644);
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index b35acf8..1e34e0a 100644
+index 4dce03dd..a1deeacd 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -4,6 +4,7 @@
@@ -81,7 +81,7 @@
int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option)
{
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index fc194e0..363ea0e 100644
+index 71236fe7..3c1a8fd4 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -6,6 +6,7 @@
@@ -93,7 +93,7 @@
#define fw_name(_dev, name, ...) ({ \
char *_fw; \
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index 73e633d..759a58e 100644
+index 73e633d0..759a58e8 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -641,8 +641,8 @@ int mt7996_dma_init(struct mt7996_dev *dev)
@@ -108,7 +108,7 @@
mt7996_dma_enable(dev, false);
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 3260d1f..121a3c9 100644
+index f38629e3..bd02eb00 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -138,6 +138,7 @@ static int mt7996_eeprom_parse_efuse_hw_cap(struct mt7996_dev *dev)
@@ -120,7 +120,7 @@
dev->has_eht = !(cap & MODE_HE_ONLY);
dev->wtbl_size_group = u32_get_bits(cap, WTBL_SIZE_GROUP);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index f4bbb78..90332fe 100644
+index da92b33e..88c42de7 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -5,6 +5,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0019-mtk-wifi-mt76-mt7996-add-debug-tool.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0025-mtk-mt76-mt7996-add-debug-tool.patch
similarity index 99%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0019-mtk-wifi-mt76-mt7996-add-debug-tool.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0025-mtk-mt76-mt7996-add-debug-tool.patch
index e6aae93..239b093 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0019-mtk-wifi-mt76-mt7996-add-debug-tool.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0025-mtk-mt76-mt7996-add-debug-tool.patch
@@ -1,19 +1,13 @@
-From fe15bfb3335bcbdf95fed1563646d84154607b42 Mon Sep 17 00:00:00 2001
+From ecccabe4621048b66cb36ceba76497cde04a8ec1 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 24 Mar 2023 14:02:32 +0800
-Subject: [PATCH 019/116] mtk: wifi: mt76: mt7996: add debug tool
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Subject: [PATCH 025/199] mtk: mt76: mt7996: add debug tool
Add PSM bit in sta_info
-Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
-
Remove the duplicate function in mtk_debugfs.c & mtk_debug_i.c
Only enable mt7996_mcu_fw_log_2_host function in mcu.c
-Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
-
Support more ids category NDPA/NDP TXD/FBK and debug log recommended by
CTD members.
@@ -23,22 +17,14 @@
2. iwpriv ra0 set fw_dbg=2:84
3. iwpriv ra0 set fw_dbg=1:101
-Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
-
mtk: wifi: mt76: mt7996: add wtbl_info support for mt7992
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: mt7996: add mt7992 & mt7996 CR debug offset revision
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: mt7992: refactor code for FW log
Refactor code for FW log.
-Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
-
mtk: wifi: mt76: mt7996: support disable muru debug info when recording fwlog
When we record fwlog, we will also enable recording muru debug info log by
@@ -58,11 +44,18 @@
0 = enable recording muru debug info (Default value)
1 = disable recording muru debug info
-Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
-
mtk: wifi: mt76: mt7996: add adie id & ver dump
+Do not show fw version in fw_wm_info.
+The fw_wm_info is used to dump fw status when wm crash. When wm crash,
+we are not able to use any mcu command.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
mt76.h | 2 +
mt7996/Makefile | 4 +
@@ -72,21 +65,22 @@
mt7996/mac.c | 3 +
mt7996/mt7996.h | 13 +
mt7996/mtk_debug.h | 2286 ++++++++++++++++++++++++++++++++++++++
- mt7996/mtk_debugfs.c | 2507 ++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_debugfs.c | 2506 ++++++++++++++++++++++++++++++++++++++++++
mt7996/mtk_mcu.c | 39 +
mt7996/mtk_mcu.h | 19 +
+ tools/CMakeLists.txt | 7 +
tools/fwlog.c | 25 +-
- 12 files changed, 5018 insertions(+), 25 deletions(-)
+ 13 files changed, 5024 insertions(+), 25 deletions(-)
create mode 100644 mt7996/mtk_debug.h
create mode 100644 mt7996/mtk_debugfs.c
create mode 100644 mt7996/mtk_mcu.c
create mode 100644 mt7996/mtk_mcu.h
diff --git a/mt76.h b/mt76.h
-index 7f3ec40..b421a98 100644
+index 45039377..beba1d91 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -399,6 +399,8 @@ struct mt76_txwi_cache {
+@@ -403,6 +403,8 @@ struct mt76_txwi_cache {
struct sk_buff *skb;
void *ptr;
};
@@ -96,7 +90,7 @@
struct mt76_rx_tid {
diff --git a/mt7996/Makefile b/mt7996/Makefile
-index 07c8b55..a056b40 100644
+index 07c8b555..a056b40e 100644
--- a/mt7996/Makefile
+++ b/mt7996/Makefile
@@ -1,4 +1,6 @@
@@ -113,7 +107,7 @@
+
+mt7996e-y += mtk_debugfs.o mtk_mcu.o
diff --git a/mt7996/coredump.c b/mt7996/coredump.c
-index 60b8808..a7f91b5 100644
+index 60b88085..a7f91b56 100644
--- a/mt7996/coredump.c
+++ b/mt7996/coredump.c
@@ -195,7 +195,7 @@ mt7996_coredump_fw_stack(struct mt7996_dev *dev, u8 type, struct mt7996_coredump
@@ -162,7 +156,7 @@
dev_warn(dev->mt76.dev, "no crash dump data found\n");
return -ENODATA;
diff --git a/mt7996/coredump.h b/mt7996/coredump.h
-index 01ed373..93cd84a 100644
+index 01ed3731..93cd84a0 100644
--- a/mt7996/coredump.h
+++ b/mt7996/coredump.h
@@ -75,6 +75,7 @@ struct mt7996_mem_region {
@@ -187,7 +181,7 @@
mt7996_crash_data *mt7996_coredump_new(struct mt7996_dev *dev, u8 type)
{
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 62c03d0..344c759 100644
+index a17c99a2..9671c15d 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -295,11 +295,39 @@ mt7996_fw_debug_wm_set(void *data, u64 val)
@@ -326,7 +320,7 @@
return mt7996_fw_debug_wm_set(dev, dev->fw_debug_wm);
}
-@@ -785,6 +855,30 @@ mt7996_rf_regval_set(void *data, u64 val)
+@@ -772,6 +842,30 @@ mt7996_rf_regval_set(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(fops_rf_regval, mt7996_rf_regval_get,
mt7996_rf_regval_set, "0x%08llx\n");
@@ -357,7 +351,7 @@
int mt7996_init_debugfs(struct mt7996_phy *phy)
{
struct mt7996_dev *dev = phy->dev;
-@@ -820,10 +914,17 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
+@@ -807,10 +901,17 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
mt7996_rdd_monitor);
}
@@ -375,7 +369,7 @@
return 0;
}
-@@ -835,7 +936,11 @@ mt7996_debugfs_write_fwlog(struct mt7996_dev *dev, const void *hdr, int hdrlen,
+@@ -822,7 +923,11 @@ mt7996_debugfs_write_fwlog(struct mt7996_dev *dev, const void *hdr, int hdrlen,
unsigned long flags;
void *dest;
@@ -387,7 +381,7 @@
dest = relay_reserve(dev->relay_fwlog, hdrlen + len + 4);
if (dest) {
*(u32 *)dest = hdrlen + len;
-@@ -868,9 +973,6 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
+@@ -855,9 +960,6 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
.msg_type = cpu_to_le16(PKT_TYPE_RX_FW_MONITOR),
};
@@ -398,10 +392,10 @@
hdr.timestamp = cpu_to_le32(mt76_rr(dev, MT_LPON_FRCR(0)));
hdr.len = *(__le16 *)data;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index d88bbfb..1f53d23 100644
+index 00396c82..52ea6796 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -936,6 +936,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -945,6 +945,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
id = mt76_token_consume(mdev, &t);
if (id < 0)
return id;
@@ -412,7 +406,7 @@
pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb);
memset(txwi_ptr, 0, MT_TXD_SIZE);
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index e12ad31..696e16f 100644
+index 7c2e6894..bb7536ff 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -362,6 +362,7 @@ struct mt7996_dev {
@@ -451,7 +445,7 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_debug.h b/mt7996/mtk_debug.h
new file mode 100644
-index 0000000..27d8f1c
+index 00000000..27d8f1cb
--- /dev/null
+++ b/mt7996/mtk_debug.h
@@ -0,0 +1,2286 @@
@@ -2743,10 +2737,10 @@
+#endif
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
new file mode 100644
-index 0000000..d79e00c
+index 00000000..64952a73
--- /dev/null
+++ b/mt7996/mtk_debugfs.c
-@@ -0,0 +1,2507 @@
+@@ -0,0 +1,2506 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Copyright (C) 2023 MediaTek Inc.
@@ -3095,7 +3089,7 @@
+ [MT7996_FEM_MIX] = "mixed FEM",
+ };
+
-+ seq_printf(s, "Version: 4.3.24.5\n");
++ seq_printf(s, "Version: 4.3.24.7\n");
+
+ if (!test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
+ return 0;
@@ -3151,7 +3145,6 @@
+
+ seq_printf(s, "\x1b[32m%s log output\x1b[0m\n", dump->fw_type);
+ seq_printf(s, "\x1b[32mfw status: %s\n", dump->fw_state);
-+ mt7996_dump_version(s, NULL);
+ /* PC log */
+ now = jiffies;
+ for (i = 0; i < 10; i++)
@@ -5256,7 +5249,7 @@
+#endif
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
new file mode 100644
-index 0000000..c16b25a
+index 00000000..c16b25ab
--- /dev/null
+++ b/mt7996/mtk_mcu.c
@@ -0,0 +1,39 @@
@@ -5301,7 +5294,7 @@
+#endif
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
new file mode 100644
-index 0000000..7f4d4e0
+index 00000000..7f4d4e02
--- /dev/null
+++ b/mt7996/mtk_mcu.h
@@ -0,0 +1,19 @@
@@ -5324,8 +5317,26 @@
+#endif
+
+#endif
+diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
+index 3a83e34d..6599c444 100644
+--- a/tools/CMakeLists.txt
++++ b/tools/CMakeLists.txt
+@@ -3,6 +3,13 @@ cmake_minimum_required(VERSION 2.8)
+ PROJECT(mt76-test C)
+ ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3)
+
++UNSET(backports_dir CACHE)
++FIND_PATH(
++ backports_dir
++ NAMES "mac80211/uapi/linux"
++)
++INCLUDE_DIRECTORIES("${backports_dir}/mac80211/uapi")
++
+ ADD_EXECUTABLE(mt76-test main.c fields.c eeprom.c fwlog.c)
+ TARGET_LINK_LIBRARIES(mt76-test nl-tiny)
+
diff --git a/tools/fwlog.c b/tools/fwlog.c
-index e5d4a10..3c6a61d 100644
+index e5d4a105..3c6a61d7 100644
--- a/tools/fwlog.c
+++ b/tools/fwlog.c
@@ -26,7 +26,7 @@ static const char *debugfs_path(const char *phyname, const char *file)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0020-mtk-wifi-mt76-mt7996-add-check-for-hostapd-config-he.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0026-mtk-mt76-mt7996-add-check-for-hostapd-config-he_ldpc.patch
similarity index 89%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0020-mtk-wifi-mt76-mt7996-add-check-for-hostapd-config-he.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0026-mtk-mt76-mt7996-add-check-for-hostapd-config-he_ldpc.patch
index f02a3eb..27625e6 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0020-mtk-wifi-mt76-mt7996-add-check-for-hostapd-config-he.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0026-mtk-mt76-mt7996-add-check-for-hostapd-config-he_ldpc.patch
@@ -1,7 +1,7 @@
-From 4974096ee9b3e3a6083da610ce13dde3b82608c9 Mon Sep 17 00:00:00 2001
+From 57e5d3d3887af43a399f747f96e7a185bc726229 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Thu, 8 Jun 2023 17:32:33 +0800
-Subject: [PATCH 020/116] mtk: wifi: mt76: mt7996: add check for hostapd config
+Subject: [PATCH 026/199] mtk: mt76: mt7996: add check for hostapd config
he_ldpc
Add check for hostapd config he_ldpc.
@@ -15,7 +15,7 @@
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 90332fe..6c565c9 100644
+index 88c42de7..4ff1af78 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1188,7 +1188,8 @@ int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
@@ -49,7 +49,7 @@
/* sta_rec_ra accommodates BW, NSS and only MCS range format
* i.e 0-{7,8,9} for VHT.
-@@ -2201,7 +2207,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2204,7 +2210,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
/* starec amsdu */
mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, sta);
/* starec he */
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0021-mtk-wifi-mt76-testmode-add-basic-testmode-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0027-mtk-mt76-mt7996-add-basic-testmode-support.patch
similarity index 96%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0021-mtk-wifi-mt76-testmode-add-basic-testmode-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0027-mtk-mt76-mt7996-add-basic-testmode-support.patch
index 19ea968..3337917 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0021-mtk-wifi-mt76-testmode-add-basic-testmode-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0027-mtk-mt76-mt7996-add-basic-testmode-support.patch
@@ -1,14 +1,10 @@
-From 501b857b081c10d3400c8b4374db346b238d3f72 Mon Sep 17 00:00:00 2001
+From c051b319e725ca566a990b375c089bf74d53e021 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 28 Dec 2022 22:24:25 +0800
-Subject: [PATCH 021/116] mtk: wifi: mt76: testmode: add basic testmode support
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Subject: [PATCH 027/199] mtk: mt76: mt7996: add basic testmode support
Add testmode eeprom buffer mode support
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
Fix power & freq offset issue for iTest power cal & tx/rx verifcation
1. Wait for fw to tx. Otherwise, iTest testing tool cannot get the
accurate tx power.
@@ -16,8 +12,6 @@
and 2G band. Therefore, we should avoid reseting freq offset to 0 when
6G interface is off.
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
edcca return err in testmode; therefore, bypass it when we are in testmode idle state or testmode bf is on
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -34,18 +28,18 @@
mt7996/main.c | 27 ++
mt7996/mcu.c | 59 +++-
mt7996/mcu.h | 33 +++
- mt7996/mt7996.h | 28 +-
+ mt7996/mt7996.h | 27 +-
mt7996/testmode.c | 740 ++++++++++++++++++++++++++++++++++++++++++++++
mt7996/testmode.h | 299 +++++++++++++++++++
testmode.c | 126 ++++++--
testmode.h | 87 +++++-
tools/fields.c | 102 ++++++-
- 18 files changed, 1548 insertions(+), 50 deletions(-)
+ 18 files changed, 1547 insertions(+), 50 deletions(-)
create mode 100644 mt7996/testmode.c
create mode 100644 mt7996/testmode.h
diff --git a/eeprom.c b/eeprom.c
-index 0bc66cc..a0047d7 100644
+index 0bc66cc1..a0047d79 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -94,8 +94,10 @@ int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int l
@@ -62,7 +56,7 @@
out_put_node:
diff --git a/mac80211.c b/mac80211.c
-index d291caa..9a1eb47 100644
+index 9df9109f..7e4ee83f 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -846,7 +846,8 @@ void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
@@ -76,10 +70,10 @@
if (status->flag & RX_FLAG_FAILED_FCS_CRC)
phy->test.rx_stats.fcs_error[q]++;
diff --git a/mt76.h b/mt76.h
-index b421a98..57b75fa 100644
+index beba1d91..27635c49 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -700,14 +700,21 @@ struct mt76_testmode_ops {
+@@ -704,14 +704,21 @@ struct mt76_testmode_ops {
int (*set_params)(struct mt76_phy *phy, struct nlattr **tb,
enum mt76_testmode_state new_state);
int (*dump_stats)(struct mt76_phy *phy, struct sk_buff *msg);
@@ -101,7 +95,7 @@
u32 tx_count;
u16 tx_mpdu_len;
-@@ -717,6 +724,7 @@ struct mt76_testmode_data {
+@@ -721,6 +728,7 @@ struct mt76_testmode_data {
u8 tx_rate_sgi;
u8 tx_rate_ldpc;
u8 tx_rate_stbc;
@@ -109,7 +103,7 @@
u8 tx_ltf;
u8 tx_antenna_mask;
-@@ -726,6 +734,9 @@ struct mt76_testmode_data {
+@@ -730,6 +738,9 @@ struct mt76_testmode_data {
u32 tx_time;
u32 tx_ipg;
@@ -119,7 +113,7 @@
u32 freq_offset;
u8 tx_power[4];
-@@ -740,7 +751,16 @@ struct mt76_testmode_data {
+@@ -744,7 +755,16 @@ struct mt76_testmode_data {
struct {
u64 packets[__MT_RXQ_MAX];
u64 fcs_error[__MT_RXQ_MAX];
@@ -136,7 +130,7 @@
};
struct mt76_vif {
-@@ -1444,6 +1464,22 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
+@@ -1453,6 +1473,22 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
int mt76_testmode_set_state(struct mt76_phy *phy, enum mt76_testmode_state state);
int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len);
@@ -160,10 +154,10 @@
{
#ifdef CONFIG_NL80211_TESTMODE
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 1e187a8..0b9c6c5 100644
+index a7cb33d2..57e0e9de 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1269,12 +1269,14 @@ enum {
+@@ -1279,12 +1279,14 @@ enum {
MCU_UNI_CMD_EFUSE_CTRL = 0x2d,
MCU_UNI_CMD_RA = 0x2f,
MCU_UNI_CMD_MURU = 0x31,
@@ -179,7 +173,7 @@
MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
MCU_UNI_CMD_PER_STA_INFO = 0x6d,
diff --git a/mt7996/Makefile b/mt7996/Makefile
-index a056b40..7bb17f4 100644
+index a056b40e..7bb17f44 100644
--- a/mt7996/Makefile
+++ b/mt7996/Makefile
@@ -8,5 +8,6 @@ mt7996e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o \
@@ -190,7 +184,7 @@
mt7996e-y += mtk_debugfs.o mtk_mcu.o
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 121a3c9..f9b9ca2 100644
+index bd02eb00..e2790109 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -6,6 +6,11 @@
@@ -269,7 +263,7 @@
}
}
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 72c38ad..de3ff4e 100644
+index 72c38ad3..de3ff4e2 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -14,6 +14,7 @@ enum mt7996_eeprom_field {
@@ -281,10 +275,10 @@
MT_EE_RATE_DELTA_2G = 0x1400,
MT_EE_RATE_DELTA_5G = 0x147d,
diff --git a/mt7996/init.c b/mt7996/init.c
-index d58335a..440e26d 100644
+index f80fba28..ed7c7040 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -969,6 +969,10 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
+@@ -971,6 +971,10 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
@@ -295,7 +289,7 @@
ret = mt7996_mcu_init(dev);
if (ret)
return ret;
-@@ -1419,6 +1423,10 @@ int mt7996_register_device(struct mt7996_dev *dev)
+@@ -1420,6 +1424,10 @@ int mt7996_register_device(struct mt7996_dev *dev)
mt7996_init_wiphy(hw, &dev->mt76.mmio.wed);
@@ -307,7 +301,7 @@
ARRAY_SIZE(mt76_rates));
if (ret)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 1f53d23..603f6c0 100644
+index 52ea6796..a0fcd8aa 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -685,7 +685,8 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
@@ -321,7 +315,7 @@
if (!status->wcid || !ieee80211_is_data_qos(fc) || hw_aggr)
diff --git a/mt7996/main.c b/mt7996/main.c
-index e66c607..50c7f07 100644
+index 72232994..be50f7f3 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -23,6 +23,18 @@ static bool mt7996_dev_running(struct mt7996_dev *dev)
@@ -364,7 +358,7 @@
ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH);
if (ret)
goto out;
-@@ -411,6 +430,12 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
+@@ -415,6 +434,12 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
int ret;
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
@@ -377,7 +371,7 @@
ret = mt7996_mcu_set_pp_en(phy, PP_USR_MODE,
phy->mt76->chandef.punctured);
if (ret)
-@@ -1523,6 +1548,8 @@ const struct ieee80211_ops mt7996_ops = {
+@@ -1531,6 +1556,8 @@ const struct ieee80211_ops mt7996_ops = {
.sta_set_decap_offload = mt7996_sta_set_decap_offload,
.add_twt_setup = mt7996_mac_add_twt_setup,
.twt_teardown_request = mt7996_twt_teardown_request,
@@ -387,10 +381,10 @@
.sta_add_debugfs = mt7996_sta_add_debugfs,
#endif
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 6c565c9..2bca86a 100644
+index 4ff1af78..61b46370 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -2865,8 +2865,12 @@ static int mt7996_load_ram(struct mt7996_dev *dev)
+@@ -2868,8 +2868,12 @@ static int mt7996_load_ram(struct mt7996_dev *dev)
{
int ret;
@@ -405,7 +399,7 @@
if (ret)
return ret;
-@@ -3557,17 +3561,9 @@ int mt7996_mcu_set_eeprom(struct mt7996_dev *dev)
+@@ -3560,17 +3564,9 @@ int mt7996_mcu_set_eeprom(struct mt7996_dev *dev)
&req, sizeof(req), true);
}
@@ -425,7 +419,7 @@
.tag = cpu_to_le16(UNI_EFUSE_ACCESS),
.len = cpu_to_le16(sizeof(req) - 4),
.addr = cpu_to_le32(round_down(offset,
-@@ -3576,6 +3572,7 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset)
+@@ -3579,6 +3575,7 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset)
struct sk_buff *skb;
bool valid;
int ret;
@@ -433,7 +427,7 @@
ret = mt76_mcu_send_and_get_msg(&dev->mt76,
MCU_WM_UNI_CMD_QUERY(EFUSE_CTRL),
-@@ -3586,7 +3583,9 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset)
+@@ -3589,7 +3586,9 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset)
valid = le32_to_cpu(*(__le32 *)(skb->data + 16));
if (valid) {
u32 addr = le32_to_cpu(*(__le32 *)(skb->data + 12));
@@ -444,7 +438,7 @@
skb_pull(skb, 48);
memcpy(buf, skb->data, MT7996_EEPROM_BLOCK_SIZE);
-@@ -4609,3 +4608,37 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
+@@ -4612,3 +4611,37 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(PP),
&req, sizeof(req), false);
}
@@ -483,7 +477,7 @@
+ &req, sizeof(req), false);
+}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 2052555..d5ac2b3 100644
+index df42c0f8..abf8ef48 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -157,6 +157,16 @@ struct mt7996_mcu_eeprom {
@@ -536,10 +530,10 @@
enum {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 696e16f..0c6a4b9 100644
+index bb7536ff..1e1e638a 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -32,25 +32,30 @@
+@@ -32,21 +32,25 @@
#define MT7996_FIRMWARE_WA "mediatek/mt7996/mt7996_wa.bin"
#define MT7996_FIRMWARE_WM "mediatek/mt7996/mt7996_wm.bin"
#define MT7996_FIRMWARE_DSP "mediatek/mt7996/mt7996_dsp.bin"
@@ -565,12 +559,7 @@
#define MT7992_ROM_PATCH_23 "mediatek/mt7996/mt7992_rom_patch_23.bin"
#define MT7996_EEPROM_DEFAULT "mediatek/mt7996/mt7996_eeprom.bin"
- #define MT7996_EEPROM_DEFAULT_404 "mediatek/mt7996/mt7996_eeprom_dual_404.bin"
-+#define MT7996_EEPROM_DEFAULT_TM "mediatek/mt7996/mt7996_eeprom_tm.bin"
- #define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_EXT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
- #define MT7992_EEPROM_DEFAULT_MIX "mediatek/mt7996/mt7992_eeprom_2i5e.bin"
-@@ -127,6 +132,7 @@ enum mt7992_sku_type {
+@@ -127,6 +131,7 @@ enum mt7992_sku_type {
enum mt7996_ram_type {
MT7996_RAM_TYPE_WM,
@@ -578,7 +567,7 @@
MT7996_RAM_TYPE_WA,
MT7996_RAM_TYPE_DSP,
__MT7996_RAM_TYPE_MAX,
-@@ -277,6 +283,21 @@ struct mt7996_phy {
+@@ -277,6 +282,21 @@ struct mt7996_phy {
u8 pp_mode;
u16 punct_bitmap;
@@ -600,7 +589,7 @@
};
struct mt7996_dev {
-@@ -357,6 +378,8 @@ struct mt7996_dev {
+@@ -357,6 +377,8 @@ struct mt7996_dev {
spinlock_t lock;
} wed_rro;
@@ -609,7 +598,7 @@
bool ibf;
u8 fw_debug_wm;
u8 fw_debug_wa;
-@@ -472,6 +495,7 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
+@@ -472,6 +494,7 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
extern const struct ieee80211_ops mt7996_ops;
extern struct pci_driver mt7996_pci_driver;
extern struct pci_driver mt7996_hif_driver;
@@ -617,7 +606,7 @@
struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
void __iomem *mem_base, u32 device_id);
-@@ -481,6 +505,7 @@ u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif);
+@@ -481,6 +504,7 @@ u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif);
int mt7996_register_device(struct mt7996_dev *dev);
void mt7996_unregister_device(struct mt7996_dev *dev);
int mt7996_eeprom_init(struct mt7996_dev *dev);
@@ -625,7 +614,7 @@
int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy);
int mt7996_eeprom_get_target_power(struct mt7996_dev *dev,
struct ieee80211_channel *chan);
-@@ -533,7 +558,7 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
+@@ -533,7 +557,7 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, void *data, u32 field);
int mt7996_mcu_set_eeprom(struct mt7996_dev *dev);
@@ -634,7 +623,7 @@
int mt7996_mcu_get_eeprom_free_block(struct mt7996_dev *dev, u8 *block_num);
int mt7996_mcu_get_chip_config(struct mt7996_dev *dev, u32 *cap);
int mt7996_mcu_set_ser(struct mt7996_dev *dev, u8 action, u8 set, u8 band);
-@@ -568,6 +593,7 @@ void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb);
+@@ -568,6 +592,7 @@ void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb);
void mt7996_mcu_exit(struct mt7996_dev *dev);
int mt7996_mcu_get_all_sta_info(struct mt7996_phy *phy, u16 tag);
int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id);
@@ -644,7 +633,7 @@
{
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
new file mode 100644
-index 0000000..98eebce
+index 00000000..98eebcee
--- /dev/null
+++ b/mt7996/testmode.c
@@ -0,0 +1,740 @@
@@ -1390,7 +1379,7 @@
+};
diff --git a/mt7996/testmode.h b/mt7996/testmode.h
new file mode 100644
-index 0000000..319ef25
+index 00000000..319ef257
--- /dev/null
+++ b/mt7996/testmode.h
@@ -0,0 +1,299 @@
@@ -1694,7 +1683,7 @@
+
+#endif
diff --git a/testmode.c b/testmode.c
-index ca4fecc..44f3a5b 100644
+index ca4feccf..44f3a5bf 100644
--- a/testmode.c
+++ b/testmode.c
@@ -2,11 +2,13 @@
@@ -1961,7 +1950,7 @@
if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER)) {
diff --git a/testmode.h b/testmode.h
-index 5e2792d..96872e8 100644
+index 5e2792d8..96872e8c 100644
--- a/testmode.h
+++ b/testmode.h
@@ -5,7 +5,8 @@
@@ -2151,7 +2140,7 @@
#endif
diff --git a/tools/fields.c b/tools/fields.c
-index e3f6908..055f90f 100644
+index e3f69089..055f90f3 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -10,6 +10,7 @@ static const char * const testmode_state[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0022-mtk-wifi-mt76-testmode-add-testmode-pre-calibration-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0028-mtk-mt76-mt7996-add-testmode-pre-calibration-support.patch
similarity index 96%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0022-mtk-wifi-mt76-testmode-add-testmode-pre-calibration-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0028-mtk-mt76-mt7996-add-testmode-pre-calibration-support.patch
index 27a6593..6ec0d14 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0022-mtk-wifi-mt76-testmode-add-testmode-pre-calibration-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0028-mtk-mt76-mt7996-add-testmode-pre-calibration-support.patch
@@ -1,8 +1,8 @@
-From 19f055d29f67eb3ace29ccb6400a6bd59da8af7e Mon Sep 17 00:00:00 2001
+From e003b705dbccb31a9150c04de3bfcb5e2d2e8a0b Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 31 Mar 2023 11:27:24 +0800
-Subject: [PATCH 022/116] mtk: wifi: mt76: testmode: add testmode
- pre-calibration support
+Subject: [PATCH 028/199] mtk: mt76: mt7996: add testmode pre-calibration
+ support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -21,7 +21,7 @@
12 files changed, 632 insertions(+), 23 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index 9a1eb47..e2ff011 100644
+index 7e4ee83f..5b02fa35 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -6,27 +6,6 @@
@@ -53,7 +53,7 @@
CHAN2G(1, 2412),
CHAN2G(2, 2417),
diff --git a/mt76.h b/mt76.h
-index 57b75fa..c591f67 100644
+index 27635c49..362243f6 100644
--- a/mt76.h
+++ b/mt76.h
@@ -23,6 +23,27 @@
@@ -84,7 +84,7 @@
#define MT_MCU_RING_SIZE 32
#define MT_RX_BUF_SIZE 2048
#define MT_SKB_HEAD_LEN 256
-@@ -703,6 +724,7 @@ struct mt76_testmode_ops {
+@@ -707,6 +728,7 @@ struct mt76_testmode_ops {
void (*reset_rx_stats)(struct mt76_phy *phy);
void (*tx_stop)(struct mt76_phy *phy);
int (*set_eeprom)(struct mt76_phy *phy, u32 offset, u8 *val, u8 action);
@@ -93,10 +93,10 @@
#define MT_TM_FW_RX_COUNT BIT(0)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 0b9c6c5..1919325 100644
+index 57e0e9de..f994a2b3 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1043,8 +1043,10 @@ enum {
+@@ -1053,8 +1053,10 @@ enum {
MCU_UNI_EVENT_RDD_REPORT = 0x11,
MCU_UNI_EVENT_ROC = 0x27,
MCU_UNI_EVENT_TX_DONE = 0x2d,
@@ -108,7 +108,7 @@
MCU_UNI_EVENT_PER_STA_INFO = 0x6d,
MCU_UNI_EVENT_ALL_STA_INFO = 0x6e,
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index f9b9ca2..62c1ad4 100644
+index e2790109..80b9f6f9 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -12,6 +12,42 @@ static bool testmode_enable;
@@ -192,7 +192,7 @@
mt7996_eeprom_load_default(struct mt7996_dev *dev)
{
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index de3ff4e..849b8bc 100644
+index de3ff4e2..849b8bca 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -14,6 +14,7 @@ enum mt7996_eeprom_field {
@@ -257,7 +257,7 @@
#define MT_EE_WIFI_CONF2_TX_PATH_BAND1 GENMASK(2, 0)
#define MT_EE_WIFI_CONF2_TX_PATH_BAND2 GENMASK(5, 3)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 2bca86a..1d4f421 100644
+index 61b46370..75f143e2 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -715,6 +715,11 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -273,10 +273,10 @@
break;
}
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 0c6a4b9..121c4a1 100644
+index 1e1e638a..c01a2145 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -390,6 +390,9 @@ struct mt7996_dev {
+@@ -389,6 +389,9 @@ struct mt7996_dev {
struct dentry *debugfs_dir;
struct rchan *relay_fwlog;
@@ -286,7 +286,7 @@
struct {
u16 table_mask;
u8 n_agrt;
-@@ -510,6 +513,7 @@ int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy);
+@@ -509,6 +512,7 @@ int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy);
int mt7996_eeprom_get_target_power(struct mt7996_dev *dev,
struct ieee80211_channel *chan);
s8 mt7996_eeprom_get_power_delta(struct mt7996_dev *dev, int band);
@@ -294,7 +294,7 @@
int mt7996_dma_init(struct mt7996_dev *dev);
void mt7996_dma_reset(struct mt7996_dev *dev, bool force);
void mt7996_dma_prefetch(struct mt7996_dev *dev);
-@@ -594,6 +598,9 @@ void mt7996_mcu_exit(struct mt7996_dev *dev);
+@@ -593,6 +597,9 @@ void mt7996_mcu_exit(struct mt7996_dev *dev);
int mt7996_mcu_get_all_sta_info(struct mt7996_phy *phy, u16 tag);
int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id);
int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data);
@@ -305,7 +305,7 @@
static inline u8 mt7996_max_interface_num(struct mt7996_dev *dev)
{
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index 98eebce..a756ee1 100644
+index 98eebcee..a756ee10 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -7,6 +7,8 @@
@@ -772,7 +772,7 @@
+ .dump_precal = mt7996_tm_dump_precal,
};
diff --git a/mt7996/testmode.h b/mt7996/testmode.h
-index 319ef25..9bfb86f 100644
+index 319ef257..9bfb86f2 100644
--- a/mt7996/testmode.h
+++ b/mt7996/testmode.h
@@ -34,6 +34,12 @@ enum bw_mapping_method {
@@ -834,7 +834,7 @@
RF_OPER_NORMAL,
RF_OPER_RF_TEST,
diff --git a/testmode.c b/testmode.c
-index 44f3a5b..cd8cb65 100644
+index 44f3a5bf..cd8cb655 100644
--- a/testmode.c
+++ b/testmode.c
@@ -674,6 +674,18 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
@@ -857,7 +857,7 @@
err = -EINVAL;
diff --git a/testmode.h b/testmode.h
-index 96872e8..d6601cd 100644
+index 96872e8c..d6601cdc 100644
--- a/testmode.h
+++ b/testmode.h
@@ -220,6 +220,14 @@ enum mt76_testmode_state {
@@ -876,7 +876,7 @@
/* keep last */
diff --git a/tools/fields.c b/tools/fields.c
-index 055f90f..b012276 100644
+index 055f90f3..b0122763 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -11,6 +11,14 @@ static const char * const testmode_state[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0023-mtk-wifi-mt76-mt7996-add-normal-mode-pre-calibration.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0029-mtk-mt76-mt7996-add-normal-mode-pre-calibration-supp.patch
similarity index 92%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0023-mtk-wifi-mt76-mt7996-add-normal-mode-pre-calibration.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0029-mtk-mt76-mt7996-add-normal-mode-pre-calibration-supp.patch
index 7c11685..f3b6ac5 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0023-mtk-wifi-mt76-mt7996-add-normal-mode-pre-calibration.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0029-mtk-mt76-mt7996-add-normal-mode-pre-calibration-supp.patch
@@ -1,8 +1,8 @@
-From 51626ab22252946790a178fd0751bd7616fc2d99 Mon Sep 17 00:00:00 2001
+From 9785970113aee510f38ef39577cb9e0154694e36 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 1 Mar 2023 12:12:51 +0800
-Subject: [PATCH 023/116] mtk: wifi: mt76: mt7996: add normal mode
- pre-calibration support
+Subject: [PATCH 029/199] mtk: mt76: mt7996: add normal mode pre-calibration
+ support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -16,10 +16,10 @@
7 files changed, 188 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 1919325..8202ebb 100644
+index f994a2b3..0d30aff3 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1279,6 +1279,7 @@ enum {
+@@ -1289,6 +1289,7 @@ enum {
MCU_UNI_CMD_PP = 0x38,
MCU_UNI_CMD_FIXED_RATE_TABLE = 0x40,
MCU_UNI_CMD_TESTMODE_CTRL = 0x46,
@@ -28,7 +28,7 @@
MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
MCU_UNI_CMD_PER_STA_INFO = 0x6d,
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 62c1ad4..4afa2a2 100644
+index 80b9f6f9..454df971 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -356,6 +356,10 @@ int mt7996_eeprom_init(struct mt7996_dev *dev)
@@ -43,7 +43,7 @@
if (ret < 0)
return ret;
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 849b8bc..58179c0 100644
+index 849b8bca..58179c0c 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -25,6 +25,8 @@ enum mt7996_eeprom_field {
@@ -56,10 +56,10 @@
#define MT_EE_WIFI_CONF0_TX_PATH GENMASK(2, 0)
diff --git a/mt7996/init.c b/mt7996/init.c
-index 440e26d..201daf1 100644
+index ed7c7040..2749a5d7 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -985,6 +985,12 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
+@@ -987,6 +987,12 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
if (ret < 0)
return ret;
@@ -73,7 +73,7 @@
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
if (idx)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 50c7f07..89d5a17 100644
+index be50f7f3..253bb2e3 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -317,6 +317,12 @@ int mt7996_set_channel(struct mt7996_phy *phy)
@@ -90,10 +90,10 @@
mt7996_tm_update_channel(phy);
goto out;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 1d4f421..f02d33c 100644
+index 75f143e2..7c5e94f8 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3631,6 +3631,172 @@ int mt7996_mcu_get_eeprom_free_block(struct mt7996_dev *dev, u8 *block_num)
+@@ -3634,6 +3634,172 @@ int mt7996_mcu_get_eeprom_free_block(struct mt7996_dev *dev, u8 *block_num)
return 0;
}
@@ -267,10 +267,10 @@
{
#define NIC_CAP 3
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 121c4a1..5e2d8be 100644
+index c01a2145..1744998d 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -598,6 +598,9 @@ void mt7996_mcu_exit(struct mt7996_dev *dev);
+@@ -597,6 +597,9 @@ void mt7996_mcu_exit(struct mt7996_dev *dev);
int mt7996_mcu_get_all_sta_info(struct mt7996_phy *phy, u16 tag);
int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id);
int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0024-mtk-wifi-mt76-mt7996-enable-SCS-feature-for-mt7996-d.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0030-mtk-mt76-mt7996-enable-SCS-feature-for-mt7996-driver.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0024-mtk-wifi-mt76-mt7996-enable-SCS-feature-for-mt7996-d.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0030-mtk-mt76-mt7996-enable-SCS-feature-for-mt7996-driver.patch
index d318959..145e845 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0024-mtk-wifi-mt76-mt7996-enable-SCS-feature-for-mt7996-d.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0030-mtk-mt76-mt7996-enable-SCS-feature-for-mt7996-driver.patch
@@ -1,8 +1,8 @@
-From db1c305572e6eba5df01d52472e027cb9ef745c6 Mon Sep 17 00:00:00 2001
+From b884ffbff5630ccb06b2b9212b47b8c5cf56bb47 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 8 May 2023 09:03:50 +0800
-Subject: [PATCH 024/116] mtk: wifi: mt76: mt7996: enable SCS feature for
- mt7996 driver
+Subject: [PATCH 030/199] mtk: mt76: mt7996: enable SCS feature for mt7996
+ driver
Enable Smart Carrier Sense algorithn by default to improve performance
in a noisy environment.
@@ -20,10 +20,10 @@
8 files changed, 148 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 8202ebb..49c5ba3 100644
+index 0d30aff3..ea60e19c 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1264,6 +1264,7 @@ enum {
+@@ -1274,6 +1274,7 @@ enum {
MCU_UNI_CMD_GET_STAT_INFO = 0x23,
MCU_UNI_CMD_SNIFFER = 0x24,
MCU_UNI_CMD_SR = 0x25,
@@ -32,10 +32,10 @@
MCU_UNI_CMD_SET_DBDC_PARMS = 0x28,
MCU_UNI_CMD_TXPOWER = 0x2b,
diff --git a/mt7996/init.c b/mt7996/init.c
-index 201daf1..6a394c3 100644
+index 2749a5d7..7e813960 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -1415,6 +1415,7 @@ int mt7996_register_device(struct mt7996_dev *dev)
+@@ -1416,6 +1416,7 @@ int mt7996_register_device(struct mt7996_dev *dev)
dev->mt76.phy.priv = &dev->phy;
INIT_WORK(&dev->rc_work, mt7996_mac_sta_rc_work);
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7996_mac_work);
@@ -44,10 +44,10 @@
INIT_LIST_HEAD(&dev->twt_list);
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 603f6c0..c9f45ab 100644
+index a0fcd8aa..fd8bce0e 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1795,6 +1795,7 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
+@@ -1804,6 +1804,7 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
cancel_delayed_work_sync(&phy2->mt76->mac_work);
if (phy3)
cancel_delayed_work_sync(&phy3->mt76->mac_work);
@@ -55,7 +55,7 @@
mutex_lock(&dev->mt76.mutex);
for (i = 0; i < 10; i++) {
-@@ -1830,6 +1831,7 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
+@@ -1839,6 +1840,7 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
ieee80211_queue_delayed_work(phy3->mt76->hw,
&phy3->mt76->mac_work,
MT7996_WATCHDOG_TIME);
@@ -64,7 +64,7 @@
void mt7996_mac_reset_work(struct work_struct *work)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 89d5a17..eb213f8 100644
+index 253bb2e3..22acd04e 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -81,11 +81,17 @@ int mt7996_run(struct ieee80211_hw *hw)
@@ -94,10 +94,10 @@
mutex_lock(&dev->mt76.mutex);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index f02d33c..16a01b1 100644
+index 7c5e94f8..8f725307 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -4813,3 +4813,108 @@ int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 da
+@@ -4816,3 +4816,108 @@ int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 da
return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(TXPOWER),
&req, sizeof(req), false);
}
@@ -207,7 +207,7 @@
+ &req, sizeof(req), false);
+}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index d5ac2b3..5953b25 100644
+index abf8ef48..f889cb8b 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -966,6 +966,12 @@ enum pp_mode {
@@ -224,10 +224,10 @@
#define MT7996_PATCH_SCRAMBLE_KEY GENMASK(15, 8)
#define MT7996_PATCH_AES_KEY GENMASK(7, 0)
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 5e2d8be..186af3c 100644
+index 1744998d..d5050d6d 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -234,6 +234,16 @@ struct mt7996_hif {
+@@ -233,6 +233,16 @@ struct mt7996_hif {
int irq;
};
@@ -244,7 +244,7 @@
struct mt7996_wed_rro_addr {
u32 head_low;
u32 head_high : 4;
-@@ -284,6 +294,8 @@ struct mt7996_phy {
+@@ -283,6 +293,8 @@ struct mt7996_phy {
u8 pp_mode;
u16 punct_bitmap;
@@ -253,7 +253,7 @@
#ifdef CONFIG_NL80211_TESTMODE
struct {
u32 *reg_backup;
-@@ -330,6 +342,7 @@ struct mt7996_dev {
+@@ -329,6 +341,7 @@ struct mt7996_dev {
struct work_struct rc_work;
struct work_struct dump_work;
struct work_struct reset_work;
@@ -261,7 +261,7 @@
wait_queue_head_t reset_wait;
struct {
u32 state;
-@@ -604,6 +617,8 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy);
+@@ -603,6 +616,8 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy);
#ifdef CONFIG_NL80211_TESTMODE
void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb);
#endif
@@ -271,10 +271,10 @@
static inline u8 mt7996_max_interface_num(struct mt7996_dev *dev)
{
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index d79e00c..24b331e 100644
+index 64952a73..8c576bac 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2430,6 +2430,16 @@ static int mt7996_token_read(struct seq_file *s, void *data)
+@@ -2429,6 +2429,16 @@ static int mt7996_token_read(struct seq_file *s, void *data)
return 0;
}
@@ -291,7 +291,7 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -2500,6 +2510,7 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -2499,6 +2509,7 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
debugfs_create_devm_seqfile(dev->mt76.dev, "token", dir, mt7996_token_read);
debugfs_create_u8("sku_disable", 0600, dir, &dev->dbg.sku_disable);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0025-mtk-wifi-mt76-mt7996-add-txpower-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0031-mtk-mt76-mt7996-add-txpower-support.patch
similarity index 95%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0025-mtk-wifi-mt76-mt7996-add-txpower-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0031-mtk-mt76-mt7996-add-txpower-support.patch
index eb2c6e8..9fbc955 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0025-mtk-wifi-mt76-mt7996-add-txpower-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0031-mtk-mt76-mt7996-add-txpower-support.patch
@@ -1,7 +1,7 @@
-From 186a919f2ff018e53c1e1bc9e015b409525e7273 Mon Sep 17 00:00:00 2001
+From bfa596387e89377dec2121b5548b44b419463fb0 Mon Sep 17 00:00:00 2001
From: Allen Ye <allen.ye@mediatek.com>
Date: Fri, 24 Mar 2023 23:35:30 +0800
-Subject: [PATCH 025/116] mtk: wifi: mt76: mt7996: add txpower support
+Subject: [PATCH 031/199] mtk: mt76: mt7996: add txpower support
Add single sku and default enable sku.
@@ -25,17 +25,17 @@
mt7996/eeprom.h | 42 +++++
mt7996/init.c | 16 +-
mt7996/main.c | 15 ++
- mt7996/mcu.c | 69 ++++++++-
+ mt7996/mcu.c | 69 +++++++-
mt7996/mcu.h | 2 +
mt7996/mt7996.h | 4 +
- mt7996/mtk_debugfs.c | 362 +++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_debugfs.c | 363 +++++++++++++++++++++++++++++++++++++++++++
mt7996/mtk_mcu.c | 23 +++
mt7996/mtk_mcu.h | 92 +++++++++++
mt7996/regs.h | 27 ++--
- 14 files changed, 724 insertions(+), 27 deletions(-)
+ 14 files changed, 725 insertions(+), 27 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index a0047d7..11efe29 100644
+index a0047d79..11efe293 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -305,9 +305,10 @@ mt76_apply_array_limit(s8 *pwr, size_t pwr_len, const __be32 *data,
@@ -140,10 +140,10 @@
return max_power;
}
diff --git a/mt76.h b/mt76.h
-index c591f67..c372e78 100644
+index 362243f6..2236bc6b 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -1059,6 +1059,14 @@ struct mt76_power_limits {
+@@ -1064,6 +1064,14 @@ struct mt76_power_limits {
s8 eht[16][16];
};
@@ -158,19 +158,19 @@
struct mt76_ethtool_worker_info {
u64 *data;
int idx;
-@@ -1669,6 +1677,7 @@ mt76_find_channel_node(struct device_node *np, struct ieee80211_channel *chan);
+@@ -1678,6 +1686,7 @@ mt76_find_channel_node(struct device_node *np, struct ieee80211_channel *chan);
s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
struct ieee80211_channel *chan,
struct mt76_power_limits *dest,
+ struct mt76_power_path_limits *dest_path,
s8 target_power);
- static inline bool mt76_queue_is_wed_tx_free(struct mt76_queue *q)
+ static inline bool mt76_queue_is_rx(struct mt76_dev *dev, struct mt76_queue *q)
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 1e34e0a..0c7b693 100644
+index a1deeacd..33cbf4c2 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
-@@ -2150,7 +2150,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
+@@ -2158,7 +2158,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
sar_power = mt76_get_sar_power(phy, &chan, reg_power);
mt76_get_rate_power_limits(phy, &chan, limits,
@@ -180,7 +180,7 @@
tx_power_tlv.last_msg = ch_list[idx] == last_ch;
sku_tlbv.channel = ch_list[idx];
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 4afa2a2..6ac992a 100644
+index 454df971..17485bfc 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -408,3 +408,37 @@ s8 mt7996_eeprom_get_power_delta(struct mt7996_dev *dev, int band)
@@ -222,7 +222,7 @@
+ [SKU_EHT3x996_484] = 16,
+};
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 58179c0..b19ff06 100644
+index 58179c0c..b19ff068 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -125,4 +125,46 @@ mt7996_get_channel_group_6g(int channel)
@@ -273,10 +273,10 @@
+
#endif
diff --git a/mt7996/init.c b/mt7996/init.c
-index 6a394c3..f1d6817 100644
+index 7e813960..3b816070 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -295,7 +295,12 @@ static void __mt7996_init_txpower(struct mt7996_phy *phy,
+@@ -297,7 +297,12 @@ static void __mt7996_init_txpower(struct mt7996_phy *phy,
int nss_delta = mt76_tx_power_nss_delta(nss);
int pwr_delta = mt7996_eeprom_get_power_delta(dev, sband->band);
struct mt76_power_limits limits;
@@ -289,7 +289,7 @@
for (i = 0; i < sband->n_channels; i++) {
struct ieee80211_channel *chan = &sband->channels[i];
int target_power = mt7996_eeprom_get_target_power(dev, chan);
-@@ -303,11 +308,18 @@ static void __mt7996_init_txpower(struct mt7996_phy *phy,
+@@ -305,11 +310,18 @@ static void __mt7996_init_txpower(struct mt7996_phy *phy,
target_power += pwr_delta;
target_power = mt76_get_rate_power_limits(phy->mt76, chan,
&limits,
@@ -311,7 +311,7 @@
}
}
diff --git a/mt7996/main.c b/mt7996/main.c
-index eb213f8..46e3e5a 100644
+index 22acd04e..5a6ba6a6 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -85,6 +85,21 @@ int mt7996_run(struct ieee80211_hw *hw)
@@ -337,10 +337,10 @@
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 16a01b1..ffd3536 100644
+index 8f725307..3b4c45bb 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -4665,9 +4665,31 @@ int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id)
+@@ -4668,9 +4668,31 @@ int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id)
sizeof(req), true);
}
@@ -372,7 +372,7 @@
struct mt7996_dev *dev = phy->dev;
struct mt76_phy *mphy = phy->mt76;
struct ieee80211_hw *hw = mphy->hw;
-@@ -4687,13 +4709,22 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
+@@ -4690,13 +4712,22 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
.band_idx = phy->mt76->band_idx,
};
struct mt76_power_limits la = {};
@@ -400,7 +400,7 @@
skb = mt76_mcu_msg_alloc(&dev->mt76, NULL,
sizeof(req) + MT7996_SKU_PATH_NUM);
-@@ -4723,6 +4754,34 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
+@@ -4726,6 +4757,34 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
/* padding */
skb_put_zero(skb, MT7996_SKU_PATH_NUM - MT7996_SKU_RATE_NUM);
@@ -436,7 +436,7 @@
MCU_WM_UNI_CMD(TXPOWER), true);
}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 5953b25..5a60ccc 100644
+index f889cb8b..1ed05d7e 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -911,6 +911,7 @@ struct tx_power_ctrl {
@@ -456,10 +456,10 @@
enum {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 186af3c..6ab45cc 100644
+index d5050d6d..ff7edcd8 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -296,6 +296,9 @@ struct mt7996_phy {
+@@ -295,6 +295,9 @@ struct mt7996_phy {
struct mt7996_scs_ctrl scs_ctrl;
@@ -469,7 +469,7 @@
#ifdef CONFIG_NL80211_TESTMODE
struct {
u32 *reg_backup;
-@@ -617,6 +620,7 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy);
+@@ -616,6 +619,7 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy);
#ifdef CONFIG_NL80211_TESTMODE
void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb);
#endif
@@ -478,10 +478,10 @@
void mt7996_mcu_scs_sta_poll(struct work_struct *work);
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 24b331e..74aabf0 100644
+index 8c576bac..3558641c 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2440,6 +2440,364 @@ mt7996_scs_enable_set(void *data, u64 val)
+@@ -2439,6 +2439,364 @@ mt7996_scs_enable_set(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(fops_scs_enable, NULL,
mt7996_scs_enable_set, "%lld\n");
@@ -846,19 +846,20 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -2503,6 +2861,10 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
-
+@@ -2503,6 +2861,11 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
debugfs_create_devm_seqfile(dev->mt76.dev, "tr_info", dir,
mt7996_trinfo_read);
+
+ debugfs_create_file("txpower_level", 0600, dir, phy, &fops_txpower_level);
+ debugfs_create_file("txpower_info", 0600, dir, phy, &mt7996_txpower_info_fops);
+ debugfs_create_file("txpower_sku", 0600, dir, phy, &mt7996_txpower_sku_fops);
+ debugfs_create_file("txpower_path", 0600, dir, phy, &mt7996_txpower_path_fops);
-
++
debugfs_create_devm_seqfile(dev->mt76.dev, "wtbl_info", dir,
mt7996_wtbl_read);
+
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index c16b25a..e56ddd8 100644
+index c16b25ab..e56ddd8f 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
@@ -12,8 +12,31 @@
@@ -894,7 +895,7 @@
int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val)
{
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index 7f4d4e0..c30418c 100644
+index 7f4d4e02..c30418ca 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -14,6 +14,98 @@ enum {
@@ -997,7 +998,7 @@
#endif
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index 4c20a67..8ec1dc1 100644
+index 4c20a67d..8ec1dc1c 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -693,24 +693,29 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0026-mtk-wifi-mt76-mt7996-add-binfile-mode-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0032-mtk-mt76-mt7996-add-binfile-mode-support.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0026-mtk-wifi-mt76-mt7996-add-binfile-mode-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0032-mtk-mt76-mt7996-add-binfile-mode-support.patch
index 00b9fc6..b3430bf 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0026-mtk-wifi-mt76-mt7996-add-binfile-mode-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0032-mtk-mt76-mt7996-add-binfile-mode-support.patch
@@ -1,9 +1,7 @@
-From 5e960ddb3cd014c0fe80526215319ffd3c497054 Mon Sep 17 00:00:00 2001
+From e6e4969b4c1ae6f9a1fc9ac9744ca6eb76400a51 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 31 Mar 2023 11:36:34 +0800
-Subject: [PATCH 026/116] mtk: wifi: mt76: mt7996: add binfile mode support
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Subject: [PATCH 032/199] mtk: mt76: mt7996: add binfile mode support
Fix binfile cannot sync precal data to atenl
Binfile is viewed as efuse mode in atenl, so atenl does not allocate
@@ -19,13 +17,13 @@
mt76.h | 3 ++
mt7996/eeprom.c | 103 ++++++++++++++++++++++++++++++++++++++++---
mt7996/eeprom.h | 7 +++
- mt7996/mt7996.h | 4 ++
+ mt7996/mt7996.h | 3 ++
mt7996/mtk_debugfs.c | 41 +++++++++++++++++
testmode.h | 2 +-
- 7 files changed, 179 insertions(+), 6 deletions(-)
+ 7 files changed, 178 insertions(+), 6 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index 11efe29..3da9492 100644
+index 11efe293..3da94926 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -161,6 +161,31 @@ static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len)
@@ -61,10 +59,10 @@
mt76_eeprom_override(struct mt76_phy *phy)
{
diff --git a/mt76.h b/mt76.h
-index c372e78..dbd8ab9 100644
+index 2236bc6b..d4a0f006 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -954,6 +954,8 @@ struct mt76_dev {
+@@ -958,6 +958,8 @@ struct mt76_dev {
struct mt76_usb usb;
struct mt76_sdio sdio;
};
@@ -72,8 +70,8 @@
+ const char *bin_file_name;
};
- /* per-phy stats. */
-@@ -1225,6 +1227,7 @@ void mt76_eeprom_override(struct mt76_phy *phy);
+ #define MT76_MAX_AMSDU_NUM 8
+@@ -1231,6 +1233,7 @@ void mt76_eeprom_override(struct mt76_phy *phy);
int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len);
int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
const char *cell_name, int len);
@@ -82,7 +80,7 @@
struct mt76_queue *
mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 6ac992a..fe8b253 100644
+index 17485bfc..5dc55646 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -82,10 +82,17 @@ static int mt7996_check_eeprom(struct mt7996_dev *dev)
@@ -243,7 +241,7 @@
if (ret)
return ret;
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index b19ff06..8f0f87b 100644
+index b19ff068..8f0f87b6 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -102,6 +102,13 @@ enum mt7996_eeprom_band {
@@ -261,18 +259,10 @@
mt7996_get_channel_group_5g(int channel)
{
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 6ab45cc..9d6e85c 100644
+index ff7edcd8..3abb932d 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -62,6 +62,7 @@
- #define MT7992_EEPROM_DEFAULT_24 "mediatek/mt7996/mt7992_eeprom_24_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_23 "mediatek/mt7996/mt7992_eeprom_23_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_23_EXT "mediatek/mt7996/mt7992_eeprom_23_2e5e.bin"
-+#define MT7992_EEPROM_DEFAULT_TM "mediatek/mt7996/mt7992_eeprom_tm.bin"
- #define MT7996_EEPROM_SIZE 7680
- #define MT7996_EEPROM_BLOCK_SIZE 16
- #define MT7996_TOKEN_SIZE 16384
-@@ -395,6 +396,8 @@ struct mt7996_dev {
+@@ -394,6 +394,8 @@ struct mt7996_dev {
} wed_rro;
bool testmode_enable;
@@ -281,7 +271,7 @@
bool ibf;
u8 fw_debug_wm;
-@@ -523,6 +526,7 @@ irqreturn_t mt7996_irq_handler(int irq, void *dev_instance);
+@@ -522,6 +524,7 @@ irqreturn_t mt7996_irq_handler(int irq, void *dev_instance);
u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif);
int mt7996_register_device(struct mt7996_dev *dev);
void mt7996_unregister_device(struct mt7996_dev *dev);
@@ -290,10 +280,10 @@
int mt7996_eeprom_check_fw_mode(struct mt7996_dev *dev);
int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy);
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 74aabf0..2499f12 100644
+index 3558641c..c096fb6c 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2798,6 +2798,44 @@ static const struct file_operations mt7996_txpower_path_fops = {
+@@ -2797,6 +2797,44 @@ static const struct file_operations mt7996_txpower_path_fops = {
.llseek = default_llseek,
};
@@ -349,7 +339,7 @@
mt7996_wtbl_read);
diff --git a/testmode.h b/testmode.h
-index d6601cd..5d677f8 100644
+index d6601cdc..5d677f8c 100644
--- a/testmode.h
+++ b/testmode.h
@@ -16,7 +16,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0027-mtk-wifi-mt76-testmode-add-testmode-ZWDFS-verificati.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0033-mtk-mt76-mt7996-add-testmode-ZWDFS-verification-supp.patch
similarity index 97%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0027-mtk-wifi-mt76-testmode-add-testmode-ZWDFS-verificati.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0033-mtk-mt76-mt7996-add-testmode-ZWDFS-verification-supp.patch
index 5ccf77e..7496e93 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0027-mtk-wifi-mt76-testmode-add-testmode-ZWDFS-verificati.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0033-mtk-mt76-mt7996-add-testmode-ZWDFS-verification-supp.patch
@@ -1,8 +1,8 @@
-From 2ef29df1bbd84d7b35b6830025323cead3681e85 Mon Sep 17 00:00:00 2001
+From e758524d7b6b53da37a6ab7d392896bf34901b46 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 22 Mar 2023 11:19:52 +0800
-Subject: [PATCH 027/116] mtk: wifi: mt76: testmode: add testmode ZWDFS
- verification support
+Subject: [PATCH 033/199] mtk: mt76: mt7996: add testmode ZWDFS verification
+ support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -15,10 +15,10 @@
6 files changed, 326 insertions(+), 12 deletions(-)
diff --git a/mt76.h b/mt76.h
-index dbd8ab9..43e4585 100644
+index d4a0f006..0cf5d573 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -783,6 +783,14 @@ struct mt76_testmode_data {
+@@ -787,6 +787,14 @@ struct mt76_testmode_data {
} cfg;
u8 aid;
@@ -34,10 +34,10 @@
struct mt76_vif {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 9d6e85c..7d6ec8b 100644
+index 3abb932d..70aafb29 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -289,6 +289,7 @@ struct mt7996_phy {
+@@ -287,6 +287,7 @@ struct mt7996_phy {
struct mt76_mib_stats mib;
struct mt76_channel_state state_ts;
@@ -46,7 +46,7 @@
bool has_aux_rx;
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index a756ee1..836211f 100644
+index a756ee10..836211f9 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -17,6 +17,12 @@ enum {
@@ -336,7 +336,7 @@
static int
diff --git a/mt7996/testmode.h b/mt7996/testmode.h
-index 9bfb86f..78662b2 100644
+index 9bfb86f2..78662b2e 100644
--- a/mt7996/testmode.h
+++ b/mt7996/testmode.h
@@ -27,9 +27,15 @@ enum {
@@ -399,7 +399,7 @@
+
#endif
diff --git a/testmode.c b/testmode.c
-index cd8cb65..69147f8 100644
+index cd8cb655..69147f86 100644
--- a/testmode.c
+++ b/testmode.c
@@ -27,6 +27,13 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
@@ -453,7 +453,7 @@
nla_put_u8(msg, MT76_TM_ATTR_TX_LTF, td->tx_ltf)) ||
(mt76_testmode_param_present(td, MT76_TM_ATTR_TX_ANTENNA) &&
diff --git a/tools/fields.c b/tools/fields.c
-index b012276..77696ce 100644
+index b0122763..77696ce7 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -35,6 +35,15 @@ static const char * const testmode_tx_mode[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0028-mtk-wifi-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0034-mtk-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0028-mtk-wifi-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0034-mtk-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch
index 3cbb987..f4a098a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0028-mtk-wifi-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0034-mtk-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch
@@ -1,7 +1,7 @@
-From 1be3480176150329dd571219f69ccd8efa312daa Mon Sep 17 00:00:00 2001
+From e6fcd98cab30ba065534890cdb5f0775db054fcd Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 5 Jul 2023 10:00:17 +0800
-Subject: [PATCH 028/116] mtk: wifi: mt76: mt7996: support eagle ZWDFS on iFEM
+Subject: [PATCH 034/199] mtk: mt76: mt7996: support eagle ZWDFS on iFEM
Fix the case that control channel is not first chan during first
interface setup.
@@ -15,10 +15,10 @@
3 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 46e3e5a..61396a8 100644
+index 5a6ba6a6..5b1984ac 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -1444,6 +1444,61 @@ mt7996_twt_teardown_request(struct ieee80211_hw *hw,
+@@ -1448,6 +1448,61 @@ mt7996_twt_teardown_request(struct ieee80211_hw *hw,
mutex_unlock(&dev->mt76.mutex);
}
@@ -80,7 +80,7 @@
static int
mt7996_set_radar_background(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef)
-@@ -1452,6 +1507,7 @@ mt7996_set_radar_background(struct ieee80211_hw *hw,
+@@ -1456,6 +1511,7 @@ mt7996_set_radar_background(struct ieee80211_hw *hw,
struct mt7996_dev *dev = phy->dev;
int ret = -EINVAL;
bool running;
@@ -88,7 +88,7 @@
mutex_lock(&dev->mt76.mutex);
-@@ -1464,13 +1520,14 @@ mt7996_set_radar_background(struct ieee80211_hw *hw,
+@@ -1468,13 +1524,14 @@ mt7996_set_radar_background(struct ieee80211_hw *hw,
goto out;
}
@@ -105,7 +105,7 @@
ret = mt7996_mcu_rdd_background_enable(phy, NULL);
if (ret)
goto out;
-@@ -1479,7 +1536,9 @@ mt7996_set_radar_background(struct ieee80211_hw *hw,
+@@ -1483,7 +1540,9 @@ mt7996_set_radar_background(struct ieee80211_hw *hw,
goto update_phy;
}
@@ -117,7 +117,7 @@
goto out;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index ffd3536..a3b66f1 100644
+index 3b4c45bb..8ac7adf6 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -372,12 +372,14 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -138,10 +138,10 @@
}
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 7d6ec8b..fd93db2 100644
+index 70aafb29..439c57f4 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -399,6 +399,7 @@ struct mt7996_dev {
+@@ -397,6 +397,7 @@ struct mt7996_dev {
bool testmode_enable;
bool bin_file_mode;
u8 eeprom_mode;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0029-mtk-wifi-mt76-mt7996-refactor-eeprom-loading-flow-fo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0035-mtk-mt76-mt7996-refactor-eeprom-loading-flow-for-sku.patch
similarity index 90%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0029-mtk-wifi-mt76-mt7996-refactor-eeprom-loading-flow-fo.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0035-mtk-mt76-mt7996-refactor-eeprom-loading-flow-for-sku.patch
index 786d7e6..8444a8e 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0029-mtk-wifi-mt76-mt7996-refactor-eeprom-loading-flow-fo.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0035-mtk-mt76-mt7996-refactor-eeprom-loading-flow-for-sku.patch
@@ -1,8 +1,8 @@
-From 1ed0aea054ae9fcd011f81333888d15cba7fc19f Mon Sep 17 00:00:00 2001
+From 13b9c0e271c358a45444d35e97ad4080c3933e78 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 11 Mar 2024 10:43:03 +0800
-Subject: [PATCH 029/116] mtk: wifi: mt76: mt7996: refactor eeprom loading flow
- for sku checking
+Subject: [PATCH 035/199] mtk: mt76: mt7996: refactor eeprom loading flow for
+ sku checking
Add eeprom sku checking mechanism to avoid using the
wrong eeprom in flash/binfile mode
@@ -12,8 +12,6 @@
3. RF path & streams
(to distinguish cases such as BE7200 4i5i, BE6500 3i5i, and BE5040 2i3i)
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
1. Reset eeprom content before loading efuse
eeprom array might contain incomplete data read from flash or
binfile, which is not overwritten since this block is invalid
@@ -24,8 +22,6 @@
eeprom for each sku (especially kite's sku) in our SDK.
3. Set testmode_en field for default bin mode for consistency sake
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
1.
Fix efuse mode txpower = 0 issue
This fix might be changed if fw supports efuse merge for buffer mode = EE_MODE_EFUSE
@@ -37,12 +33,12 @@
mt7996/eeprom.c | 207 ++++++++++++++++++++++++-------------------
mt7996/eeprom.h | 32 +++++++
mt7996/mcu.c | 18 +---
- mt7996/mt7996.h | 3 +-
+ mt7996/mt7996.h | 1 +
mt7996/mtk_debugfs.c | 2 +-
- 5 files changed, 150 insertions(+), 112 deletions(-)
+ 5 files changed, 150 insertions(+), 110 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index fe8b253..f97d76c 100644
+index 5dc55646..f4641321 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -50,54 +50,84 @@ const u32 dpd_6g_bw320_ch_num = ARRAY_SIZE(dpd_6g_ch_list_bw320);
@@ -364,7 +360,7 @@
ret = mt7996_eeprom_load_precal(dev);
if (ret)
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 8f0f87b..03a4fd0 100644
+index 8f0f87b6..03a4fd07 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -132,6 +132,38 @@ mt7996_get_channel_group_6g(int channel)
@@ -407,10 +403,10 @@
SKU_CCK,
SKU_OFDM,
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index a3b66f1..446fe1f 100644
+index 8ac7adf6..7542953f 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3507,7 +3507,7 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
+@@ -3510,7 +3510,7 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
&req, sizeof(req), true);
}
@@ -419,7 +415,7 @@
{
#define MAX_PAGE_IDX_MASK GENMASK(7, 5)
#define PAGE_IDX_MASK GENMASK(4, 2)
-@@ -3552,22 +3552,6 @@ static int mt7996_mcu_set_eeprom_flash(struct mt7996_dev *dev)
+@@ -3555,22 +3555,6 @@ static int mt7996_mcu_set_eeprom_flash(struct mt7996_dev *dev)
return 0;
}
@@ -443,31 +439,22 @@
{
struct mt7996_mcu_eeprom_info req = {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index fd93db2..b2a9381 100644
+index 439c57f4..2994c1a5 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -54,15 +54,14 @@
+@@ -54,6 +54,7 @@
#define MT7992_ROM_PATCH_23 "mediatek/mt7996/mt7992_rom_patch_23.bin"
#define MT7996_EEPROM_DEFAULT "mediatek/mt7996/mt7996_eeprom.bin"
+#define MT7996_EEPROM_DEFAULT_INT "mediatek/mt7996/mt7996_eeprom_2i5i6i.bin"
#define MT7996_EEPROM_DEFAULT_404 "mediatek/mt7996/mt7996_eeprom_dual_404.bin"
--#define MT7996_EEPROM_DEFAULT_TM "mediatek/mt7996/mt7996_eeprom_tm.bin"
- #define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_EXT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
- #define MT7992_EEPROM_DEFAULT_MIX "mediatek/mt7996/mt7992_eeprom_2i5e.bin"
- #define MT7992_EEPROM_DEFAULT_24 "mediatek/mt7996/mt7992_eeprom_24_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_23 "mediatek/mt7996/mt7992_eeprom_23_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_23_EXT "mediatek/mt7996/mt7992_eeprom_23_2e5e.bin"
--#define MT7992_EEPROM_DEFAULT_TM "mediatek/mt7996/mt7992_eeprom_tm.bin"
- #define MT7996_EEPROM_SIZE 7680
- #define MT7996_EEPROM_BLOCK_SIZE 16
- #define MT7996_TOKEN_SIZE 16384
+ #define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
+ #define MT7992_EEPROM_DEFAULT_INT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 2499f12..2a9f213 100644
+index c096fb6c..053005dd 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2827,7 +2827,7 @@ static int mt7996_show_eeprom_mode(struct seq_file *s, void *data)
+@@ -2826,7 +2826,7 @@ static int mt7996_show_eeprom_mode(struct seq_file *s, void *data)
seq_printf(s, " flash mode\n");
break;
case BIN_FILE_MODE:
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0030-mtk-wifi-mt76-mt7996-add-vendor-commands-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0036-mtk-mt76-mt7996-add-vendor-commands-support.patch
similarity index 97%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0030-mtk-wifi-mt76-mt7996-add-vendor-commands-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0036-mtk-mt76-mt7996-add-vendor-commands-support.patch
index c5c7739..99e6cf8 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0030-mtk-wifi-mt76-mt7996-add-vendor-commands-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0036-mtk-mt76-mt7996-add-vendor-commands-support.patch
@@ -1,7 +1,7 @@
-From 952ed39c596363be421fab82fc8dc9043a6d6b01 Mon Sep 17 00:00:00 2001
+From 77147d23626a24c3f3dff7a5afb57fc155a8e092 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 13 Dec 2022 15:17:43 +0800
-Subject: [PATCH 030/116] mtk: wifi: mt76: mt7996: add vendor commands support
+Subject: [PATCH 036/199] mtk: mt76: mt7996: add vendor commands support
mtk: wifi: mt76: fix muru_onoff as all enabled by default
@@ -9,27 +9,19 @@
enabled. The purpose of this commit is to align muru_onoff value with
hostapd and mt76 driver
-Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
-
mtk: wifi: mt76: mt7996: add vendor cmd to get available color bitmap
Add a vendor cmd to notify user space available color bitmap.
The OBSS BSS color bitmap is maintained in mac80211, so mt76 will make use of that.
-Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
-
mtk: wifi: mt76: mt7996: add vendor subcmd EDCCA ctrl enable
mtk: wifi: mt76: mt7996: add ibf control vendor cmd
-Signed-off-by: Allen.Ye <allen.ye@mediatek.com>
-
mtk: wifi: mt76: mt7996: add three wire pta support
three wire enable bit 0 & 1 for EXT0 & EXT1, respectively
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: mt7996: Add static pp vendor support
Add static pp vendor support for setting pp mode.
@@ -38,6 +30,9 @@
message and convert it to mcu commands.
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Signed-off-by: Allen.Ye <allen.ye@mediatek.com>
+Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
---
mt76_connac_mcu.h | 2 +
@@ -57,10 +52,10 @@
create mode 100644 mt7996/vendor.h
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 49c5ba3..750bb93 100644
+index ea60e19c..5a1b4d0d 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1254,6 +1254,7 @@ enum {
+@@ -1264,6 +1264,7 @@ enum {
MCU_UNI_CMD_REG_ACCESS = 0x0d,
MCU_UNI_CMD_CHIP_CONFIG = 0x0e,
MCU_UNI_CMD_POWER_CTRL = 0x0f,
@@ -68,7 +63,7 @@
MCU_UNI_CMD_RX_HDR_TRANS = 0x12,
MCU_UNI_CMD_SER = 0x13,
MCU_UNI_CMD_TWT = 0x14,
-@@ -1286,6 +1287,7 @@ enum {
+@@ -1296,6 +1297,7 @@ enum {
MCU_UNI_CMD_PER_STA_INFO = 0x6d,
MCU_UNI_CMD_ALL_STA_INFO = 0x6e,
MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
@@ -77,7 +72,7 @@
enum {
diff --git a/mt7996/Makefile b/mt7996/Makefile
-index 7bb17f4..6643c7a 100644
+index 7bb17f44..6643c7a3 100644
--- a/mt7996/Makefile
+++ b/mt7996/Makefile
@@ -1,11 +1,12 @@
@@ -95,10 +90,10 @@
mt7996e-$(CONFIG_DEV_COREDUMP) += coredump.o
mt7996e-$(CONFIG_NL80211_TESTMODE) += testmode.o
diff --git a/mt7996/init.c b/mt7996/init.c
-index f1d6817..5cc2e6f 100644
+index 3b816070..0cf054df 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -378,6 +378,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -380,6 +380,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
phy->slottime = 9;
phy->beacon_rate = -1;
@@ -106,7 +101,7 @@
hw->sta_data_size = sizeof(struct mt7996_sta);
hw->vif_data_size = sizeof(struct mt7996_vif);
-@@ -629,6 +630,10 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -631,6 +632,10 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
if (ret)
goto error;
@@ -117,7 +112,7 @@
ret = mt76_register_phy(mphy, true, mt76_rates,
ARRAY_SIZE(mt76_rates));
if (ret)
-@@ -1446,6 +1451,10 @@ int mt7996_register_device(struct mt7996_dev *dev)
+@@ -1447,6 +1452,10 @@ int mt7996_register_device(struct mt7996_dev *dev)
dev->mt76.test_ops = &mt7996_testmode_ops;
#endif
@@ -129,7 +124,7 @@
ARRAY_SIZE(mt76_rates));
if (ret)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index c9f45ab..d55e5a7 100644
+index fd8bce0e..f0c0db75 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -679,6 +679,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
@@ -144,10 +139,10 @@
status->flag |= RX_FLAG_8023;
mt7996_wed_check_ppe(dev, &dev->mt76.q_rx[q], msta, skb,
diff --git a/mt7996/main.c b/mt7996/main.c
-index 61396a8..003bf3f 100644
+index 5b1984ac..a51fc696 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -760,6 +760,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -764,6 +764,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7996_mac_wtbl_update(dev, idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -159,7 +154,7 @@
if (ret)
return ret;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 446fe1f..ae0c11a 100644
+index 7542953f..a08b24f6 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1378,6 +1378,8 @@ static void
@@ -191,7 +186,7 @@
if (sta->deflink.vht_cap.vht_supported)
muru->mimo_dl.vht_mu_bfee =
-@@ -4963,3 +4968,25 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
+@@ -4966,3 +4971,25 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
return mt76_mcu_send_msg(&phy->dev->mt76, MCU_WM_UNI_CMD(SCS),
&req, sizeof(req), false);
}
@@ -218,7 +213,7 @@
+}
+#endif
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 5a60ccc..2e845e9 100644
+index 1ed05d7e..f827de9e 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -754,8 +754,20 @@ enum {
@@ -252,7 +247,7 @@
};
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index b2a9381..402327d 100644
+index 2994c1a5..f0604368 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -258,6 +258,34 @@ struct mt7996_wed_rro_session_id {
@@ -337,7 +332,7 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir);
int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val);
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index e56ddd8..5c54d02 100644
+index e56ddd8f..5c54d02c 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
@@ -59,4 +59,91 @@ int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val)
@@ -433,7 +428,7 @@
+
#endif
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index c30418c..36a58ad 100644
+index c30418ca..36a58ad6 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -106,6 +106,21 @@ enum txpower_event {
@@ -460,7 +455,7 @@
#endif
diff --git a/mt7996/vendor.c b/mt7996/vendor.c
new file mode 100644
-index 0000000..0d6fa77
+index 00000000..0d6fa779
--- /dev/null
+++ b/mt7996/vendor.c
@@ -0,0 +1,805 @@
@@ -1271,7 +1266,7 @@
+}
diff --git a/mt7996/vendor.h b/mt7996/vendor.h
new file mode 100644
-index 0000000..8aaa18e
+index 00000000..8aaa18ee
--- /dev/null
+++ b/mt7996/vendor.h
@@ -0,0 +1,153 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0031-mtk-wifi-mt76-mt7996-add-debugfs-for-fw-coredump.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0037-mtk-mt76-mt7996-add-debugfs-for-fw-coredump.patch
similarity index 92%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0031-mtk-wifi-mt76-mt7996-add-debugfs-for-fw-coredump.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0037-mtk-mt76-mt7996-add-debugfs-for-fw-coredump.patch
index 0adbbdc..29bd31f 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0031-mtk-wifi-mt76-mt7996-add-debugfs-for-fw-coredump.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0037-mtk-mt76-mt7996-add-debugfs-for-fw-coredump.patch
@@ -1,7 +1,7 @@
-From 2b301b7df0e6aeb725683bbee25027787488b147 Mon Sep 17 00:00:00 2001
+From 1fd0460d51166d09eb2a6b7551479724665b88b8 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Fri, 19 May 2023 14:56:07 +0800
-Subject: [PATCH 031/116] mtk: wifi: mt76: mt7996: add debugfs for fw coredump.
+Subject: [PATCH 037/199] mtk: mt76: mt7996: add debugfs for fw coredump.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -12,7 +12,7 @@
4 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 344c759..3074202 100644
+index 9671c15d..1f4bad62 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -84,6 +84,8 @@ mt7996_sys_recovery_set(struct file *file, const char __user *user_buf,
@@ -64,10 +64,10 @@
desc += scnprintf(buff + desc, bufsz - desc,
"\nlet's dump firmware SER statistics...\n");
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index d55e5a7..1c1b3eb 100644
+index f0c0db75..d9e8e751 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -2080,15 +2080,36 @@ void mt7996_mac_dump_work(struct work_struct *work)
+@@ -2089,15 +2089,36 @@ void mt7996_mac_dump_work(struct work_struct *work)
struct mt7996_dev *dev;
dev = container_of(work, struct mt7996_dev, dump_work);
@@ -107,7 +107,7 @@
void mt7996_reset(struct mt7996_dev *dev)
{
if (!dev->recovery.hw_init_done)
-@@ -2106,6 +2127,7 @@ void mt7996_reset(struct mt7996_dev *dev)
+@@ -2115,6 +2136,7 @@ void mt7996_reset(struct mt7996_dev *dev)
mt7996_irq_disable(dev, MT_INT_MCU_CMD);
queue_work(dev->mt76.wq, &dev->dump_work);
@@ -116,7 +116,7 @@
}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 2e845e9..cb7260f 100644
+index f827de9e..3e9364de 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -958,7 +958,11 @@ enum {
@@ -132,7 +132,7 @@
UNI_CMD_SER_ENABLE = 1,
UNI_CMD_SER_SET,
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 402327d..623b782 100644
+index f0604368..ce54080a 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -138,6 +138,14 @@ enum mt7996_ram_type {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0032-mtk-wifi-mt76-mt7996-Add-mt7992-coredump-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0038-mtk-mt76-mt7996-Add-mt7992-coredump-support.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0032-mtk-wifi-mt76-mt7996-Add-mt7992-coredump-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0038-mtk-mt76-mt7996-Add-mt7992-coredump-support.patch
index 20f82a0..4f8a8b5 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0032-mtk-wifi-mt76-mt7996-Add-mt7992-coredump-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0038-mtk-mt76-mt7996-Add-mt7992-coredump-support.patch
@@ -1,7 +1,7 @@
-From 2df50005330ec03e1316a25e0cb3b6ece5915d13 Mon Sep 17 00:00:00 2001
+From 52bdf0e4a54de52c7223a99e950cda7e9c823f69 Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Mon, 25 Dec 2023 15:17:49 +0800
-Subject: [PATCH 032/116] mtk: wifi: mt76: mt7996: Add mt7992 coredump support
+Subject: [PATCH 038/199] mtk: mt76: mt7996: Add mt7992 coredump support
1. Add mt7992 coredump support
2. fixed if new ic have not support coredump, it may cause crash when remove module
@@ -13,7 +13,7 @@
2 files changed, 67 insertions(+), 14 deletions(-)
diff --git a/mt7996/coredump.c b/mt7996/coredump.c
-index a7f91b5..d09bcd4 100644
+index a7f91b56..d09bcd4b 100644
--- a/mt7996/coredump.c
+++ b/mt7996/coredump.c
@@ -67,6 +67,44 @@ static const struct mt7996_mem_region mt7996_wa_mem_regions[] = {
@@ -146,7 +146,7 @@
}
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 623b782..97425a0 100644
+index ce54080a..01a5abdf 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -229,6 +229,7 @@ struct mt7996_vif {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0033-mtk-wifi-mt76-mt7996-add-support-for-runtime-set-in-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0039-mtk-mt76-mt7996-add-support-for-runtime-set-in-band-.patch
similarity index 81%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0033-mtk-wifi-mt76-mt7996-add-support-for-runtime-set-in-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0039-mtk-mt76-mt7996-add-support-for-runtime-set-in-band-.patch
index 94ad572..51039d9 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0033-mtk-wifi-mt76-mt7996-add-support-for-runtime-set-in-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0039-mtk-mt76-mt7996-add-support-for-runtime-set-in-band-.patch
@@ -1,7 +1,7 @@
-From 6fd185872dc77c7ca2f13237937269bb8f2af706 Mon Sep 17 00:00:00 2001
+From 532677abd25d3412eb0ac4da432ab2ef59a532f3 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 6 Jun 2023 16:57:10 +0800
-Subject: [PATCH 033/116] mtk: wifi: mt76: mt7996: add support for runtime set
+Subject: [PATCH 039/199] mtk: mt76: mt7996: add support for runtime set
in-band discovery
with this patch, AP can runtime set inband discovery via hostapd_cli
@@ -17,10 +17,10 @@
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index ae0c11a..51c771b 100644
+index a08b24f6..40860f9f 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -2609,8 +2609,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
+@@ -2612,8 +2612,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
if (IS_ERR(rskb))
return PTR_ERR(rskb);
@@ -30,7 +30,7 @@
interval = vif->bss_conf.fils_discovery.max_interval;
skb = ieee80211_get_fils_discovery_tmpl(hw, vif);
} else if (changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP &&
-@@ -2645,7 +2644,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
+@@ -2648,7 +2647,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
discov->tx_type = !!(changed & BSS_CHANGED_FILS_DISCOVERY);
discov->tx_interval = interval;
discov->prob_rsp_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0034-mtk-wifi-mt76-mt7996-add-support-spatial-reuse-debug.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0040-mtk-mt76-mt7996-add-support-spatial-reuse-debug-comm.patch
similarity index 95%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0034-mtk-wifi-mt76-mt7996-add-support-spatial-reuse-debug.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0040-mtk-mt76-mt7996-add-support-spatial-reuse-debug-comm.patch
index 9c80261..6bbd559 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0034-mtk-wifi-mt76-mt7996-add-support-spatial-reuse-debug.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0040-mtk-mt76-mt7996-add-support-spatial-reuse-debug-comm.patch
@@ -1,8 +1,8 @@
-From 5e5d779286a2c289480469f3b6d1b93479a4762c Mon Sep 17 00:00:00 2001
+From cb8632560f8055d6af142932abf723d54af5c25e Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 10 Jul 2023 11:47:29 +0800
-Subject: [PATCH 034/116] mtk: wifi: mt76: mt7996: add support spatial reuse
- debug commands
+Subject: [PATCH 040/199] mtk: mt76: mt7996: add support spatial reuse debug
+ commands
This commit adds the following debug commands in debugfs:
1. sr_enable: enable/disable spatial reuse feature. Default is on.
@@ -15,6 +15,7 @@
To learn more details of these commands, please check:
https://wiki.mediatek.inc/display/APKB/mt76+Phy+feature+debug+Cheetsheet#mt76PhyfeaturedebugCheetsheet-SpatialReuse
+
---
mt76_connac_mcu.h | 1 +
mt7996/main.c | 6 +++
@@ -26,10 +27,10 @@
7 files changed, 270 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 750bb93..7f2daf7 100644
+index 5a1b4d0d..726f5e9d 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1041,6 +1041,7 @@ enum {
+@@ -1051,6 +1051,7 @@ enum {
MCU_UNI_EVENT_BSS_BEACON_LOSS = 0x0c,
MCU_UNI_EVENT_SCAN_DONE = 0x0e,
MCU_UNI_EVENT_RDD_REPORT = 0x11,
@@ -38,7 +39,7 @@
MCU_UNI_EVENT_TX_DONE = 0x2d,
MCU_UNI_EVENT_BF = 0x33,
diff --git a/mt7996/main.c b/mt7996/main.c
-index 003bf3f..92b2834 100644
+index a51fc696..f7819a85 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -6,6 +6,9 @@
@@ -62,7 +63,7 @@
dev->dbg.sku_disable ? 0 : phy->sku_limit_en);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 51c771b..7318842 100644
+index 40860f9f..362af7aa 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -717,6 +717,14 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -81,7 +82,7 @@
case MCU_UNI_EVENT_TESTMODE_CTRL:
mt7996_tm_rf_test_event(dev, skb);
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 97425a0..c06aae9 100644
+index 01a5abdf..20fa4221 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -357,6 +357,10 @@ struct mt7996_phy {
@@ -105,10 +106,10 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 2a9f213..3eb55a3 100644
+index 053005dd..06dc794e 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2836,6 +2836,83 @@ static int mt7996_show_eeprom_mode(struct seq_file *s, void *data)
+@@ -2835,6 +2835,83 @@ static int mt7996_show_eeprom_mode(struct seq_file *s, void *data)
return 0;
}
@@ -205,7 +206,7 @@
}
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index 5c54d02..dbdf8d8 100644
+index 5c54d02c..dbdf8d80 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
@@ -146,4 +146,115 @@ int mt7996_mcu_edcca_threshold_ctrl(struct mt7996_phy *phy, u8 *value, bool set)
@@ -325,7 +326,7 @@
+}
#endif
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index 36a58ad..098e63a 100644
+index 36a58ad6..098e63ae 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -121,6 +121,62 @@ enum {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0035-mtk-wifi-mt76-mt7996-Establish-BA-in-VO-queue.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0041-mtk-mt76-mt7996-Establish-BA-in-VO-queue.patch
similarity index 65%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0035-mtk-wifi-mt76-mt7996-Establish-BA-in-VO-queue.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0041-mtk-mt76-mt7996-Establish-BA-in-VO-queue.patch
index 1103857..9a0dd2a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0035-mtk-wifi-mt76-mt7996-Establish-BA-in-VO-queue.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0041-mtk-mt76-mt7996-Establish-BA-in-VO-queue.patch
@@ -1,17 +1,17 @@
-From e6c2efee109792cf81fa79a0b0bf56fdbc1f4787 Mon Sep 17 00:00:00 2001
+From c8d8e7a0cc7d030616f27bd5cbb0cb9c8e51b746 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 1 Aug 2023 16:02:28 +0800
-Subject: [PATCH 035/116] mtk: wifi: mt76: mt7996: Establish BA in VO queue
+Subject: [PATCH 041/199] mtk: mt76: mt7996: Establish BA in VO queue
---
mt7996/mac.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 1c1b3eb..4e52aa1 100644
+index d9e8e751..8226e443 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1032,8 +1032,6 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
+@@ -1041,8 +1041,6 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
return;
tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0041-mtk-wifi-mt76-mt7996-add-debugfs-knob-for-rx_counter.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0041-mtk-wifi-mt76-mt7996-add-debugfs-knob-for-rx_counter.patch
deleted file mode 100644
index 6b2abc6..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0041-mtk-wifi-mt76-mt7996-add-debugfs-knob-for-rx_counter.patch
+++ /dev/null
@@ -1,291 +0,0 @@
-From 9e924043388155d6e27199f90755a282d4b13126 Mon Sep 17 00:00:00 2001
-From: Peter Chiu <chui-hao.chiu@mediatek.com>
-Date: Fri, 28 Apr 2023 10:39:58 +0800
-Subject: [PATCH 041/116] mtk: wifi: mt76: mt7996: add debugfs knob for
- rx_counters
-
-Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
----
- agg-rx.c | 8 ++++++++
- mac80211.c | 16 ++++++++++++++--
- mt76.h | 15 +++++++++++++++
- mt7996/mac.c | 18 +++++++++++++++---
- mt7996/mtk_debugfs.c | 42 ++++++++++++++++++++++++++++++++++++++++++
- 5 files changed, 94 insertions(+), 5 deletions(-)
-
-diff --git a/agg-rx.c b/agg-rx.c
-index 07c386c..37588ac 100644
---- a/agg-rx.c
-+++ b/agg-rx.c
-@@ -33,10 +33,13 @@ mt76_rx_aggr_release_frames(struct mt76_rx_tid *tid,
- struct sk_buff_head *frames,
- u16 head)
- {
-+ struct mt76_phy *phy = mt76_dev_phy(tid->dev, tid->band_idx);
- int idx;
-
- while (ieee80211_sn_less(tid->head, head)) {
- idx = tid->head % tid->size;
-+ if (!tid->reorder_buf[idx])
-+ phy->rx_stats.rx_agg_miss++;
- mt76_aggr_release(tid, frames, idx);
- }
- }
-@@ -151,6 +154,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
- struct mt76_wcid *wcid = status->wcid;
- struct ieee80211_sta *sta;
- struct mt76_rx_tid *tid;
-+ struct mt76_phy *phy;
- bool sn_less;
- u16 seqno, head, size, idx;
- u8 tidno = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK;
-@@ -186,6 +190,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
- head = tid->head;
- seqno = status->seqno;
- size = tid->size;
-+ phy = mt76_dev_phy(tid->dev, tid->band_idx);
- sn_less = ieee80211_sn_less(seqno, head);
-
- if (!tid->started) {
-@@ -197,6 +202,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
-
- if (sn_less) {
- __skb_unlink(skb, frames);
-+ phy->rx_stats.rx_dup_drop++;
- dev_kfree_skb(skb);
- goto out;
- }
-@@ -223,6 +229,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
-
- /* Discard if the current slot is already in use */
- if (tid->reorder_buf[idx]) {
-+ phy->rx_stats.rx_dup_drop++;
- dev_kfree_skb(skb);
- goto out;
- }
-@@ -254,6 +261,7 @@ int mt76_rx_aggr_start(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tidno,
- tid->head = ssn;
- tid->size = size;
- tid->num = tidno;
-+ tid->band_idx = wcid->phy_idx;
- INIT_DELAYED_WORK(&tid->reorder_work, mt76_rx_aggr_reorder_work);
- spin_lock_init(&tid->lock);
-
-diff --git a/mac80211.c b/mac80211.c
-index e2ff011..93e5c50 100644
---- a/mac80211.c
-+++ b/mac80211.c
-@@ -784,6 +784,7 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
- }
-
- if (ether_addr_equal(skb->data + offset, rfc1042_header)) {
-+ phy->rx_stats.rx_drop++;
- dev_kfree_skb(skb);
- return;
- }
-@@ -1100,10 +1101,16 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
-
- *sta = wcid_to_sta(mstat.wcid);
- *hw = mt76_phy_hw(dev, mstat.phy_idx);
-+
-+ if ((mstat.flag & RX_FLAG_8023) || ieee80211_is_data_qos(hdr->frame_control)) {
-+ struct mt76_phy *phy = mt76_dev_phy(dev, mstat.phy_idx);
-+
-+ phy->rx_stats.rx_mac80211++;
-+ }
- }
-
- static void
--mt76_check_ccmp_pn(struct sk_buff *skb)
-+mt76_check_ccmp_pn(struct mt76_dev *dev, struct sk_buff *skb)
- {
- struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
- struct mt76_wcid *wcid = status->wcid;
-@@ -1150,7 +1157,11 @@ skip_hdr_check:
- ret = memcmp(status->iv, wcid->rx_key_pn[security_idx],
- sizeof(status->iv));
- if (ret <= 0) {
-+ struct mt76_phy *phy = mt76_dev_phy(dev, status->phy_idx);
-+
-+ phy->rx_stats.rx_pn_iv_error++;
- status->flag |= RX_FLAG_ONLY_MONITOR;
-+
- return;
- }
-
-@@ -1331,7 +1342,7 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
- while ((skb = __skb_dequeue(frames)) != NULL) {
- struct sk_buff *nskb = skb_shinfo(skb)->frag_list;
-
-- mt76_check_ccmp_pn(skb);
-+ mt76_check_ccmp_pn(dev, skb);
- skb_shinfo(skb)->frag_list = NULL;
- mt76_rx_convert(dev, skb, &hw, &sta);
- ieee80211_rx_list(hw, sta, skb, &list);
-@@ -1354,6 +1365,7 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
- }
-
- list_for_each_entry_safe(skb, tmp, &list, list) {
-+ dev->rx_kernel++;
- skb_list_del_init(skb);
- napi_gro_receive(napi, skb);
- }
-diff --git a/mt76.h b/mt76.h
-index 43e4585..0cc6e53 100644
---- a/mt76.h
-+++ b/mt76.h
-@@ -428,6 +428,7 @@ struct mt76_rx_tid {
- struct rcu_head rcu_head;
-
- struct mt76_dev *dev;
-+ u8 band_idx;
-
- spinlock_t lock;
- struct delayed_work reorder_work;
-@@ -859,6 +860,19 @@ struct mt76_phy {
- bool al;
- u8 pin;
- } leds;
-+
-+ struct {
-+ u32 rx_mac80211;
-+
-+ u32 rx_drop;
-+ u32 rx_rxd_drop;
-+ u32 rx_dup_drop;
-+ u32 rx_agg_miss;
-+ u32 rx_icv_error;
-+ u32 rx_fcs_error;
-+ u32 rx_tkip_mic_error;
-+ u32 rx_pn_iv_error;
-+ } rx_stats;
- };
-
- struct mt76_dev {
-@@ -964,6 +978,7 @@ struct mt76_dev {
- };
-
- const char *bin_file_name;
-+ u32 rx_kernel;
- };
-
- /* per-phy stats. */
-diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 9b5b995..18616fd 100644
---- a/mt7996/mac.c
-+++ b/mt7996/mac.c
-@@ -469,8 +469,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
- return -EINVAL;
-
- /* ICV error or CCMP/BIP/WPI MIC error */
-- if (rxd1 & MT_RXD1_NORMAL_ICV_ERR)
-+ if (rxd1 & MT_RXD1_NORMAL_ICV_ERR) {
-+ mphy->rx_stats.rx_icv_error++;
- status->flag |= RX_FLAG_ONLY_MONITOR;
-+ }
-
- unicast = FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) == MT_RXD3_NORMAL_U2M;
- idx = FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1);
-@@ -501,11 +503,15 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
- !(csum_status & (BIT(0) | BIT(2) | BIT(3))))
- skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-- if (rxd1 & MT_RXD3_NORMAL_FCS_ERR)
-+ if (rxd1 & MT_RXD3_NORMAL_FCS_ERR) {
-+ mphy->rx_stats.rx_fcs_error++;
- status->flag |= RX_FLAG_FAILED_FCS_CRC;
-+ }
-
-- if (rxd1 & MT_RXD1_NORMAL_TKIP_MIC_ERR)
-+ if (rxd1 & MT_RXD1_NORMAL_TKIP_MIC_ERR) {
-+ mphy->rx_stats.rx_tkip_mic_error++;
- status->flag |= RX_FLAG_MMIC_ERROR;
-+ }
-
- if (FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2) != 0 &&
- !(rxd1 & (MT_RXD1_NORMAL_CLM | MT_RXD1_NORMAL_CM))) {
-@@ -1415,8 +1421,10 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- struct sk_buff *skb, u32 *info)
- {
- struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
-+ struct mt76_phy *phy;
- __le32 *rxd = (__le32 *)skb->data;
- __le32 *end = (__le32 *)&skb->data[skb->len];
-+ u8 band_idx;
- enum rx_pkt_type type;
-
- type = le32_get_bits(rxd[0], MT_RXD0_PKT_TYPE);
-@@ -1458,6 +1466,10 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- }
- fallthrough;
- default:
-+ band_idx = le32_get_bits(rxd[1], MT_RXD1_NORMAL_BAND_IDX);
-+ phy = mt76_dev_phy(mdev, band_idx);
-+ if (likely(phy))
-+ phy->rx_stats.rx_rxd_drop++;
- dev_kfree_skb(skb);
- break;
- }
-diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 3eb55a3..af7d3a1 100644
---- a/mt7996/mtk_debugfs.c
-+++ b/mt7996/mtk_debugfs.c
-@@ -2913,6 +2913,46 @@ mt7996_sr_scene_cond_show(struct seq_file *file, void *data)
- }
- DEFINE_SHOW_ATTRIBUTE(mt7996_sr_scene_cond);
-
-+static int mt7996_rx_counters(struct seq_file *s, void *data)
-+{
-+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
-+ u32 rx_mac80211 = 0;
-+ int i = 0;
-+
-+ for (i = 0; i < __MT_MAX_BAND; i++) {
-+ struct mt76_phy *phy = mt76_dev_phy(&dev->mt76, i);
-+
-+ if (!phy)
-+ continue;
-+
-+ seq_printf(s, "\n==========PHY%d==========\n", i);
-+
-+#define SEQ_PRINT(_str, _rx_param) do { \
-+ seq_printf(s, _str"\n", phy->rx_stats._rx_param); \
-+ } while (0)
-+
-+ SEQ_PRINT("Rx to mac80211: %u", rx_mac80211);
-+ SEQ_PRINT("Rx drop: %u", rx_drop);
-+ SEQ_PRINT("Rx drop due to RXD type error: %u", rx_rxd_drop);
-+ SEQ_PRINT("Rx duplicated drop: %u", rx_dup_drop);
-+ SEQ_PRINT("Rx agg miss: %u", rx_agg_miss);
-+ SEQ_PRINT("Rx ICV error: %u", rx_icv_error);
-+ SEQ_PRINT("Rx FCS error: %u", rx_fcs_error);
-+ SEQ_PRINT("Rx TKIP MIC error: %u", rx_tkip_mic_error);
-+ SEQ_PRINT("Rx PN/IV error: %u", rx_pn_iv_error);
-+#undef SEQ_PRINT
-+
-+ rx_mac80211 += phy->rx_stats.rx_mac80211;
-+ }
-+
-+ seq_printf(s, "\n==========SUM==========\n");
-+ seq_printf(s, "Rx to kernel: %u\n", dev->mt76.rx_kernel);
-+ seq_printf(s, "Rx to mac80211: %u\n", rx_mac80211);
-+
-+
-+ return 0;
-+}
-+
- int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
- {
- struct mt7996_dev *dev = phy->dev;
-@@ -2976,6 +3016,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
-
- debugfs_create_devm_seqfile(dev->mt76.dev, "tr_info", dir,
- mt7996_trinfo_read);
-+ debugfs_create_devm_seqfile(dev->mt76.dev, "rx_counters", dir,
-+ mt7996_rx_counters);
- debugfs_create_file("txpower_level", 0600, dir, phy, &fops_txpower_level);
- debugfs_create_file("txpower_info", 0600, dir, phy, &mt7996_txpower_info_fops);
- debugfs_create_file("txpower_sku", 0600, dir, phy, &mt7996_txpower_sku_fops);
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0036-mtk-wifi-mt76-mt7996-report-tx-and-rx-byte-to-tpt_le.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0042-mtk-mt76-mt7996-report-tx-and-rx-byte-to-tpt_led.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0036-mtk-wifi-mt76-mt7996-report-tx-and-rx-byte-to-tpt_le.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0042-mtk-mt76-mt7996-report-tx-and-rx-byte-to-tpt_led.patch
index e58ed5b..daa1f6b 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0036-mtk-wifi-mt76-mt7996-report-tx-and-rx-byte-to-tpt_le.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0042-mtk-mt76-mt7996-report-tx-and-rx-byte-to-tpt_led.patch
@@ -1,15 +1,14 @@
-From fdad308b7db267d46e7dc1e22f251797c9cbd79e Mon Sep 17 00:00:00 2001
+From 495a443a1a4b9411c9926dbea98a3e54c0afc81c Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Sat, 12 Aug 2023 04:17:22 +0800
-Subject: [PATCH 036/116] mtk: wifi: mt76: mt7996: report tx and rx byte to
- tpt_led
+Subject: [PATCH 042/199] mtk: mt76: mt7996: report tx and rx byte to tpt_led
---
mt7996/mcu.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 7318842..2b9dedb 100644
+index 362af7aa..548f6660 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -525,6 +525,8 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0037-mtk-wifi-mt76-mt7996-support-dup-wtbl.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0043-mtk-mt76-mt7996-support-dup-wtbl.patch
similarity index 86%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0037-mtk-wifi-mt76-mt7996-support-dup-wtbl.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0043-mtk-mt76-mt7996-support-dup-wtbl.patch
index 77e8fb5..b3afa44 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0037-mtk-wifi-mt76-mt7996-support-dup-wtbl.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0043-mtk-mt76-mt7996-support-dup-wtbl.patch
@@ -1,7 +1,7 @@
-From a0f3047d8ba9040f39a14a202b7369efe223dd9e Mon Sep 17 00:00:00 2001
+From bd575b80c7fb5acfb16c3180f0f7cea4a07eff42 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 21 Sep 2023 00:52:46 +0800
-Subject: [PATCH 037/116] mtk: wifi: mt76: mt7996: support dup wtbl
+Subject: [PATCH 043/199] mtk: mt76: mt7996: support dup wtbl
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
@@ -11,10 +11,10 @@
3 files changed, 25 insertions(+)
diff --git a/mt7996/init.c b/mt7996/init.c
-index 5cc2e6f..d4b0a72 100644
+index 0cf054df..0201d9fc 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -686,6 +686,7 @@ static void mt7996_init_work(struct work_struct *work)
+@@ -688,6 +688,7 @@ static void mt7996_init_work(struct work_struct *work)
mt7996_mcu_set_eeprom(dev);
mt7996_mac_init(dev);
mt7996_txbf_init(dev);
@@ -23,7 +23,7 @@
void mt7996_wfsys_reset(struct mt7996_dev *dev)
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index c06aae9..dbc4aa6 100644
+index 20fa4221..9ec2090b 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -813,6 +813,7 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir);
@@ -35,7 +35,7 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index dbdf8d8..ea4e5bf 100644
+index dbdf8d80..ea4e5bf2 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
@@ -257,4 +257,27 @@ void mt7996_mcu_rx_sr_event(struct mt7996_dev *dev, struct sk_buff *skb)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0043-mtk-wifi-mt76-mt7996-add-build-the-following-MURU-mc.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0043-mtk-wifi-mt76-mt7996-add-build-the-following-MURU-mc.patch
deleted file mode 100644
index 4064983..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0043-mtk-wifi-mt76-mt7996-add-build-the-following-MURU-mc.patch
+++ /dev/null
@@ -1,188 +0,0 @@
-From 786203d2878c468d179ec324c9d91b331e09e16a Mon Sep 17 00:00:00 2001
-From: Howard Hsu <howard-yh.hsu@mediatek.com>
-Date: Tue, 13 Jun 2023 14:49:02 +0800
-Subject: [PATCH 043/116] mtk: wifi: mt76: mt7996: add build the following MURU
- mcu command tlvs
-
-It includes the following tlvs:
-1. MURU tlv id 0x10, 0x33, 0xC8, 0xC9, 0xCA, 0xCC, 0xCD
-2. BF tlv id 0x1c
----
- mt7996/mcu.h | 1 +
- mt7996/mt7996.h | 3 ++
- mt7996/mtk_debugfs.c | 12 +++++++
- mt7996/mtk_mcu.c | 78 ++++++++++++++++++++++++++++++++++++++++++++
- mt7996/mtk_mcu.h | 14 ++++++++
- 5 files changed, 108 insertions(+)
-
-diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 29bd7a5..848c85d 100644
---- a/mt7996/mcu.h
-+++ b/mt7996/mcu.h
-@@ -776,6 +776,7 @@ enum {
- BF_MOD_EN_CTRL = 20,
- BF_FBRPT_DBG_INFO_READ = 23,
- BF_TXSND_INFO = 24,
-+ BF_CFG_PHY = 28,
- };
-
- enum {
-diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 4602b4e..205a3c7 100644
---- a/mt7996/mt7996.h
-+++ b/mt7996/mt7996.h
-@@ -821,6 +821,9 @@ void mt7996_mcu_rx_bf_event(struct mt7996_dev *dev, struct sk_buff *skb);
- int mt7996_mcu_set_muru_fixed_rate_enable(struct mt7996_dev *dev, u8 action, int val);
- int mt7996_mcu_set_muru_fixed_rate_parameter(struct mt7996_dev *dev, u8 action, void *para);
- int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para);
-+int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val);
-+int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val);
-+int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val);
- #endif
-
- #ifdef CONFIG_NET_MEDIATEK_SOC_WED
-diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 0851d65..b7fef1b 100644
---- a/mt7996/mtk_debugfs.c
-+++ b/mt7996/mtk_debugfs.c
-@@ -3064,6 +3064,16 @@ static const struct file_operations fops_muru_fixed_group_rate = {
- .llseek = default_llseek,
- };
-
-+static int mt7996_muru_prot_thr_set(void *data, u64 val)
-+{
-+ struct mt7996_phy *phy = data;
-+
-+ return mt7996_mcu_muru_set_prot_frame_thr(phy->dev, (u32)val);
-+}
-+
-+DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_prot_thr, NULL,
-+ mt7996_muru_prot_thr_set, "%lld\n");
-+
- int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
- {
- struct mt7996_dev *dev = phy->dev;
-@@ -3159,6 +3169,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
- debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt);
- debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read);
-
-+ debugfs_create_file("muru_prot_thr", 0200, dir, phy, &fops_muru_prot_thr);
-+
- return 0;
- }
-
-diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index 6b2cdad..6865062 100644
---- a/mt7996/mtk_mcu.c
-+++ b/mt7996/mtk_mcu.c
-@@ -904,4 +904,82 @@ error:
- return -EINVAL;
- }
-
-+/**
-+ * This function can be used to build the following commands
-+ * MURU_SUTX_CTRL (0x10)
-+ * SET_FORCE_MU (0x33)
-+ * SET_MUDL_ACK_POLICY (0xC8)
-+ * SET_TRIG_TYPE (0xC9)
-+ * SET_20M_DYN_ALGO (0xCA)
-+ * SET_CERT_MU_EDCA_OVERRIDE (0xCD)
-+ */
-+int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val)
-+{
-+ struct {
-+ u8 _rsv[4];
-+
-+ __le16 tag;
-+ __le16 len;
-+
-+ u8 config;
-+ u8 rsv[3];
-+ } __packed data = {
-+ .tag = cpu_to_le16(action),
-+ .len = cpu_to_le16(sizeof(data) - 4),
-+ .config = (u8) val,
-+ };
-+
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &data, sizeof(data),
-+ false);
-+}
-+
-+int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val)
-+{
-+ struct {
-+ u8 _rsv[4];
-+
-+ __le16 tag;
-+ __le16 len;
-+
-+ __le32 prot_frame_thr;
-+ } __packed data = {
-+ .tag = cpu_to_le16(UNI_CMD_MURU_PROT_FRAME_THR),
-+ .len = cpu_to_le16(sizeof(data) - 4),
-+ .prot_frame_thr = cpu_to_le32(val),
-+ };
-+
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &data, sizeof(data),
-+ false);
-+}
-+
-+int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
-+{
-+#define BF_PHY_SMTH_INT_BYPASS 0
-+#define BYPASS_VAL 1
-+ struct mt7996_dev *dev = phy->dev;
-+ struct {
-+ u8 _rsv[4];
-+
-+ u16 tag;
-+ u16 len;
-+
-+ u8 action;
-+ u8 band_idx;
-+ u8 smthintbypass;
-+ u8 __rsv2[5];
-+ } __packed data = {
-+ .tag = cpu_to_le16(BF_CFG_PHY),
-+ .len = cpu_to_le16(sizeof(data) - 4),
-+ .action = BF_PHY_SMTH_INT_BYPASS,
-+ .band_idx = phy->mt76->band_idx,
-+ .smthintbypass = val,
-+ };
-+
-+ if (val != BYPASS_VAL)
-+ return -EINVAL;
-+
-+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(BF), &data, sizeof(data),
-+ true);
-+}
-+
- #endif
-diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index 27d6a05..d9686eb 100644
---- a/mt7996/mtk_mcu.h
-+++ b/mt7996/mtk_mcu.h
-@@ -119,6 +119,20 @@ enum {
- EDCCA_FCC = 1,
- EDCCA_ETSI = 2,
- EDCCA_JAPAN = 3
-+};
-+
-+enum {
-+ UNI_CMD_MURU_SUTX_CTRL = 0x10,
-+ UNI_CMD_MURU_FIXED_RATE_CTRL,
-+ UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL,
-+ UNI_CMD_MURU_SET_FORCE_MU = 0x33,
-+ UNI_CMD_MURU_MUNUAL_CONFIG = 0x64,
-+ UNI_CMD_MURU_SET_MUDL_ACK_POLICY = 0xC9,
-+ UNI_CMD_MURU_SET_TRIG_TYPE,
-+ UNI_CMD_MURU_SET_20M_DYN_ALGO,
-+ UNI_CMD_MURU_PROT_FRAME_THR = 0xCC,
-+ UNI_CMD_MURU_SET_CERT_MU_EDCA_OVERRIDE,
-+};
-
- struct bf_pfmu_tag {
- __le16 tag;
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0038-mtk-wifi-mt76-try-more-times-when-send-message-timeo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0044-mtk-mt76-try-more-times-when-send-message-timeout.patch
similarity index 90%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0038-mtk-wifi-mt76-try-more-times-when-send-message-timeo.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0044-mtk-mt76-try-more-times-when-send-message-timeout.patch
index 937ae0c..6b7f250 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0038-mtk-wifi-mt76-try-more-times-when-send-message-timeo.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0044-mtk-mt76-try-more-times-when-send-message-timeout.patch
@@ -1,8 +1,7 @@
-From 3cc26e708dbef9b1eb0b5466a073a9c5c8a613b9 Mon Sep 17 00:00:00 2001
+From 9344da8ab6885e336d0fbc7c90f59feeb580362d Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 6 Nov 2023 11:10:10 +0800
-Subject: [PATCH 038/116] mtk: wifi: mt76: try more times when send message
- timeout.
+Subject: [PATCH 044/199] mtk: mt76: try more times when send message timeout.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -12,7 +11,7 @@
3 files changed, 62 insertions(+), 47 deletions(-)
diff --git a/dma.c b/dma.c
-index 5604463..66c000e 100644
+index 56044639..66c000ef 100644
--- a/dma.c
+++ b/dma.c
@@ -504,9 +504,12 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
@@ -39,7 +38,7 @@
static int
diff --git a/mcu.c b/mcu.c
-index fa4b054..2926f71 100644
+index fa4b0544..2926f715 100644
--- a/mcu.c
+++ b/mcu.c
@@ -4,6 +4,7 @@
@@ -131,10 +130,10 @@
return ret;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 4e52aa1..56827c9 100644
+index 8226e443..503a562a 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1784,13 +1784,24 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
+@@ -1793,13 +1793,24 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
phy3 = mt7996_phy3(dev);
dev->recovery.hw_full_reset = true;
@@ -160,7 +159,7 @@
cancel_work_sync(&dev->wed_rro.work);
cancel_delayed_work_sync(&dev->mphy.mac_work);
if (phy2)
-@@ -1893,16 +1904,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -1902,16 +1913,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
set_bit(MT76_MCU_RESET, &dev->mphy.state);
wake_up(&dev->mt76.mcu.wait);
@@ -177,7 +176,7 @@
mt76_worker_disable(&dev->mt76.tx_worker);
mt76_for_each_q_rx(&dev->mt76, i) {
if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
-@@ -1913,8 +1914,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -1922,8 +1923,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
}
napi_disable(&dev->mt76.tx_napi);
@@ -186,7 +185,7 @@
mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_STOPPED);
if (mt7996_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) {
-@@ -1987,20 +1986,8 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -1996,20 +1995,8 @@ void mt7996_mac_reset_work(struct work_struct *work)
if (phy3)
ieee80211_wake_queues(phy3->mt76->hw);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0039-mtk-wifi-mt76-mt7996-add-SER-overlap-handle.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0045-mtk-mt76-mt7996-add-SER-overlap-handle.patch
similarity index 83%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0039-mtk-wifi-mt76-mt7996-add-SER-overlap-handle.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0045-mtk-mt76-mt7996-add-SER-overlap-handle.patch
index ab691e1..d574613 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0039-mtk-wifi-mt76-mt7996-add-SER-overlap-handle.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0045-mtk-mt76-mt7996-add-SER-overlap-handle.patch
@@ -1,7 +1,7 @@
-From 5759eb68a8453f211699bb09d74a39dd9e8d4c02 Mon Sep 17 00:00:00 2001
+From 4a53b4dbb4c727e79752c35c588cb6ebb82d072a Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Tue, 21 Nov 2023 09:55:46 +0800
-Subject: [PATCH 039/116] mtk: wifi: mt76: mt7996: add SER overlap handle
+Subject: [PATCH 045/199] mtk: mt76: mt7996: add SER overlap handle
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -12,7 +12,7 @@
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/mcu.c b/mcu.c
-index 2926f71..a7afa2d 100644
+index 2926f715..a7afa2d7 100644
--- a/mcu.c
+++ b/mcu.c
@@ -94,7 +94,8 @@ int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,
@@ -26,10 +26,10 @@
ret = dev->mcu_ops->mcu_skb_send_msg(dev, skb_tmp, cmd, &seq);
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 56827c9..9b5b995 100644
+index 503a562a..63408421 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1885,6 +1885,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -1894,6 +1894,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
if (!(READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA))
return;
@@ -37,7 +37,7 @@
dev_info(dev->mt76.dev,"\n%s L1 SER recovery start.",
wiphy_name(dev->mt76.hw->wiphy));
-@@ -1902,6 +1903,10 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -1911,6 +1912,10 @@ void mt7996_mac_reset_work(struct work_struct *work)
set_bit(MT76_RESET, &dev->mphy.state);
set_bit(MT76_MCU_RESET, &dev->mphy.state);
@@ -48,7 +48,7 @@
wake_up(&dev->mt76.mcu.wait);
mt76_worker_disable(&dev->mt76.tx_worker);
-@@ -2097,6 +2102,9 @@ void mt7996_coredump(struct mt7996_dev *dev, u8 state)
+@@ -2106,6 +2111,9 @@ void mt7996_coredump(struct mt7996_dev *dev, u8 state)
void mt7996_reset(struct mt7996_dev *dev)
{
@@ -58,7 +58,7 @@
if (!dev->recovery.hw_init_done)
return;
-@@ -2116,6 +2124,9 @@ void mt7996_reset(struct mt7996_dev *dev)
+@@ -2125,6 +2133,9 @@ void mt7996_reset(struct mt7996_dev *dev)
return;
}
@@ -69,7 +69,7 @@
wake_up(&dev->reset_wait);
}
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 2b9dedb..ce26cfb 100644
+index 548f6660..49a55bd3 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -246,6 +246,14 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
@@ -88,7 +88,7 @@
seq = ++dev->mt76.mcu.msg_seq & 0xf;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index dbc4aa6..d40f8bf 100644
+index 9ec2090b..47a316e1 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -397,6 +397,8 @@ struct mt7996_dev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0040-mtk-wifi-mt76-mt7996-kite-default-1-pcie-setting.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0046-mtk-mt76-mt7996-kite-default-1-pcie-setting.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0040-mtk-wifi-mt76-mt7996-kite-default-1-pcie-setting.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0046-mtk-mt76-mt7996-kite-default-1-pcie-setting.patch
index 2bb7510..a42d9e3 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0040-mtk-wifi-mt76-mt7996-kite-default-1-pcie-setting.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0046-mtk-mt76-mt7996-kite-default-1-pcie-setting.patch
@@ -1,7 +1,7 @@
-From 9d16189b29de2e3c2fb0daf7fe5238f489b26818 Mon Sep 17 00:00:00 2001
+From 3557ff32b5eb1d0625c2e0427946629d631788a4 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 13 Jul 2023 16:36:36 +0800
-Subject: [PATCH 040/116] mtk: wifi: mt76: mt7996: kite default 1-pcie setting
+Subject: [PATCH 046/199] mtk: mt76: mt7996: kite default 1-pcie setting
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -9,7 +9,7 @@
1 file changed, 11 insertions(+)
diff --git a/mt7996/pci.c b/mt7996/pci.c
-index 0405618..05830c0 100644
+index 04056181..05830c01 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -11,6 +11,9 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0042-mtk-wifi-mt76-mt7996-support-BF-MIMO-debug-commands.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0047-mtk-mt76-mt7996-support-BF-MIMO-debug-commands.patch
similarity index 89%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0042-mtk-wifi-mt76-mt7996-support-BF-MIMO-debug-commands.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0047-mtk-mt76-mt7996-support-BF-MIMO-debug-commands.patch
index 55a47be..707dbde 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0042-mtk-wifi-mt76-mt7996-support-BF-MIMO-debug-commands.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0047-mtk-mt76-mt7996-support-BF-MIMO-debug-commands.patch
@@ -1,8 +1,7 @@
-From 8ffdd68c3265dbb716322ccfb0a8c0e230616335 Mon Sep 17 00:00:00 2001
+From 8f94ecaccf64cd36ad869a3c4d6fcc56648c12a4 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Tue, 3 Jan 2023 09:42:07 +0800
-Subject: [PATCH 042/116] mtk: wifi: mt76: mt7996: support BF/MIMO debug
- commands
+Subject: [PATCH 047/199] mtk: mt76: mt7996: support BF/MIMO debug commands
This commit includes the following commands:
1. starec_bf_read
@@ -10,30 +9,27 @@
3. fbkRptInfo
4. fix muru rate
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
fix the wrong wlan_idx for user3
-Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
-
-Align the format of mcu event "mt7996_mcu_bf_starec_read" with
+Align the format of mcu event mt7996_mcu_bf_starec_read with
firmware definition.
Fw gerrit change:
https://gerrit.mediatek.inc/c/neptune/firmware/bora/wifi/core/+/8218143
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
mt7996/mcu.c | 5 +
mt7996/mcu.h | 4 +
mt7996/mt7996.h | 5 +
- mt7996/mtk_debugfs.c | 120 +++++++++
+ mt7996/mtk_debugfs.c | 9 +
mt7996/mtk_mcu.c | 624 +++++++++++++++++++++++++++++++++++++++++++
mt7996/mtk_mcu.h | 342 ++++++++++++++++++++++++
- 6 files changed, 1100 insertions(+)
+ 6 files changed, 989 insertions(+)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index ce26cfb..d39a73f 100644
+index 49a55bd3..c47dee02 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -744,6 +744,11 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -49,7 +45,7 @@
default:
break;
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index cb7260f..29bd7a5 100644
+index 3e9364de..8a718513 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -770,8 +770,12 @@ enum {
@@ -66,7 +62,7 @@
enum {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index d40f8bf..4602b4e 100644
+index 47a316e1..8935ef22 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -816,6 +816,11 @@ int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val);
@@ -82,128 +78,10 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index af7d3a1..0851d65 100644
+index 06dc794e..b3cc8119 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2953,6 +2953,117 @@ static int mt7996_rx_counters(struct seq_file *s, void *data)
- return 0;
- }
-
-+static int
-+mt7996_starec_bf_read_set(void *data, u64 wlan_idx)
-+{
-+ struct mt7996_phy *phy = data;
-+
-+ return mt7996_mcu_set_txbf_internal(phy, BF_STA_REC_READ, wlan_idx);
-+}
-+DEFINE_DEBUGFS_ATTRIBUTE(fops_starec_bf_read, NULL,
-+ mt7996_starec_bf_read_set, "%lld\n");
-+
-+static ssize_t
-+mt7996_bf_txsnd_info_set(struct file *file,
-+ const char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct mt7996_phy *phy = file->private_data;
-+ char buf[40];
-+ int ret;
-+
-+ if (count >= sizeof(buf))
-+ return -EINVAL;
-+
-+ if (copy_from_user(buf, user_buf, count))
-+ return -EFAULT;
-+
-+ if (count && buf[count - 1] == '\n')
-+ buf[count - 1] = '\0';
-+ else
-+ buf[count] = '\0';
-+
-+ ret = mt7996_mcu_set_txbf_snd_info(phy, buf);
-+
-+ if (ret) return -EFAULT;
-+
-+ return count;
-+}
-+
-+static const struct file_operations fops_bf_txsnd_info = {
-+ .write = mt7996_bf_txsnd_info_set,
-+ .read = NULL,
-+ .open = simple_open,
-+ .llseek = default_llseek,
-+};
-+
-+static int
-+mt7996_bf_fbk_rpt_set(void *data, u64 wlan_idx)
-+{
-+ struct mt7996_phy *phy = data;
-+
-+ return mt7996_mcu_set_txbf_internal(phy, BF_FBRPT_DBG_INFO_READ, wlan_idx);
-+}
-+DEFINE_DEBUGFS_ATTRIBUTE(fops_bf_fbk_rpt, NULL,
-+ mt7996_bf_fbk_rpt_set, "%lld\n");
-+
-+static int
-+mt7996_bf_pfmu_tag_read_set(void *data, u64 wlan_idx)
-+{
-+ struct mt7996_phy *phy = data;
-+
-+ return mt7996_mcu_set_txbf_internal(phy, BF_PFMU_TAG_READ, wlan_idx);
-+}
-+DEFINE_DEBUGFS_ATTRIBUTE(fops_bf_pfmu_tag_read, NULL,
-+ mt7996_bf_pfmu_tag_read_set, "%lld\n");
-+
-+static int
-+mt7996_muru_fixed_rate_set(void *data, u64 val)
-+{
-+ struct mt7996_dev *dev = data;
-+
-+ return mt7996_mcu_set_muru_fixed_rate_enable(dev, UNI_CMD_MURU_FIXED_RATE_CTRL,
-+ val);
-+}
-+DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_fixed_rate_enable, NULL,
-+ mt7996_muru_fixed_rate_set, "%lld\n");
-+
-+static ssize_t
-+mt7996_muru_fixed_rate_parameter_set(struct file *file,
-+ const char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct mt7996_dev *dev = file->private_data;
-+ char buf[40];
-+ int ret;
-+
-+ if (count >= sizeof(buf))
-+ return -EINVAL;
-+
-+ if (copy_from_user(buf, user_buf, count))
-+ return -EFAULT;
-+
-+ if (count && buf[count - 1] == '\n')
-+ buf[count - 1] = '\0';
-+ else
-+ buf[count] = '\0';
-+
-+
-+ ret = mt7996_mcu_set_muru_fixed_rate_parameter(dev, UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL,
-+ buf);
-+
-+ if (ret) return -EFAULT;
-+
-+ return count;
-+}
-+
-+static const struct file_operations fops_muru_fixed_group_rate = {
-+ .write = mt7996_muru_fixed_rate_parameter_set,
-+ .read = NULL,
-+ .open = simple_open,
-+ .llseek = default_llseek,
-+};
-+
- int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
- {
- struct mt7996_dev *dev = phy->dev;
-@@ -3039,6 +3150,15 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -2997,6 +2997,15 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
debugfs_create_file("sr_stats", 0400, dir, phy, &mt7996_sr_stats_fops);
debugfs_create_file("sr_scene_cond", 0400, dir, phy, &mt7996_sr_scene_cond_fops);
@@ -220,7 +98,7 @@
}
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index ea4e5bf..6b2cdad 100644
+index ea4e5bf2..6b2cdad6 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
@@ -280,4 +280,628 @@ int mt7996_mcu_set_dup_wtbl(struct mt7996_dev *dev)
@@ -853,7 +731,7 @@
+
#endif
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index 098e63a..27d6a05 100644
+index 098e63ae..27d6a05b 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -119,6 +119,348 @@ enum {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0048-mtk-mt76-mt7996-add-build-the-following-MURU-mcu-com.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0048-mtk-mt76-mt7996-add-build-the-following-MURU-mcu-com.patch
new file mode 100644
index 0000000..0914922
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0048-mtk-mt76-mt7996-add-build-the-following-MURU-mcu-com.patch
@@ -0,0 +1,300 @@
+From 721ea64eb33f3708435f86501121602666d2caec Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Tue, 13 Jun 2023 14:49:02 +0800
+Subject: [PATCH 048/199] mtk: mt76: mt7996: add build the following MURU mcu
+ command tlvs
+
+It includes the following tlvs:
+1. MURU tlv id 0x10, 0x33, 0xC8, 0xC9, 0xCA, 0xCC, 0xCD
+2. BF tlv id 0x1c
+
+---
+ mt7996/mcu.h | 1 +
+ mt7996/mt7996.h | 3 ++
+ mt7996/mtk_debugfs.c | 123 +++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_mcu.c | 78 +++++++++++++++++++++++++++
+ mt7996/mtk_mcu.h | 14 +++++
+ 5 files changed, 219 insertions(+)
+
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 8a718513..a98b174e 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -776,6 +776,7 @@ enum {
+ BF_MOD_EN_CTRL = 20,
+ BF_FBRPT_DBG_INFO_READ = 23,
+ BF_TXSND_INFO = 24,
++ BF_CFG_PHY = 28,
+ };
+
+ enum {
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 8935ef22..45ce7db7 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -821,6 +821,9 @@ void mt7996_mcu_rx_bf_event(struct mt7996_dev *dev, struct sk_buff *skb);
+ int mt7996_mcu_set_muru_fixed_rate_enable(struct mt7996_dev *dev, u8 action, int val);
+ int mt7996_mcu_set_muru_fixed_rate_parameter(struct mt7996_dev *dev, u8 action, void *para);
+ int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para);
++int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val);
++int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val);
++int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val);
+ #endif
+
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index b3cc8119..0e029d5d 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -2912,6 +2912,127 @@ mt7996_sr_scene_cond_show(struct seq_file *file, void *data)
+ }
+ DEFINE_SHOW_ATTRIBUTE(mt7996_sr_scene_cond);
+
++static int
++mt7996_starec_bf_read_set(void *data, u64 wlan_idx)
++{
++ struct mt7996_phy *phy = data;
++
++ return mt7996_mcu_set_txbf_internal(phy, BF_STA_REC_READ, wlan_idx);
++}
++DEFINE_DEBUGFS_ATTRIBUTE(fops_starec_bf_read, NULL,
++ mt7996_starec_bf_read_set, "%lld\n");
++
++static ssize_t
++mt7996_bf_txsnd_info_set(struct file *file,
++ const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_phy *phy = file->private_data;
++ char buf[40];
++ int ret;
++
++ if (count >= sizeof(buf))
++ return -EINVAL;
++
++ if (copy_from_user(buf, user_buf, count))
++ return -EFAULT;
++
++ if (count && buf[count - 1] == '\n')
++ buf[count - 1] = '\0';
++ else
++ buf[count] = '\0';
++
++ ret = mt7996_mcu_set_txbf_snd_info(phy, buf);
++
++ if (ret) return -EFAULT;
++
++ return count;
++}
++
++static const struct file_operations fops_bf_txsnd_info = {
++ .write = mt7996_bf_txsnd_info_set,
++ .read = NULL,
++ .open = simple_open,
++ .llseek = default_llseek,
++};
++
++static int
++mt7996_bf_fbk_rpt_set(void *data, u64 wlan_idx)
++{
++ struct mt7996_phy *phy = data;
++
++ return mt7996_mcu_set_txbf_internal(phy, BF_FBRPT_DBG_INFO_READ, wlan_idx);
++}
++DEFINE_DEBUGFS_ATTRIBUTE(fops_bf_fbk_rpt, NULL,
++ mt7996_bf_fbk_rpt_set, "%lld\n");
++
++static int
++mt7996_bf_pfmu_tag_read_set(void *data, u64 wlan_idx)
++{
++ struct mt7996_phy *phy = data;
++
++ return mt7996_mcu_set_txbf_internal(phy, BF_PFMU_TAG_READ, wlan_idx);
++}
++DEFINE_DEBUGFS_ATTRIBUTE(fops_bf_pfmu_tag_read, NULL,
++ mt7996_bf_pfmu_tag_read_set, "%lld\n");
++
++static int
++mt7996_muru_fixed_rate_set(void *data, u64 val)
++{
++ struct mt7996_dev *dev = data;
++
++ return mt7996_mcu_set_muru_fixed_rate_enable(dev, UNI_CMD_MURU_FIXED_RATE_CTRL,
++ val);
++}
++DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_fixed_rate_enable, NULL,
++ mt7996_muru_fixed_rate_set, "%lld\n");
++
++static ssize_t
++mt7996_muru_fixed_rate_parameter_set(struct file *file,
++ const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_dev *dev = file->private_data;
++ char buf[40];
++ int ret;
++
++ if (count >= sizeof(buf))
++ return -EINVAL;
++
++ if (copy_from_user(buf, user_buf, count))
++ return -EFAULT;
++
++ if (count && buf[count - 1] == '\n')
++ buf[count - 1] = '\0';
++ else
++ buf[count] = '\0';
++
++
++ ret = mt7996_mcu_set_muru_fixed_rate_parameter(dev, UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL,
++ buf);
++
++ if (ret) return -EFAULT;
++
++ return count;
++}
++
++static const struct file_operations fops_muru_fixed_group_rate = {
++ .write = mt7996_muru_fixed_rate_parameter_set,
++ .read = NULL,
++ .open = simple_open,
++ .llseek = default_llseek,
++};
++
++static int mt7996_muru_prot_thr_set(void *data, u64 val)
++{
++ struct mt7996_phy *phy = data;
++
++ return mt7996_mcu_muru_set_prot_frame_thr(phy->dev, (u32)val);
++}
++
++DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_prot_thr, NULL,
++ mt7996_muru_prot_thr_set, "%lld\n");
++
+ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ struct mt7996_dev *dev = phy->dev;
+@@ -3006,6 +3127,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt);
+ debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read);
+
++ debugfs_create_file("muru_prot_thr", 0200, dir, phy, &fops_muru_prot_thr);
++
+ return 0;
+ }
+
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 6b2cdad6..68650623 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -904,4 +904,82 @@ error:
+ return -EINVAL;
+ }
+
++/**
++ * This function can be used to build the following commands
++ * MURU_SUTX_CTRL (0x10)
++ * SET_FORCE_MU (0x33)
++ * SET_MUDL_ACK_POLICY (0xC8)
++ * SET_TRIG_TYPE (0xC9)
++ * SET_20M_DYN_ALGO (0xCA)
++ * SET_CERT_MU_EDCA_OVERRIDE (0xCD)
++ */
++int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val)
++{
++ struct {
++ u8 _rsv[4];
++
++ __le16 tag;
++ __le16 len;
++
++ u8 config;
++ u8 rsv[3];
++ } __packed data = {
++ .tag = cpu_to_le16(action),
++ .len = cpu_to_le16(sizeof(data) - 4),
++ .config = (u8) val,
++ };
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &data, sizeof(data),
++ false);
++}
++
++int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val)
++{
++ struct {
++ u8 _rsv[4];
++
++ __le16 tag;
++ __le16 len;
++
++ __le32 prot_frame_thr;
++ } __packed data = {
++ .tag = cpu_to_le16(UNI_CMD_MURU_PROT_FRAME_THR),
++ .len = cpu_to_le16(sizeof(data) - 4),
++ .prot_frame_thr = cpu_to_le32(val),
++ };
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &data, sizeof(data),
++ false);
++}
++
++int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
++{
++#define BF_PHY_SMTH_INT_BYPASS 0
++#define BYPASS_VAL 1
++ struct mt7996_dev *dev = phy->dev;
++ struct {
++ u8 _rsv[4];
++
++ u16 tag;
++ u16 len;
++
++ u8 action;
++ u8 band_idx;
++ u8 smthintbypass;
++ u8 __rsv2[5];
++ } __packed data = {
++ .tag = cpu_to_le16(BF_CFG_PHY),
++ .len = cpu_to_le16(sizeof(data) - 4),
++ .action = BF_PHY_SMTH_INT_BYPASS,
++ .band_idx = phy->mt76->band_idx,
++ .smthintbypass = val,
++ };
++
++ if (val != BYPASS_VAL)
++ return -EINVAL;
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(BF), &data, sizeof(data),
++ true);
++}
++
+ #endif
+diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
+index 27d6a05b..d9686ebb 100644
+--- a/mt7996/mtk_mcu.h
++++ b/mt7996/mtk_mcu.h
+@@ -119,6 +119,20 @@ enum {
+ EDCCA_FCC = 1,
+ EDCCA_ETSI = 2,
+ EDCCA_JAPAN = 3
++};
++
++enum {
++ UNI_CMD_MURU_SUTX_CTRL = 0x10,
++ UNI_CMD_MURU_FIXED_RATE_CTRL,
++ UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL,
++ UNI_CMD_MURU_SET_FORCE_MU = 0x33,
++ UNI_CMD_MURU_MUNUAL_CONFIG = 0x64,
++ UNI_CMD_MURU_SET_MUDL_ACK_POLICY = 0xC9,
++ UNI_CMD_MURU_SET_TRIG_TYPE,
++ UNI_CMD_MURU_SET_20M_DYN_ALGO,
++ UNI_CMD_MURU_PROT_FRAME_THR = 0xCC,
++ UNI_CMD_MURU_SET_CERT_MU_EDCA_OVERRIDE,
++};
+
+ struct bf_pfmu_tag {
+ __le16 tag;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0044-mtk-wifi-mt76-mt7996-add-cert-patch.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0049-mtk-mt76-mt7996-add-cert-patch.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0044-mtk-wifi-mt76-mt7996-add-cert-patch.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0049-mtk-mt76-mt7996-add-cert-patch.patch
index cdb3a91..9a2f167 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0044-mtk-wifi-mt76-mt7996-add-cert-patch.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0049-mtk-mt76-mt7996-add-cert-patch.patch
@@ -1,7 +1,7 @@
-From c9230b110a7c2db2d8863499d7a1d72b9fc74cad Mon Sep 17 00:00:00 2001
+From 737ee81737fcefd3abbab0bb628fa9db193b1b34 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Mon, 14 Aug 2023 13:36:58 +0800
-Subject: [PATCH 044/116] mtk: wifi: mt76: mt7996: add cert patch
+Subject: [PATCH 049/199] mtk: mt76: mt7996: add cert patch
This patch includes TGac and TGax
@@ -9,21 +9,39 @@
Add vendor cmd set ap wireless rts_sigta support
+In Wi-Fi 7 UCC, there are a command without a specified interface,
+causing the AP to send trigger frames on only one link. When testing
+EMLSR+OFDMA test cases (EHT-4.45.1), this results in the AP sending
+trigger frames on only one link, leading to test failure.
+Therefore, the band_bitmap is corrected to ensure that trigger frames are sent on all links.
+
+The UCC command specifies an interface:
+ap_set_rfeature,NAME,Wi-Fi7APUT,Interface,5G,type,EHT,TriggerType,0,
+Trigger_Variant,HE,PPDUTxType,legacy
+
+The UCC command does not specify an interface:
+ap_set_rfeature,NAME,Wi-Fi7APUT,type,EHT,TriggerType,0,Trigger_Variant,
+EHT,PPDUTxType,legacy
+
+Logan set the band_bitmap to 7 in Wi-Fi 7 regardless of whether the UCC
+command specifies an interface.
+
Signed-off-by: ye he <ye.he@mediatek.com>
+Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
---
mt7996/mac.c | 9 ++
mt7996/main.c | 31 ++++++-
mt7996/mcu.c | 40 +++++++++
mt7996/mcu.h | 6 ++
mt7996/mt7996.h | 13 +++
- mt7996/mtk_mcu.c | 205 ++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_mcu.c | 206 ++++++++++++++++++++++++++++++++++++++++++
mt7996/mtk_mcu.h | 184 +++++++++++++++++++++++++++++++++++--
mt7996/vendor.c | 230 ++++++++++++++++++++++++++++++++++++++++++++++-
mt7996/vendor.h | 67 ++++++++++++++
- 9 files changed, 778 insertions(+), 7 deletions(-)
+ 9 files changed, 779 insertions(+), 7 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 18616fd..70f0c56 100644
+index 63408421..90e8e7b1 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -10,6 +10,7 @@
@@ -50,10 +68,10 @@
{
struct mt7996_dev *dev = container_of(work, struct mt7996_dev, rc_work);
diff --git a/mt7996/main.c b/mt7996/main.c
-index 92b2834..8e67616 100644
+index f7819a85..39318595 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -613,6 +613,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -617,6 +617,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
bool beacon, bool mcast)
{
struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
@@ -61,7 +79,7 @@
struct mt76_phy *mphy = hw->priv;
u16 rate;
u8 i, idx;
-@@ -622,6 +623,9 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -626,6 +627,9 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (beacon) {
struct mt7996_phy *phy = mphy->priv;
@@ -71,7 +89,7 @@
/* odd index for driver, even index for firmware */
idx = MT7996_BEACON_RATES_TBL + 2 * phy->mt76->band_idx;
if (phy->beacon_rate != rate)
-@@ -749,6 +753,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -753,6 +757,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
u8 band_idx = mvif->phy->mt76->band_idx;
int ret, idx;
@@ -82,7 +100,7 @@
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
if (idx < 0)
return -ENOSPC;
-@@ -774,7 +782,28 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -778,7 +786,28 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (ret)
return ret;
@@ -113,7 +131,7 @@
void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index d39a73f..423d918 100644
+index c47dee02..ae894ac9 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1352,6 +1352,10 @@ mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
@@ -137,7 +155,7 @@
}
static void
-@@ -4440,6 +4447,27 @@ int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val)
+@@ -4443,6 +4450,27 @@ int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val)
&req, sizeof(req), true);
}
@@ -165,27 +183,27 @@
int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable)
{
struct {
-@@ -5007,6 +5035,18 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+@@ -5010,6 +5038,18 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
val = FIELD_GET(RATE_CFG_VAL, *((u32 *)data));
switch (mode) {
+ case RATE_PARAM_FIXED_OFDMA:
+ if (val == 3)
-+ phy->muru_onoff = OFDMA_DL;
++ phy->muru_onoff |= OFDMA_DL;
+ else
-+ phy->muru_onoff = val;
++ phy->muru_onoff |= val;
+ break;
+ case RATE_PARAM_FIXED_MIMO:
+ if (val == 0)
-+ phy->muru_onoff = MUMIMO_DL_CERT | MUMIMO_DL;
++ phy->muru_onoff |= MUMIMO_DL_CERT | MUMIMO_DL;
+ else
-+ phy->muru_onoff = MUMIMO_UL;
++ phy->muru_onoff |= MUMIMO_UL;
+ break;
case RATE_PARAM_AUTO_MU:
if (val < 0 || val > 15) {
printk("Wrong value! The value is between 0-15.\n");
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 848c85d..8061638 100644
+index a98b174e..2546354e 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -755,6 +755,8 @@ enum {
@@ -221,7 +239,7 @@
enum {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 205a3c7..30ceb00 100644
+index 45ce7db7..00d7991b 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -354,6 +354,7 @@ struct mt7996_phy {
@@ -273,10 +291,10 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index 6865062..b67d366 100644
+index 68650623..30da79f4 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
-@@ -982,4 +982,209 @@ int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
+@@ -982,4 +982,210 @@ int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
true);
}
@@ -305,7 +323,8 @@
+ .trigger_type = cpu_to_le32(trig_type),
+ .trigger_flow = trig_flow,
+ .ext_cmd_bsrp = ext_cmd,
-+ .band_bitmap = BIT(phy->mt76->band_idx),
++ .band_bitmap = mt7996_band_valid(dev, MT_BAND2) ?
++ GENMASK(2, 0) : GENMASK(1, 0),
+ };
+
+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req,
@@ -487,7 +506,7 @@
+
#endif
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index d9686eb..7a4140b 100644
+index d9686ebb..7a4140b5 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -122,14 +122,15 @@ enum {
@@ -692,7 +711,7 @@
#endif
diff --git a/mt7996/vendor.c b/mt7996/vendor.c
-index 0d6fa77..7ab6447 100644
+index 0d6fa779..7ab64471 100644
--- a/mt7996/vendor.c
+++ b/mt7996/vendor.c
@@ -10,10 +10,31 @@
@@ -992,7 +1011,7 @@
}
+#endif
diff --git a/mt7996/vendor.h b/mt7996/vendor.h
-index 8aaa18e..2ee1339 100644
+index 8aaa18ee..2ee1339a 100644
--- a/mt7996/vendor.h
+++ b/mt7996/vendor.h
@@ -3,8 +3,12 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0045-mtk-wifi-mt76-testmode-add-testmode-bf-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0050-mtk-mt76-mt7996-add-testmode-bf-support.patch
similarity index 97%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0045-mtk-wifi-mt76-testmode-add-testmode-bf-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0050-mtk-mt76-mt7996-add-testmode-bf-support.patch
index fc0ff2e..0ea2133 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0045-mtk-wifi-mt76-testmode-add-testmode-bf-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0050-mtk-mt76-mt7996-add-testmode-bf-support.patch
@@ -1,26 +1,18 @@
-From 822d3687ba4c131b1850a06116ee39e5ebc3767c Mon Sep 17 00:00:00 2001
+From 9d99ad5cd521b8cc92e3fd1d48803cb5b211e281 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 6 Apr 2023 16:40:28 +0800
-Subject: [PATCH 045/116] mtk: wifi: mt76: testmode: add testmode bf support
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Subject: [PATCH 050/199] mtk: mt76: mt7996: add testmode bf support
Add iTest additional bf command
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
fw return Gx (5g band) ibf cal struct for both 2G and 5G ibf.
Therefore, memcpy cannot be used for 2G ibf cal.
https://gerrit.mediatek.inc/c/neptune/wlan_driver/logan/+/8206056
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: testmode: add testmode ibf ver2 support
Add ibf ver2 support for chips after Kite
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: testmode: add testmode ibf 5T5R support
Add testmode ibf 5T5R support for Kite BE7200 2i5i
@@ -44,10 +36,10 @@
14 files changed, 1576 insertions(+), 59 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 0cc6e53..8b17dfb 100644
+index 0cf5d573..36e8834e 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -757,6 +757,11 @@ struct mt76_testmode_data {
+@@ -760,6 +760,11 @@ struct mt76_testmode_data {
u32 tx_time;
u32 tx_ipg;
@@ -60,7 +52,7 @@
bool ebf;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 7f2daf7..61a14a8 100644
+index 726f5e9d..6be7e6a6 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -488,7 +488,8 @@ struct sta_rec_bf {
@@ -73,7 +65,7 @@
} __packed;
struct sta_rec_bfee {
-@@ -1281,6 +1282,7 @@ enum {
+@@ -1291,6 +1292,7 @@ enum {
MCU_UNI_CMD_VOW = 0x37,
MCU_UNI_CMD_PP = 0x38,
MCU_UNI_CMD_FIXED_RATE_TABLE = 0x40,
@@ -82,7 +74,7 @@
MCU_UNI_CMD_PRECAL_RESULT = 0x47,
MCU_UNI_CMD_RRO = 0x57,
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 423d918..18d8f4d 100644
+index ae894ac9..43604ebc 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1073,7 +1073,12 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
@@ -99,7 +91,7 @@
return 0;
}
-@@ -4097,7 +4102,6 @@ int mt7996_mcu_set_ser(struct mt7996_dev *dev, u8 action, u8 val, u8 band)
+@@ -4100,7 +4105,6 @@ int mt7996_mcu_set_ser(struct mt7996_dev *dev, u8 action, u8 val, u8 band)
int mt7996_mcu_set_txbf(struct mt7996_dev *dev, u8 action)
{
#define MT7996_BF_MAX_SIZE sizeof(union bf_tag_tlv)
@@ -108,7 +100,7 @@
struct sk_buff *skb;
struct tlv *tlv;
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 8061638..6631281 100644
+index 2546354e..c6bb93b3 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -685,6 +685,22 @@ struct bf_sounding_on {
@@ -179,7 +171,7 @@
CMD_BAND_NONE,
CMD_BAND_24G,
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 30ceb00..84fbd0f 100644
+index 00d7991b..1b774f5e 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -486,6 +486,14 @@ struct mt7996_dev {
@@ -220,10 +212,10 @@
+
#endif
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index b7fef1b..c1b665f 100644
+index 0e029d5d..05cfc6ab 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -2958,7 +2958,7 @@ mt7996_starec_bf_read_set(void *data, u64 wlan_idx)
+@@ -2917,7 +2917,7 @@ mt7996_starec_bf_read_set(void *data, u64 wlan_idx)
{
struct mt7996_phy *phy = data;
@@ -232,7 +224,7 @@
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_starec_bf_read, NULL,
mt7996_starec_bf_read_set, "%lld\n");
-@@ -3002,7 +3002,7 @@ mt7996_bf_fbk_rpt_set(void *data, u64 wlan_idx)
+@@ -2961,7 +2961,7 @@ mt7996_bf_fbk_rpt_set(void *data, u64 wlan_idx)
{
struct mt7996_phy *phy = data;
@@ -241,7 +233,7 @@
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_bf_fbk_rpt, NULL,
mt7996_bf_fbk_rpt_set, "%lld\n");
-@@ -3012,7 +3012,7 @@ mt7996_bf_pfmu_tag_read_set(void *data, u64 wlan_idx)
+@@ -2971,7 +2971,7 @@ mt7996_bf_pfmu_tag_read_set(void *data, u64 wlan_idx)
{
struct mt7996_phy *phy = data;
@@ -251,7 +243,7 @@
DEFINE_DEBUGFS_ATTRIBUTE(fops_bf_pfmu_tag_read, NULL,
mt7996_bf_pfmu_tag_read_set, "%lld\n");
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index b67d366..a9a7db1 100644
+index 30da79f4..b46a66bb 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
@@ -295,7 +295,7 @@ __mt7996_mcu_add_uni_tlv(struct sk_buff *skb, u16 tag, u16 len)
@@ -441,7 +433,7 @@
dev_info(dev->mt76.dev, "%s: unknown bf event tag %d\n",
__func__, event->tag);
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index 7a4140b..58d61c5 100644
+index 7a4140b5..58d61c51 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -189,6 +189,165 @@ struct bf_txsnd_info {
@@ -907,7 +899,7 @@
__le16 wlan_idx0;
__le16 wlan_idx1;
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index 8ec1dc1..263737c 100644
+index 8ec1dc1c..263737c5 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -326,6 +326,9 @@ enum offs_rev {
@@ -921,7 +913,7 @@
#define MT_WF_RMAC_BASE(_band) __BASE(WF_RMAC_BASE, (_band))
#define MT_WF_RMAC(_band, ofs) (MT_WF_RMAC_BASE(_band) + (ofs))
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index 836211f..5cec1ee 100644
+index 836211f9..5cec1eef 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -23,6 +23,7 @@ enum {
@@ -1814,7 +1806,7 @@
static int
diff --git a/mt7996/testmode.h b/mt7996/testmode.h
-index 78662b2..f97ccb2 100644
+index 78662b2e..f97ccb26 100644
--- a/mt7996/testmode.h
+++ b/mt7996/testmode.h
@@ -27,6 +27,17 @@ enum {
@@ -1857,7 +1849,7 @@
__le32 func_data;
u8 band_idx;
diff --git a/testmode.c b/testmode.c
-index 69147f8..b9f7109 100644
+index 69147f86..b9f71097 100644
--- a/testmode.c
+++ b/testmode.c
@@ -462,6 +462,44 @@ out:
@@ -1937,7 +1929,7 @@
err = dev->test_ops->set_params(phy, tb, state);
if (err)
diff --git a/testmode.h b/testmode.h
-index 5d677f8..bda7624 100644
+index 5d677f8c..bda7624a 100644
--- a/testmode.h
+++ b/testmode.h
@@ -286,6 +286,59 @@ enum mt76_testmode_eeprom_action {
@@ -2001,7 +1993,7 @@
#endif
diff --git a/tools/fields.c b/tools/fields.c
-index 77696ce..f793d1a 100644
+index 77696ce7..f793d1a5 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -44,6 +44,30 @@ static const char * const testmode_offchan_bw[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0046-mtk-wifi-mt76-mt7996-add-zwdfs-cert-mode.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0051-mtk-mt76-mt7996-add-zwdfs-cert-mode.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0046-mtk-wifi-mt76-mt7996-add-zwdfs-cert-mode.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0051-mtk-mt76-mt7996-add-zwdfs-cert-mode.patch
index 9088f6e..37a4316 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0046-mtk-wifi-mt76-mt7996-add-zwdfs-cert-mode.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0051-mtk-mt76-mt7996-add-zwdfs-cert-mode.patch
@@ -1,7 +1,7 @@
-From f0bff585456e12c9b5e5b0e5cc33bf920d8cb6d0 Mon Sep 17 00:00:00 2001
+From 65c9dfe452ee272a2d9c1005cde421def099e478 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 22 Sep 2023 12:33:06 +0800
-Subject: [PATCH 046/116] mtk: wifi: mt76: mt7996: add zwdfs cert mode
+Subject: [PATCH 051/199] mtk: mt76: mt7996: add zwdfs cert mode
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -13,10 +13,10 @@
5 files changed, 100 insertions(+), 12 deletions(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 18d8f4d..d46c5ae 100644
+index 43604ebc..0db30af9 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -4496,18 +4496,7 @@ int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable)
+@@ -4499,18 +4499,7 @@ int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable)
int mt7996_mcu_rdd_cmd(struct mt7996_dev *dev, int cmd, u8 index,
u8 rx_sel, u8 val)
{
@@ -36,7 +36,7 @@
.tag = cpu_to_le16(UNI_RDD_CTRL_PARM),
.len = cpu_to_le16(sizeof(req) - 4),
.ctrl = cmd,
-@@ -4520,6 +4509,37 @@ int mt7996_mcu_rdd_cmd(struct mt7996_dev *dev, int cmd, u8 index,
+@@ -4523,6 +4512,37 @@ int mt7996_mcu_rdd_cmd(struct mt7996_dev *dev, int cmd, u8 index,
&req, sizeof(req), true);
}
@@ -75,7 +75,7 @@
struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 6631281..f5e91a8 100644
+index c6bb93b3..3025f849 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -119,6 +119,20 @@ struct mt7996_mcu_rdd_report {
@@ -100,7 +100,7 @@
u8 _rsv[4];
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 84fbd0f..7f7a622 100644
+index 1b774f5e..5cdc42bf 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -523,8 +523,11 @@ enum mt7996_rdd_cmd {
@@ -125,7 +125,7 @@
struct cfg80211_chan_def *chandef);
int mt7996_mcu_set_fixed_rate_table(struct mt7996_phy *phy, u8 table_idx,
diff --git a/mt7996/vendor.c b/mt7996/vendor.c
-index 7ab6447..ba00ef3 100644
+index 7ab64471..ba00ef35 100644
--- a/mt7996/vendor.c
+++ b/mt7996/vendor.c
@@ -108,6 +108,11 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
@@ -187,7 +187,7 @@
void mt7996_vendor_register(struct mt7996_phy *phy)
diff --git a/mt7996/vendor.h b/mt7996/vendor.h
-index 2ee1339..7c812f9 100644
+index 2ee1339a..7c812f91 100644
--- a/mt7996/vendor.h
+++ b/mt7996/vendor.h
@@ -14,6 +14,7 @@ enum mtk_nl80211_vendor_subcmds {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0047-mtk-wifi-mt76-testmode-add-channel-68-96.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0052-mtk-mt76-mt7996-add-channel-68-96.patch
similarity index 89%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0047-mtk-wifi-mt76-testmode-add-channel-68-96.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0052-mtk-mt76-mt7996-add-channel-68-96.patch
index 309f186..df5e1bf 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0047-mtk-wifi-mt76-testmode-add-channel-68-96.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0052-mtk-mt76-mt7996-add-channel-68-96.patch
@@ -1,19 +1,8 @@
-From 2904eb321441ee487d4438fdc46efe3d8032e74f Mon Sep 17 00:00:00 2001
+From 6c7bf3990d1a6ff13007178a2624e55fbaf6d823 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 11 Sep 2023 14:43:07 +0800
-Subject: [PATCH 047/116] mtk: wifi: mt76: testmode: add channel 68 & 96
+Subject: [PATCH 052/199] mtk: mt76: mt7996: add channel 68 & 96
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
-Add all the channel between 68 & 96 since ibf 5g channel group 3 will use channel 84.
-Also, "mtk: wifi: mt76: testmode: add channel 68 & 96" can be
-merged into to "mtk: wifi: mt76: testmode: add basic testmode support"
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
-Fix 5g channel list size
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
mac80211.c | 9 +++++++++
mt7996/eeprom.c | 49 +++++++++++++++++++++++++++++++++++++++++++++--
@@ -24,7 +13,7 @@
6 files changed, 82 insertions(+), 9 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index 93e5c50..de0a398 100644
+index 5b02fa35..6a5201f6 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -34,6 +34,15 @@ static const struct ieee80211_channel mt76_channels_5ghz[] = {
@@ -44,7 +33,7 @@
CHAN5G(104, 5520),
CHAN5G(108, 5540),
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index f97d76c..acf5bc1 100644
+index f4641321..8a0f6d39 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -18,6 +18,17 @@ const struct ieee80211_channel dpd_2g_ch_list_bw20[] = {
@@ -125,7 +114,7 @@
{
struct mt76_dev *mdev = &dev->mt76;
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 03a4fd0..9a15b44 100644
+index 03a4fd07..9a15b446 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -67,6 +67,8 @@ enum mt7996_eeprom_field {
@@ -138,10 +127,10 @@
extern const u32 dpd_5g_bw160_ch_num;
extern const struct ieee80211_channel dpd_6g_ch_list_bw160[];
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index d46c5ae..6f08161 100644
+index 0db30af9..cf94d39c 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3766,7 +3766,8 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3769,7 +3769,8 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
chan_list_size = mphy->sband_5g.sband.n_channels;
base_offset += dpd_size_2g;
if (bw == NL80211_CHAN_WIDTH_160) {
@@ -151,7 +140,7 @@
per_chan_size = DPD_PER_CH_GT_BW20_SIZE;
cal_id = RF_DPD_FLAT_5G_MEM_CAL;
chan_list = dpd_5g_ch_list_bw160;
-@@ -3775,6 +3776,9 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3778,6 +3779,9 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
/* apply (center channel - 2)'s dpd cal data for bw 40/80 channels */
channel -= 2;
}
@@ -161,7 +150,7 @@
break;
case NL80211_BAND_6GHZ:
dpd_mask = MT_EE_WIFI_CAL_DPD_6G;
-@@ -3814,6 +3818,10 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3817,6 +3821,10 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
if (idx == chan_list_size)
return -EINVAL;
@@ -173,7 +162,7 @@
for (i = 0; i < per_chan_size / MT_EE_CAL_UNIT; i++) {
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index 5cec1ee..95d3bde 100644
+index 5cec1eef..95d3bde0 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -531,6 +531,11 @@ mt7996_tm_dpd_prek_send_req(struct mt7996_phy *phy, struct mt7996_tm_req *req,
@@ -227,7 +216,7 @@
return first_control + offset;
diff --git a/mt7996/testmode.h b/mt7996/testmode.h
-index f97ccb2..ba1767a 100644
+index f97ccb26..ba1767ae 100644
--- a/mt7996/testmode.h
+++ b/mt7996/testmode.h
@@ -38,9 +38,9 @@ enum {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0048-mtk-wifi-mt76-testmode-add-kite-testmode-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0053-mtk-mt76-mt7996-add-kite-testmode-support.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0048-mtk-wifi-mt76-testmode-add-kite-testmode-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0053-mtk-mt76-mt7996-add-kite-testmode-support.patch
index ef91f55..febce5f 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0048-mtk-wifi-mt76-testmode-add-kite-testmode-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0053-mtk-mt76-mt7996-add-kite-testmode-support.patch
@@ -1,7 +1,7 @@
-From 85865dc300bbe3bc8ef98907a145e8a9875858af Mon Sep 17 00:00:00 2001
+From 4c17654079c3618e0e0e480d54f305c4460b3af4 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 12 Oct 2023 16:17:33 +0800
-Subject: [PATCH 048/116] mtk: wifi: mt76: testmode: add kite testmode support
+Subject: [PATCH 053/199] mtk: mt76: mt7996: add kite testmode support
Add Kite testmode support
1. avoid entering connac 2 testmode flow in kite
@@ -14,11 +14,11 @@
mt7996/mcu.c | 48 ++++++++++++++---------
mt7996/mt7996.h | 18 ++++++++-
mt7996/testmode.c | 97 ++++++++++++++++++++++++++++-------------------
- testmode.c | 11 ++++--
- 6 files changed, 198 insertions(+), 120 deletions(-)
+ testmode.c | 17 ++++++---
+ 6 files changed, 202 insertions(+), 122 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index acf5bc1..215d81e 100644
+index 8a0f6d39..0d50d313 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -29,12 +29,39 @@ const struct ieee80211_channel dpd_5g_skip_ch_list[] = {
@@ -112,7 +112,7 @@
mt7996_eeprom_load_bin(struct mt7996_dev *dev)
{
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index 9a15b44..fa9c31e 100644
+index 9a15b446..fa9c31e7 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -45,36 +45,69 @@ enum mt7996_eeprom_field {
@@ -210,10 +210,10 @@
#define RF_DPD_FLAT_CAL BIT(28)
#define RF_PRE_CAL BIT(29)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 6f08161..528bce8 100644
+index cf94d39c..3a7f9df8 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3735,13 +3735,11 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3738,13 +3738,11 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
enum nl80211_chan_width bw = chandef->width;
const struct ieee80211_channel *chan_list;
u32 cal_id, chan_list_size, base_offset = 0, offs = MT_EE_DO_PRE_CAL;
@@ -229,7 +229,7 @@
switch (band) {
case NL80211_BAND_2GHZ:
-@@ -3757,27 +3755,35 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3760,27 +3758,35 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
return 0;
cal_id = RF_DPD_FLAT_CAL;
chan_list = dpd_2g_ch_list_bw20;
@@ -271,7 +271,7 @@
return 0;
break;
case NL80211_BAND_6GHZ:
-@@ -3785,20 +3791,27 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3788,20 +3794,27 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
cal_id = RF_DPD_FLAT_6G_CAL;
chan_list = mphy->sband_6g.sband.channels;
chan_list_size = mphy->sband_6g.sband.n_channels;
@@ -304,7 +304,7 @@
} else if (bw > NL80211_CHAN_WIDTH_20) {
/* apply (center channel - 2)'s dpd cal data for bw 40/80 channels */
channel -= 2;
-@@ -3818,9 +3831,8 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
+@@ -3821,9 +3834,8 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy)
if (idx == chan_list_size)
return -EINVAL;
@@ -317,7 +317,7 @@
cal += MT_EE_CAL_GROUP_SIZE + base_offset + idx * per_chan_size;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 7f7a622..0ebeb24 100644
+index 5cdc42bf..516129b0 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -194,6 +194,19 @@ struct mt7996_twt_flow {
@@ -360,7 +360,7 @@
void mt7996_dma_reset(struct mt7996_dev *dev, bool force);
void mt7996_dma_prefetch(struct mt7996_dev *dev);
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index 95d3bde..9fa4edc 100644
+index 95d3bde0..9fa4edcd 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -434,7 +434,7 @@ mt7996_tm_set_tx_cont(struct mt7996_phy *phy, bool en)
@@ -550,7 +550,7 @@
cal_idx = le32_to_cpu(data->cal_idx);
cal_type = le32_to_cpu(data->cal_type);
diff --git a/testmode.c b/testmode.c
-index b9f7109..2dd184e 100644
+index b9f71097..f1d162ce 100644
--- a/testmode.c
+++ b/testmode.c
@@ -37,6 +37,11 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
@@ -592,6 +592,21 @@
dev->test_ops->tx_stop(phy);
return;
}
+@@ -783,10 +788,12 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
+ if (nla_put_u32(msg, MT76_TM_ATTR_STATE, td->state))
+ goto out;
+
++ if (nla_put_u8(msg, MT76_TM_ATTR_BAND_IDX, phy->band_idx))
++ goto out;
++
+ if (dev->test_mtd.name &&
+ (nla_put_string(msg, MT76_TM_ATTR_MTD_PART, dev->test_mtd.name) ||
+- nla_put_u32(msg, MT76_TM_ATTR_MTD_OFFSET, dev->test_mtd.offset) ||
+- nla_put_u8(msg, MT76_TM_ATTR_BAND_IDX, phy->band_idx)))
++ nla_put_u32(msg, MT76_TM_ATTR_MTD_OFFSET, dev->test_mtd.offset)))
+ goto out;
+
+ if (nla_put_u32(msg, MT76_TM_ATTR_TX_COUNT, td->tx_count) ||
--
2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0049-mtk-wifi-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0054-mtk-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for-CERT.patch
similarity index 81%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0049-mtk-wifi-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0054-mtk-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for-CERT.patch
index 5145ced..15588fe 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0049-mtk-wifi-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0054-mtk-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for-CERT.patch
@@ -1,8 +1,8 @@
-From 6eb483091a4f12b40d201fb2a896a0499ea41100 Mon Sep 17 00:00:00 2001
+From 3c7126f27c9a7a68514c4eb134203576db47cd82 Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Tue, 14 Nov 2023 11:27:06 +0800
-Subject: [PATCH 049/116] mtk: wifi: mt76: mt7996: assign DEAUTH to ALTX queue
- for CERT
+Subject: [PATCH 054/199] mtk: mt76: mt7996: assign DEAUTH to ALTX queue for
+ CERT
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
---
@@ -10,10 +10,10 @@
1 file changed, 10 insertions(+)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 70f0c56..727d1fb 100644
+index 90e8e7b1..bcddff23 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -753,6 +753,8 @@ static void
+@@ -747,6 +747,8 @@ static void
mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct ieee80211_key_conf *key)
{
@@ -22,7 +22,7 @@
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-@@ -762,6 +764,14 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+@@ -756,6 +758,14 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
u8 fc_type, fc_stype;
u32 val;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0050-mtk-wifi-mt76-mt7996-add-no_beacon-vendor-command-fo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0055-mtk-mt76-mt7996-add-no_beacon-vendor-command-for-cer.patch
similarity index 92%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0050-mtk-wifi-mt76-mt7996-add-no_beacon-vendor-command-fo.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0055-mtk-mt76-mt7996-add-no_beacon-vendor-command-for-cer.patch
index bc472fd..6741fd5 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0050-mtk-wifi-mt76-mt7996-add-no_beacon-vendor-command-fo.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0055-mtk-mt76-mt7996-add-no_beacon-vendor-command-for-cer.patch
@@ -1,8 +1,8 @@
-From 2fadd891ed50fdb0ba643748abec7d576ff65945 Mon Sep 17 00:00:00 2001
+From 04adadf07c93529a7b3b0c5e5bccd6bc99c97d8f Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 22 Nov 2023 22:42:09 +0800
-Subject: [PATCH 050/116] mtk: wifi: mt76: mt7996: add no_beacon vendor command
- for cert
+Subject: [PATCH 055/199] mtk: mt76: mt7996: add no_beacon vendor command for
+ cert
Add the vendor command to disable/enable beacon
@@ -21,10 +21,10 @@
4 files changed, 65 insertions(+)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 528bce8..b5c6638 100644
+index 3a7f9df8..7b520a90 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -5100,4 +5100,15 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+@@ -5103,4 +5103,15 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
break;
}
}
@@ -41,7 +41,7 @@
+}
#endif
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 0ebeb24..1bba545 100644
+index 516129b0..34886128 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -835,6 +835,7 @@ void mt7996_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en);
@@ -53,7 +53,7 @@
int mt7996_mcu_edcca_enable(struct mt7996_phy *phy, bool enable);
diff --git a/mt7996/vendor.c b/mt7996/vendor.c
-index ba00ef3..31688c3 100644
+index ba00ef35..31688c37 100644
--- a/mt7996/vendor.c
+++ b/mt7996/vendor.c
@@ -113,6 +113,11 @@ background_radar_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BACKGROUND_RADAR_CTRL] = {
@@ -119,7 +119,7 @@
void mt7996_vendor_register(struct mt7996_phy *phy)
diff --git a/mt7996/vendor.h b/mt7996/vendor.h
-index 7c812f9..0d1ef32 100644
+index 7c812f91..0d1ef322 100644
--- a/mt7996/vendor.h
+++ b/mt7996/vendor.h
@@ -16,6 +16,7 @@ enum mtk_nl80211_vendor_subcmds {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0051-mtk-wifi-mt76-mt7996-add-adie-efuse-merge-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0056-mtk-mt76-mt7996-add-adie-efuse-merge-support.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0051-mtk-wifi-mt76-mt7996-add-adie-efuse-merge-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0056-mtk-mt76-mt7996-add-adie-efuse-merge-support.patch
index 4403909..bc5a4a9 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0051-mtk-wifi-mt76-mt7996-add-adie-efuse-merge-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0056-mtk-mt76-mt7996-add-adie-efuse-merge-support.patch
@@ -1,7 +1,7 @@
-From 571a367ee2ab7e447b7126bb05f778ec4ffdb3d0 Mon Sep 17 00:00:00 2001
+From 81d008c8fcfaa851414ee63242d9ea4c0eb888df Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 24 Nov 2023 09:49:08 +0800
-Subject: [PATCH 051/116] mtk: wifi: mt76: mt7996: add adie efuse merge support
+Subject: [PATCH 056/199] mtk: mt76: mt7996: add adie efuse merge support
Merge adie-dependent parameters in efuse into eeprom after FT.
Note that Eagle BE14000 is not considered yet.
@@ -16,10 +16,10 @@
4 files changed, 195 insertions(+), 4 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 3074202..f3a520b 100644
+index 1f4bad62..58879695 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
-@@ -894,6 +894,46 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_muru_disable,
+@@ -881,6 +881,46 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_muru_disable,
mt7996_fw_debug_muru_disable_get,
mt7996_fw_debug_muru_disable_set, "%lld\n");
@@ -66,7 +66,7 @@
int mt7996_init_debugfs(struct mt7996_phy *phy)
{
struct mt7996_dev *dev = phy->dev;
-@@ -920,6 +960,7 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
+@@ -907,6 +947,7 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
mt7996_twt_stats);
debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
@@ -75,7 +75,7 @@
if (phy->mt76->cap.has_5ghz) {
debugfs_create_u32("dfs_hw_pattern", 0400, dir,
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 215d81e..3cdd585 100644
+index 0d50d313..8cdd6d96 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
@@ -496,6 +496,146 @@ static int mt7996_eeprom_load_precal(struct mt7996_dev *dev)
@@ -237,10 +237,10 @@
if (ret < 0)
return ret;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index b5c6638..1a904e4 100644
+index 7b520a90..1c98d179 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3606,7 +3606,7 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf)
+@@ -3609,7 +3609,7 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf)
};
struct sk_buff *skb;
bool valid;
@@ -249,7 +249,7 @@
u8 *buf = read_buf;
ret = mt76_mcu_send_and_get_msg(&dev->mt76,
-@@ -3624,11 +3624,13 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf)
+@@ -3627,11 +3627,13 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf)
skb_pull(skb, 48);
memcpy(buf, skb->data, MT7996_EEPROM_BLOCK_SIZE);
@@ -265,7 +265,7 @@
int mt7996_mcu_get_eeprom_free_block(struct mt7996_dev *dev, u8 *block_num)
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index 9fa4edc..784a8be 100644
+index 9fa4edcd..784a8bea 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -2116,8 +2116,12 @@ mt7996_tm_write_back_to_efuse(struct mt7996_dev *dev)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0052-mtk-wifi-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0057-mtk-mt76-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch
similarity index 79%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0052-mtk-wifi-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0057-mtk-mt76-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch
index 1ab4d7d..98b83ee 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0052-mtk-wifi-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0057-mtk-mt76-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch
@@ -1,40 +1,41 @@
-From eafc607f276a54844224670c0fff6b92ebe5af09 Mon Sep 17 00:00:00 2001
+From 0a01643db7a700b8d78b3a1b33944bcf0fb4185d Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 5 Dec 2023 16:48:33 +0800
-Subject: [PATCH 052/116] mtk: wifi: mt7996: add Eagle 2adie TBTC (BE14000)
+Subject: [PATCH 057/199] mtk: mt76: mt7996: add Eagle 2adie TBTC (BE14000)
support
Add fwdl/default eeprom load support for Eagle 2 adie TBTC
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
Add Eagle 2adie TBTC efuse merge
Add Eagle 2adie TBTC group prek size
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
- mt7996/eeprom.c | 8 ++++++--
+ mt7996/eeprom.c | 11 +++++++++--
mt7996/eeprom.h | 12 ++++++++++++
- mt7996/init.c | 6 ++++++
+ mt7996/init.c | 5 +++++
mt7996/mcu.c | 5 +++++
- mt7996/mt7996.h | 8 ++++++++
+ mt7996/mt7996.h | 9 +++++++++
mt7996/regs.h | 1 +
- 6 files changed, 38 insertions(+), 2 deletions(-)
+ 6 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 3cdd585..5eb8629 100644
+index 8cdd6d96..fb4d031f 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
-@@ -158,6 +158,8 @@ const char *mt7996_eeprom_name(struct mt7996_dev *dev)
+@@ -158,6 +158,11 @@ const char *mt7996_eeprom_name(struct mt7996_dev *dev)
case 0x7990:
if (dev->chip_sku == MT7996_SKU_404)
return MT7996_EEPROM_DEFAULT_404;
++ else if (dev->chip_sku == MT7996_SKU_233 &&
++ dev->fem_type == MT7996_FEM_INT)
++ return MT7996_EEPROM_DEFAULT_233_INT;
+ else if (dev->chip_sku == MT7996_SKU_233)
+ return MT7996_EEPROM_DEFAULT_233;
if (dev->fem_type == MT7996_FEM_INT)
return MT7996_EEPROM_DEFAULT_INT;
-@@ -450,6 +452,8 @@ static void mt7996_eeprom_init_precal(struct mt7996_dev *dev)
+@@ -450,6 +455,8 @@ static void mt7996_eeprom_init_precal(struct mt7996_dev *dev)
switch (mt76_chip(&dev->mt76)) {
case 0x7990:
dev->prek.rev = mt7996_prek_rev;
@@ -43,7 +44,7 @@
/* 5g & 6g bw 80 dpd channel list is not used */
dev->prek.dpd_ch_num[DPD_CH_NUM_BW320_6G] = ARRAY_SIZE(dpd_6g_ch_list_bw320);
break;
-@@ -553,7 +557,7 @@ static int mt7996_apply_cal_free_data(struct mt7996_dev *dev)
+@@ -553,7 +560,7 @@ static int mt7996_apply_cal_free_data(struct mt7996_dev *dev)
case 0x7990:
adie_base = adie_base_7996;
/* adie 0 */
@@ -52,7 +53,7 @@
adie_id = ADIE_7975;
else
adie_id = ADIE_7976;
-@@ -561,7 +565,7 @@ static int mt7996_apply_cal_free_data(struct mt7996_dev *dev)
+@@ -561,7 +568,7 @@ static int mt7996_apply_cal_free_data(struct mt7996_dev *dev)
eep_offs[0] = eep_offs_list[adie_id];
/* adie 1 */
@@ -62,7 +63,7 @@
eep_offs[1] = eep_offs_list[ADIE_7977];
}
diff --git a/mt7996/eeprom.h b/mt7996/eeprom.h
-index fa9c31e..43c9783 100644
+index fa9c31e7..43c9783c 100644
--- a/mt7996/eeprom.h
+++ b/mt7996/eeprom.h
@@ -70,6 +70,18 @@ static const u32 mt7996_prek_rev[] = {
@@ -85,24 +86,23 @@
static const u32 mt7992_prek_rev[] = {
[GROUP_SIZE_2G] = 4 * MT_EE_CAL_UNIT,
diff --git a/mt7996/init.c b/mt7996/init.c
-index d4b0a72..cb00322 100644
+index 0201d9fc..342f15fb 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -916,6 +916,12 @@ int mt7996_get_chip_sku(struct mt7996_dev *dev)
+@@ -918,6 +918,11 @@ int mt7996_get_chip_sku(struct mt7996_dev *dev)
switch (mt76_chip(&dev->mt76)) {
case 0x7990:
+ if (FIELD_GET(MT_PAD_GPIO_2ADIE_TBTC, val)) {
+ dev->chip_sku = MT7996_SKU_233;
-+ dev->fem_type = MT7996_FEM_INT;
-+ return 0;
++ break;
+ }
+
adie_comb = FIELD_GET(MT_PAD_GPIO_ADIE_COMB, val);
if (adie_comb <= 1)
dev->chip_sku = MT7996_SKU_444;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 1a904e4..686cdda 100644
+index 1c98d179..9bef1274 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -23,6 +23,11 @@
@@ -118,7 +118,7 @@
_fw = MT7996_##name; \
break; \
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 1bba545..72865c8 100644
+index 34886128..294818b4 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -35,6 +35,12 @@
@@ -134,15 +134,16 @@
#define MT7992_FIRMWARE_WA "mediatek/mt7996/mt7992_wa.bin"
#define MT7992_FIRMWARE_WM "mediatek/mt7996/mt7992_wm.bin"
#define MT7992_FIRMWARE_DSP "mediatek/mt7996/mt7992_dsp.bin"
-@@ -55,6 +61,7 @@
+@@ -55,6 +61,8 @@
#define MT7996_EEPROM_DEFAULT "mediatek/mt7996/mt7996_eeprom.bin"
#define MT7996_EEPROM_DEFAULT_INT "mediatek/mt7996/mt7996_eeprom_2i5i6i.bin"
+#define MT7996_EEPROM_DEFAULT_233 "mediatek/mt7996/mt7996_eeprom_233.bin"
++#define MT7996_EEPROM_DEFAULT_233_INT "mediatek/mt7996/mt7996_eeprom_233_2i5i6i.bin"
#define MT7996_EEPROM_DEFAULT_404 "mediatek/mt7996/mt7996_eeprom_dual_404.bin"
- #define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
- #define MT7992_EEPROM_DEFAULT_EXT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
-@@ -122,6 +129,7 @@ enum mt7996_fem_type {
+ #define MT7992_EEPROM_DEFAULT "mediatek/mt7996/mt7992_eeprom_2e5e.bin"
+ #define MT7992_EEPROM_DEFAULT_INT "mediatek/mt7996/mt7992_eeprom_2i5i.bin"
+@@ -122,6 +130,7 @@ enum mt7996_fem_type {
enum mt7996_sku_type {
MT7996_SKU_404,
MT7996_SKU_444,
@@ -151,7 +152,7 @@
enum mt7992_sku_type {
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index 263737c..91159c6 100644
+index 263737c5..91159c63 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -666,6 +666,7 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0053-mtk-wifi-mt76-mt7996-add-background-radar-hw-cap-che.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0058-mtk-mt76-mt7996-add-background-radar-hw-cap-check.patch
similarity index 84%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0053-mtk-wifi-mt76-mt7996-add-background-radar-hw-cap-che.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0058-mtk-mt76-mt7996-add-background-radar-hw-cap-check.patch
index 12d06e6..be8bf16 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0053-mtk-wifi-mt76-mt7996-add-background-radar-hw-cap-che.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0058-mtk-mt76-mt7996-add-background-radar-hw-cap-check.patch
@@ -1,8 +1,7 @@
-From 189d4baa960d2202e518c3e15c9959524cafc3d0 Mon Sep 17 00:00:00 2001
+From bfb5a104b7f24c396a444916d3755122b916153e Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 22 Dec 2023 17:27:10 +0800
-Subject: [PATCH 053/116] mtk: wifi: mt76: mt7996: add background radar hw cap
- check
+Subject: [PATCH 058/199] mtk: mt76: mt7996: add background radar hw cap check
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -12,7 +11,7 @@
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index f3a520b..6c5fbc7 100644
+index 58879695..6d119467 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -262,6 +262,11 @@ mt7996_rdd_monitor(struct seq_file *s, void *data)
@@ -28,10 +27,10 @@
ret = -EINVAL;
goto out;
diff --git a/mt7996/init.c b/mt7996/init.c
-index cb00322..6430bfa 100644
+index 342f15fb..ade07db7 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -404,9 +404,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -406,9 +406,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
@@ -46,10 +45,10 @@
NL80211_EXT_FEATURE_RADAR_BACKGROUND);
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 72865c8..c73701d 100644
+index 294818b4..784fb3db 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -605,6 +605,26 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
+@@ -606,6 +606,26 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
return band == MT_BAND0 || band == MT_BAND2;
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0054-mtk-wifi-mt76-mt7996-add-fallback-in-case-of-missing.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0059-mtk-mt76-mt7996-add-fallback-in-case-of-missing-prec.patch
similarity index 82%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0054-mtk-wifi-mt76-mt7996-add-fallback-in-case-of-missing.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0059-mtk-mt76-mt7996-add-fallback-in-case-of-missing-prec.patch
index 35eafe9..d918499 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0054-mtk-wifi-mt76-mt7996-add-fallback-in-case-of-missing.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0059-mtk-mt76-mt7996-add-fallback-in-case-of-missing-prec.patch
@@ -1,8 +1,8 @@
-From 60ed10d23382fef314766291e997d422ef9d9fd5 Mon Sep 17 00:00:00 2001
+From 7235c5d6995ae047f9223fe077ae753fb439dfed Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 19 Mar 2024 17:33:49 +0800
-Subject: [PATCH 054/116] mtk: wifi: mt76: mt7996: add fallback in case of
- missing precal data
+Subject: [PATCH 059/199] mtk: mt76: mt7996: add fallback in case of missing
+ precal data
Align Wi-Fi 6 upstream changes
https://github.com/openwrt/mt76/commit/2135e201e7a9339e018d4e2d4a33c73266e674d7
@@ -15,10 +15,10 @@
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 5eb8629..9987bda 100644
+index fb4d031f..dffcd09d 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
-@@ -487,17 +487,31 @@ static int mt7996_eeprom_load_precal(struct mt7996_dev *dev)
+@@ -490,17 +490,31 @@ static int mt7996_eeprom_load_precal(struct mt7996_dev *dev)
size = MT_EE_CAL_GROUP_SIZE + MT_EE_CAL_DPD_SIZE;
dev->cal = devm_kzalloc(mdev->dev, size, GFP_KERNEL);
@@ -56,7 +56,7 @@
}
static int mt7996_apply_cal_free_data(struct mt7996_dev *dev)
-@@ -652,9 +666,7 @@ int mt7996_eeprom_init(struct mt7996_dev *dev)
+@@ -655,9 +669,7 @@ int mt7996_eeprom_init(struct mt7996_dev *dev)
if (ret)
return ret;
@@ -68,10 +68,10 @@
ret = mt7996_apply_cal_free_data(dev);
if (ret)
diff --git a/mt7996/init.c b/mt7996/init.c
-index 6430bfa..c10f667 100644
+index ade07db7..8b642ecc 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -1010,7 +1010,7 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
+@@ -1011,7 +1011,7 @@ static int mt7996_init_hardware(struct mt7996_dev *dev)
if (ret < 0)
return ret;
@@ -81,7 +81,7 @@
if (ret)
return ret;
diff --git a/mt7996/main.c b/mt7996/main.c
-index 8e67616..c7cc66e 100644
+index 39318595..3bc9dc15 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -345,7 +345,7 @@ int mt7996_set_channel(struct mt7996_phy *phy)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0055-mtk-wifi-mt76-mt7996-add-kite-part-number-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0060-mtk-mt76-mt7996-add-kite-part-number-support.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0055-mtk-wifi-mt76-mt7996-add-kite-part-number-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0060-mtk-mt76-mt7996-add-kite-part-number-support.patch
index 4a4a5f0..04ce43c 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0055-mtk-wifi-mt76-mt7996-add-kite-part-number-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0060-mtk-mt76-mt7996-add-kite-part-number-support.patch
@@ -1,7 +1,7 @@
-From 1b54509046b166213c2e9611d6d4db9d8b42e493 Mon Sep 17 00:00:00 2001
+From 32201406775dc530ae7f62a0f0bdc0af09b69dd8 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 27 Mar 2024 17:50:16 +0800
-Subject: [PATCH 055/116] mtk: wifi: mt76: mt7996: add kite part number support
+Subject: [PATCH 060/199] mtk: mt76: mt7996: add kite part number support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -9,10 +9,10 @@
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 9987bda..51455d8 100644
+index dffcd09d..c4714982 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
-@@ -316,26 +316,39 @@ out:
+@@ -319,26 +319,39 @@ out:
return ret;
}
@@ -57,7 +57,7 @@
return 0;
}
-@@ -379,13 +392,15 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
+@@ -382,13 +395,15 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy)
{
@@ -76,7 +76,7 @@
if (!path || path > max_path)
path = max_path;
-@@ -405,10 +420,6 @@ int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy)
+@@ -408,10 +423,6 @@ int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy)
dev->chainshift[band_idx + 1] = dev->chainshift[band_idx] +
hweight16(mphy->chainmask);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0056-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0061-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0056-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0061-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch
index b8213cd..c73d2e3 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0056-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0061-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch
@@ -1,9 +1,10 @@
-From f4f100bea5c4e42cfd7f815555be0a6efc79aaba Mon Sep 17 00:00:00 2001
+From 397ea73910dc301f6fcaa4e96ecb59108c79c126 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 6 Feb 2023 19:49:22 +0800
-Subject: [PATCH 056/116] mtk: wifi: mt76: revert page_poll for kernel 5.4
+Subject: [PATCH 061/199] mtk: wifi: mt76: revert page_poll for kernel 5.4
This reverts commit e8c10835cf062c577ddf426913788c39d30b4bd7.
+
---
dma.c | 75 ++++++++++++++++++++++++++-------------------------
mac80211.c | 56 --------------------------------------
@@ -14,7 +15,7 @@
6 files changed, 104 insertions(+), 168 deletions(-)
diff --git a/dma.c b/dma.c
-index 66c000e..33a84f5 100644
+index 66c000ef..33a84f5f 100644
--- a/dma.c
+++ b/dma.c
@@ -178,7 +178,7 @@ mt76_free_pending_rxwi(struct mt76_dev *dev)
@@ -203,7 +204,7 @@
if (mtk_wed_device_active(&dev->mmio.wed))
diff --git a/mac80211.c b/mac80211.c
-index de0a398..a050d0a 100644
+index 6a5201f6..5f85bf1d 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -566,47 +566,6 @@ void mt76_unregister_phy(struct mt76_phy *phy)
@@ -254,7 +255,7 @@
struct mt76_dev *
mt76_alloc_device(struct device *pdev, unsigned int size,
const struct ieee80211_ops *ops,
-@@ -1819,21 +1778,6 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
+@@ -1812,21 +1771,6 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
}
EXPORT_SYMBOL_GPL(mt76_ethtool_worker);
@@ -277,7 +278,7 @@
{
struct ieee80211_hw *hw = phy->hw;
diff --git a/mt76.h b/mt76.h
-index 8b17dfb..fd6eab5 100644
+index 36e8834e..fbcd5ea9 100644
--- a/mt76.h
+++ b/mt76.h
@@ -251,7 +251,7 @@ struct mt76_queue {
@@ -289,7 +290,7 @@
};
struct mt76_mcu_ops {
-@@ -1606,7 +1606,6 @@ mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
+@@ -1600,7 +1600,6 @@ mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
return usb_bulk_msg(udev, pipe, data, len, actual_len, timeout);
}
@@ -297,7 +298,7 @@
void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
struct mt76_sta_stats *stats, bool eht);
int mt76_skb_adjust_pad(struct sk_buff *skb, int pad);
-@@ -1752,25 +1751,6 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
+@@ -1758,25 +1757,6 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
struct mt76_txwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
struct mt76_txwi_cache *r, dma_addr_t phys);
@@ -324,7 +325,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7915/main.c b/mt7915/main.c
-index b16a633..ad91fc3 100644
+index 2624edbb..1b9ef1de 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1402,22 +1402,19 @@ void mt7915_get_et_strings(struct ieee80211_hw *hw,
@@ -382,10 +383,10 @@
static void
diff --git a/usb.c b/usb.c
-index dc690d1..058f2d1 100644
+index 58ff0682..0ca3b069 100644
--- a/usb.c
+++ b/usb.c
-@@ -319,27 +319,29 @@ mt76u_set_endpoints(struct usb_interface *intf,
+@@ -318,27 +318,29 @@ mt76u_set_endpoints(struct usb_interface *intf,
static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
@@ -420,7 +421,7 @@
urb->num_sgs = i;
}
-@@ -352,16 +354,15 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
+@@ -351,16 +353,15 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
static int
mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
@@ -440,7 +441,7 @@
return urb->transfer_buffer ? 0 : -ENOMEM;
}
-@@ -399,7 +400,7 @@ mt76u_rx_urb_alloc(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -398,7 +399,7 @@ mt76u_rx_urb_alloc(struct mt76_dev *dev, struct mt76_queue *q,
if (err)
return err;
@@ -449,7 +450,7 @@
}
static void mt76u_urb_free(struct urb *urb)
-@@ -407,10 +408,10 @@ static void mt76u_urb_free(struct urb *urb)
+@@ -406,10 +407,10 @@ static void mt76u_urb_free(struct urb *urb)
int i;
for (i = 0; i < urb->num_sgs; i++)
@@ -462,7 +463,7 @@
usb_free_urb(urb);
}
-@@ -546,8 +547,6 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb,
+@@ -545,8 +546,6 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb,
len -= data_len;
nsgs++;
}
@@ -471,7 +472,7 @@
dev->drv->rx_skb(dev, MT_RXQ_MAIN, skb, NULL);
return nsgs;
-@@ -613,7 +612,7 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -612,7 +611,7 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
count = mt76u_process_rx_entry(dev, urb, q->buf_size);
if (count > 0) {
@@ -480,7 +481,7 @@
if (err < 0)
break;
}
-@@ -664,10 +663,6 @@ mt76u_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid)
+@@ -663,10 +662,6 @@ mt76u_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid)
struct mt76_queue *q = &dev->q_rx[qid];
int i, err;
@@ -491,7 +492,7 @@
spin_lock_init(&q->lock);
q->entry = devm_kcalloc(dev->dev,
MT_NUM_RX_ENTRIES, sizeof(*q->entry),
-@@ -696,6 +691,7 @@ EXPORT_SYMBOL_GPL(mt76u_alloc_mcu_queue);
+@@ -695,6 +690,7 @@ EXPORT_SYMBOL_GPL(mt76u_alloc_mcu_queue);
static void
mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
{
@@ -499,7 +500,7 @@
int i;
for (i = 0; i < q->ndesc; i++) {
-@@ -705,8 +701,13 @@ mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -704,8 +700,13 @@ mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
mt76u_urb_free(q->entry[i].urb);
q->entry[i].urb = NULL;
}
@@ -516,7 +517,7 @@
static void mt76u_free_rx(struct mt76_dev *dev)
diff --git a/wed.c b/wed.c
-index f89e453..8eca4d8 100644
+index f89e4537..8eca4d81 100644
--- a/wed.c
+++ b/wed.c
@@ -9,8 +9,12 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0057-mtk-wifi-mt76-rework-wed-rx-flow.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0062-mtk-mt76-rework-wed-rx-flow.patch
similarity index 96%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0057-mtk-wifi-mt76-rework-wed-rx-flow.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0062-mtk-mt76-rework-wed-rx-flow.patch
index b8f0a0d..a71e2b3 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0057-mtk-wifi-mt76-rework-wed-rx-flow.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0062-mtk-mt76-rework-wed-rx-flow.patch
@@ -1,7 +1,7 @@
-From 9874e44657b18d1c2c225506ce9f7a985fd9b94a Mon Sep 17 00:00:00 2001
+From 48f648333182ff895faa99cbad65d1f9baeb6f55 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 6 Feb 2023 13:37:23 +0800
-Subject: [PATCH 057/116] mtk: wifi: mt76: rework wed rx flow
+Subject: [PATCH 062/199] mtk: mt76: rework wed rx flow
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -15,7 +15,7 @@
7 files changed, 144 insertions(+), 85 deletions(-)
diff --git a/dma.c b/dma.c
-index 33a84f5..c54187b 100644
+index 33a84f5f..c54187bd 100644
--- a/dma.c
+++ b/dma.c
@@ -64,17 +64,17 @@ mt76_alloc_txwi(struct mt76_dev *dev)
@@ -259,7 +259,7 @@
DMA_FROM_DEVICE);
skb_free_frag(buf);
diff --git a/mac80211.c b/mac80211.c
-index a050d0a..3c2c2af 100644
+index 5f85bf1d..3e054d9d 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -596,7 +596,6 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
@@ -279,7 +279,7 @@
for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++)
skb_queue_head_init(&dev->rx_skb[i]);
diff --git a/mt76.h b/mt76.h
-index fd6eab5..2ad5a3f 100644
+index fbcd5ea9..92b59dd6 100644
--- a/mt76.h
+++ b/mt76.h
@@ -205,6 +205,7 @@ struct mt76_queue_entry {
@@ -290,7 +290,7 @@
struct urb *urb;
int buf_sz;
};
-@@ -416,12 +417,16 @@ struct mt76_txwi_cache {
+@@ -420,12 +421,16 @@ struct mt76_txwi_cache {
struct list_head list;
dma_addr_t dma_addr;
@@ -312,7 +312,7 @@
};
struct mt76_rx_tid {
-@@ -509,6 +514,7 @@ struct mt76_driver_ops {
+@@ -512,6 +517,7 @@ struct mt76_driver_ops {
u16 txwi_size;
u16 token_size;
u8 mcs_rates;
@@ -320,7 +320,7 @@
void (*update_survey)(struct mt76_phy *phy);
-@@ -886,7 +892,6 @@ struct mt76_dev {
+@@ -876,7 +882,6 @@ struct mt76_dev {
struct ieee80211_hw *hw;
@@ -328,7 +328,7 @@
spinlock_t lock;
spinlock_t cc_lock;
-@@ -1568,8 +1573,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+@@ -1562,8 +1567,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
}
void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
@@ -339,7 +339,7 @@
void mt76_free_pending_rxwi(struct mt76_dev *dev);
void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
struct napi_struct *napi);
-@@ -1748,9 +1753,9 @@ struct mt76_txwi_cache *
+@@ -1754,9 +1759,9 @@ struct mt76_txwi_cache *
mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi);
void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
@@ -352,7 +352,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6004d64..5938bd9 100644
+index d6ecd698..c8511867 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -714,7 +714,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -373,7 +373,7 @@
.tx_complete_skb = mt76_connac_tx_complete_skb,
.rx_skb = mt7915_queue_rx_skb,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index a30d08e..f1e2c93 100644
+index a30d08eb..f1e2c93a 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -62,6 +62,7 @@
@@ -385,7 +385,7 @@
#define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
#define MT7915_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
diff --git a/tx.c b/tx.c
-index ab42f69..46dae6e 100644
+index ab42f69b..46dae6e0 100644
--- a/tx.c
+++ b/tx.c
@@ -851,16 +851,16 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi)
@@ -430,7 +430,7 @@
}
EXPORT_SYMBOL_GPL(mt76_rx_token_release);
diff --git a/wed.c b/wed.c
-index 8eca4d8..0a0b5c0 100644
+index 8eca4d81..0a0b5c05 100644
--- a/wed.c
+++ b/wed.c
@@ -9,28 +9,45 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0058-mtk-wifi-mt76-wed-change-wed-token-init-size-to-adap.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0063-mtk-mt76-change-wed-token-init-size-to-adapt-wed3.0.patch
similarity index 81%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0058-mtk-wifi-mt76-wed-change-wed-token-init-size-to-adap.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0063-mtk-mt76-change-wed-token-init-size-to-adapt-wed3.0.patch
index 86ecb66..15d941a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0058-mtk-wifi-mt76-wed-change-wed-token-init-size-to-adap.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0063-mtk-mt76-change-wed-token-init-size-to-adapt-wed3.0.patch
@@ -1,8 +1,7 @@
-From e5bfc7a288ec62f00e1bb7da03646268ba1b67d2 Mon Sep 17 00:00:00 2001
+From 18702f417ad4d5757cda5ea88924cac918e25592 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Wed, 19 Apr 2023 17:13:41 +0800
-Subject: [PATCH 058/116] mtk: wifi: mt76: wed: change wed token init size to
- adapt wed3.0
+Subject: [PATCH 063/199] mtk: mt76: change wed token init size to adapt wed3.0
Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
---
@@ -10,7 +9,7 @@
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tx.c b/tx.c
-index 46dae6e..e279506 100644
+index 46dae6e0..e2795067 100644
--- a/tx.c
+++ b/tx.c
@@ -827,12 +827,16 @@ EXPORT_SYMBOL_GPL(__mt76_set_tx_blocked);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0059-mtk-wifi-mt76-add-random-early-drop-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0064-mtk-mt76-add-random-early-drop-support.patch
similarity index 89%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0059-mtk-wifi-mt76-add-random-early-drop-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0064-mtk-mt76-add-random-early-drop-support.patch
index 342f2ce..aac1628 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0059-mtk-wifi-mt76-add-random-early-drop-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0064-mtk-mt76-add-random-early-drop-support.patch
@@ -1,7 +1,7 @@
-From 4b0b49bb26433a9d8a62cd37c66fbba548d9aee7 Mon Sep 17 00:00:00 2001
+From a95ba55c6e8e2662d7278f0530f3aa75c4f4a798 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 19 Apr 2023 18:32:41 +0800
-Subject: [PATCH 059/116] mtk: wifi: mt76: add random early drop support
+Subject: [PATCH 064/199] mtk: mt76: add random early drop support
---
mt7996/debugfs.c | 1 +
@@ -15,10 +15,10 @@
8 files changed, 167 insertions(+), 4 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 6c5fbc7..8d63937 100644
+index 6d119467..3301701a 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
-@@ -634,6 +634,7 @@ mt7996_tx_stats_show(struct seq_file *file, void *data)
+@@ -633,6 +633,7 @@ mt7996_tx_stats_show(struct seq_file *file, void *data)
seq_printf(file, "Tx attempts: %8u (MPDUs)\n", attempts);
seq_printf(file, "Tx success: %8u (MPDUs)\n", success);
seq_printf(file, "Tx PER: %u%%\n", per);
@@ -27,10 +27,10 @@
mt7996_txbf_stat_read_phy(phy, file);
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 727d1fb..78e35aa 100644
+index bcddff23..0c2fee66 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1176,6 +1176,13 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1179,6 +1179,13 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
wcid->stats.tx_retries += tx_retries;
wcid->stats.tx_failed += tx_failed;
@@ -45,10 +45,10 @@
}
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 686cdda..f745139 100644
+index 9bef1274..7fa44f84 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3147,8 +3147,8 @@ int mt7996_mcu_init_firmware(struct mt7996_dev *dev)
+@@ -3150,8 +3150,8 @@ int mt7996_mcu_init_firmware(struct mt7996_dev *dev)
if (ret)
return ret;
@@ -59,7 +59,7 @@
}
int mt7996_mcu_init(struct mt7996_dev *dev)
-@@ -3180,6 +3180,83 @@ out:
+@@ -3183,6 +3183,83 @@ out:
skb_queue_purge(&dev->mt76.mcu.res_q);
}
@@ -144,7 +144,7 @@
{
struct {
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index f5e91a8..ca78cd5 100644
+index 3025f849..23db3b33 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -346,8 +346,9 @@ enum {
@@ -167,10 +167,10 @@
enum {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index c73701d..453d224 100644
+index 784fb3db..d40f95cd 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -354,6 +354,7 @@ struct mt7996_phy {
+@@ -355,6 +355,7 @@ struct mt7996_phy {
u16 punct_bitmap;
struct mt7996_scs_ctrl scs_ctrl;
@@ -178,7 +178,7 @@
bool sku_limit_en;
bool sku_path_en;
-@@ -723,6 +724,7 @@ int mt7996_mcu_rf_regval(struct mt7996_dev *dev, u32 regidx, u32 *val, bool set)
+@@ -724,6 +725,7 @@ int mt7996_mcu_rf_regval(struct mt7996_dev *dev, u32 regidx, u32 *val, bool set)
int mt7996_mcu_set_hdr_trans(struct mt7996_dev *dev, bool hdr_trans);
int mt7996_mcu_set_rro(struct mt7996_dev *dev, u16 tag, u16 val);
int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
@@ -186,7 +186,7 @@
int mt7996_mcu_fw_log_2_host(struct mt7996_dev *dev, u8 type, u8 ctrl);
int mt7996_mcu_fw_dbg_ctrl(struct mt7996_dev *dev, u32 module, u8 level);
int mt7996_mcu_trigger_assert(struct mt7996_dev *dev);
-@@ -896,11 +898,12 @@ void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type);
+@@ -897,11 +899,12 @@ void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type);
void mt7996_mcu_set_nusers_ofdma(struct mt7996_phy *phy, u8 type, u8 ofdma_user_cnt);
void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type);
void mt7996_tm_update_channel(struct mt7996_phy *phy);
@@ -201,10 +201,10 @@
-
#endif
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index c1b665f..ff84d6f 100644
+index 05cfc6ab..1f754796 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -3074,6 +3074,27 @@ static int mt7996_muru_prot_thr_set(void *data, u64 val)
+@@ -3033,6 +3033,27 @@ static int mt7996_muru_prot_thr_set(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_prot_thr, NULL,
mt7996_muru_prot_thr_set, "%lld\n");
@@ -232,7 +232,7 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -3151,6 +3172,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -3109,6 +3130,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
mt7996_wtbl_read);
debugfs_create_devm_seqfile(dev->mt76.dev, "token", dir, mt7996_token_read);
@@ -242,10 +242,10 @@
debugfs_create_u8("sku_disable", 0600, dir, &dev->dbg.sku_disable);
debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index a9a7db1..aed32e9 100644
+index b46a66bb..967ee874 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
-@@ -1316,4 +1316,30 @@ void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type)
+@@ -1317,4 +1317,30 @@ void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type)
sizeof(req), false);
}
@@ -277,7 +277,7 @@
+
#endif
diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
-index 58d61c5..2cffc89 100644
+index 58d61c51..2cffc893 100644
--- a/mt7996/mtk_mcu.h
+++ b/mt7996/mtk_mcu.h
@@ -1138,6 +1138,30 @@ enum muru_vendor_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0060-mtk-wifi-mt76-mt7996-reset-addr_elem-when-delete-ba.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0065-mtk-mt76-mt7996-reset-addr_elem-when-delete-ba.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0060-mtk-wifi-mt76-mt7996-reset-addr_elem-when-delete-ba.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0065-mtk-mt76-mt7996-reset-addr_elem-when-delete-ba.patch
index 96dff48..1b13961 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0060-mtk-wifi-mt76-mt7996-reset-addr_elem-when-delete-ba.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0065-mtk-mt76-mt7996-reset-addr_elem-when-delete-ba.patch
@@ -1,29 +1,27 @@
-From 7328175da3d5b1a42c26d1f7fd34fe6c278d22ca Mon Sep 17 00:00:00 2001
+From 8b4350b46fa5bc77a6e4314261b540b0ebd99f43 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Thu, 18 May 2023 15:01:47 +0800
-Subject: [PATCH 060/116] mtk: wifi: mt76: mt7996: reset addr_elem when delete
- ba
+Subject: [PATCH 065/199] mtk: mt76: mt7996: reset addr_elem when delete ba
The old addr element info may be used when the signature is not equel to
0xff, and sta will find error SDP cause the SDP/SDL=0 issue.
-Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
-
1. without this patch will delete wrong session id when delete ba.
Due to fw change the cmd format.
https://gerrit.mediatek.inc/c/neptune/firmware/bora/wifi/custom/+/7969193
Signed-off-by: mtk27745 <rex.lu@mediatek.com>
+Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
---
mt76.h | 1 +
mt7996/mcu.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/mt76.h b/mt76.h
-index 2ad5a3f..37ef803 100644
+index 92b59dd6..f2052cf7 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -444,6 +444,7 @@ struct mt76_rx_tid {
+@@ -447,6 +447,7 @@ struct mt76_rx_tid {
u16 nframes;
u8 num;
@@ -32,7 +30,7 @@
u8 started:1, stopped:1, timer_pending:1;
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index ca78cd5..3c4ff7a 100644
+index 23db3b33..7077a664 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -298,6 +298,52 @@ struct mt7996_mcu_thermal_notify {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0061-mtk-wifi-mt76-wed-change-pcie0-R5-to-pcie1-to-get-6G.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0066-mtk-mt76-change-pcie0-R5-to-pcie1-to-get-6G-ICS.patch
similarity index 86%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0061-mtk-wifi-mt76-wed-change-pcie0-R5-to-pcie1-to-get-6G.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0066-mtk-mt76-change-pcie0-R5-to-pcie1-to-get-6G-ICS.patch
index f70c00d..d021759 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0061-mtk-wifi-mt76-wed-change-pcie0-R5-to-pcie1-to-get-6G.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0066-mtk-mt76-change-pcie0-R5-to-pcie1-to-get-6G-ICS.patch
@@ -1,8 +1,7 @@
-From 51653708b92be73f1bd4a79ca11eaa3cb181ee4b Mon Sep 17 00:00:00 2001
+From 84de1f40cbb93804a270e3d70824ccf8e8e5f1e7 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Fri, 6 Oct 2023 14:01:41 +0800
-Subject: [PATCH 061/116] mtk: wifi: mt76: wed: change pcie0 R5 to pcie1 to get
- 6G ICS
+Subject: [PATCH 066/199] mtk: mt76: change pcie0 R5 to pcie1 to get 6G ICS
---
mt7996/dma.c | 4 ++++
@@ -11,7 +10,7 @@
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index 759a58e..5d85e9e 100644
+index 759a58e8..5d85e9ea 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -538,6 +538,10 @@ int mt7996_dma_init(struct mt7996_dev *dev)
@@ -26,10 +25,10 @@
MT_RXQ_ID(MT_RXQ_BAND2),
MT7996_RX_RING_SIZE,
diff --git a/mt7996/init.c b/mt7996/init.c
-index c10f667..de5122f 100644
+index 8b642ecc..6563974d 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -649,10 +649,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -651,10 +651,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
goto error;
if (wed == &dev->mt76.mmio.wed_hif2 && mtk_wed_device_active(wed)) {
@@ -43,7 +42,7 @@
return 0;
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index 8fe56ed..a082cca 100644
+index 928a9663..7940621b 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -527,12 +527,15 @@ static void mt7996_irq_tasklet(struct tasklet_struct *t)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0062-mtk-wifi-mt76-add-SER-support-for-wed3.0.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0067-mtk-mt76-add-SER-support-for-wed3.0.patch
similarity index 81%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0062-mtk-wifi-mt76-add-SER-support-for-wed3.0.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0067-mtk-mt76-add-SER-support-for-wed3.0.patch
index 9653eac..11a6537 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0062-mtk-wifi-mt76-add-SER-support-for-wed3.0.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0067-mtk-mt76-add-SER-support-for-wed3.0.patch
@@ -1,7 +1,7 @@
-From a666507a58b47e007ea1396d35941598a398cdc9 Mon Sep 17 00:00:00 2001
+From b8b41987d94d7fca7bcf9f6b7204e62528322ecc Mon Sep 17 00:00:00 2001
From: mtk27745 <rex.lu@mediatek.com>
Date: Tue, 23 May 2023 12:06:29 +0800
-Subject: [PATCH 062/116] mtk: wifi: mt76: add SER support for wed3.0
+Subject: [PATCH 067/199] mtk: mt76: add SER support for wed3.0
---
dma.c | 5 +++--
@@ -9,7 +9,7 @@
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dma.c b/dma.c
-index c54187b..e5be891 100644
+index c54187bd..e5be891c 100644
--- a/dma.c
+++ b/dma.c
@@ -834,8 +834,9 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
@@ -25,7 +25,7 @@
mt76_dma_rx_fill(dev, q, false);
}
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index a082cca..d29579f 100644
+index 7940621b..0d25c5ff 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -297,6 +297,7 @@ out:
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0063-mtk-wifi-mt76-mt7915-wed-find-rx-token-by-physical-a.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0068-mtk-mt76-find-rx-token-by-physical-address.patch
similarity index 84%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0063-mtk-wifi-mt76-mt7915-wed-find-rx-token-by-physical-a.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0068-mtk-mt76-find-rx-token-by-physical-address.patch
index e40c8a0..1c5a1fb 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0063-mtk-wifi-mt76-mt7915-wed-find-rx-token-by-physical-a.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0068-mtk-mt76-find-rx-token-by-physical-address.patch
@@ -1,11 +1,10 @@
-From e9774619c3b0871df9bfcb87fb4f268e8799e0c3 Mon Sep 17 00:00:00 2001
+From d19b337c221ed6c72d9733c3206bcd6f24b3a774 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Wed, 19 Jul 2023 10:55:09 +0800
-Subject: [PATCH 063/116] mtk: wifi: mt76: mt7915: wed: find rx token by
- physical address
+Subject: [PATCH 068/199] mtk: mt76: find rx token by physical address
-The token id in RxDMAD may be incorrect when it is not the last frame due to
-WED HW bug. Lookup correct token id by physical address in sdp0.
+The token id in RxDMAD may be incorrect when it is not the last frame in
+WED HW. Lookup correct token id by physical address in sdp0.
Add len == 0 check to drop garbage frames
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
@@ -14,7 +13,7 @@
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/dma.c b/dma.c
-index e5be891..1021b3e 100644
+index e5be891c..1021b3e5 100644
--- a/dma.c
+++ b/dma.c
@@ -446,9 +446,32 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0064-mtk-wifi-mt76-mt7996-add-dma-mask-limitation.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0069-mtk-mt76-mt7996-add-dma-mask-limitation.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0064-mtk-wifi-mt76-mt7996-add-dma-mask-limitation.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0069-mtk-mt76-mt7996-add-dma-mask-limitation.patch
index ae66519..1a394f6 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0064-mtk-wifi-mt76-mt7996-add-dma-mask-limitation.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0069-mtk-mt76-mt7996-add-dma-mask-limitation.patch
@@ -1,7 +1,7 @@
-From 947f66954b1b232255697954131532b4f005e7cd Mon Sep 17 00:00:00 2001
+From 71b485441f2bc88349b4d69022965c85560ae52b Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Thu, 20 Jul 2023 10:25:50 +0800
-Subject: [PATCH 064/116] mtk: wifi: mt76: mt7996: add dma mask limitation
+Subject: [PATCH 069/199] mtk: mt76: mt7996: add dma mask limitation
Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
---
@@ -10,7 +10,7 @@
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dma.c b/dma.c
-index 1021b3e..da21f64 100644
+index 1021b3e5..da21f641 100644
--- a/dma.c
+++ b/dma.c
@@ -488,7 +488,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
@@ -32,7 +32,7 @@
break;
diff --git a/wed.c b/wed.c
-index 0a0b5c0..1c6d53c 100644
+index 0a0b5c05..1c6d53c8 100644
--- a/wed.c
+++ b/wed.c
@@ -65,14 +65,14 @@ u32 mt76_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0065-mtk-wifi-mt76-mt7996-add-per-bss-statistic-info.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0070-mtk-mt76-mt7996-add-per-bss-statistic-info.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0065-mtk-wifi-mt76-mt7996-add-per-bss-statistic-info.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0070-mtk-mt76-mt7996-add-per-bss-statistic-info.patch
index 48ed97c..38d9ef7 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0065-mtk-wifi-mt76-mt7996-add-per-bss-statistic-info.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0070-mtk-mt76-mt7996-add-per-bss-statistic-info.patch
@@ -1,7 +1,7 @@
-From d86765207c6919af7c0448841f723159b0c1dcab Mon Sep 17 00:00:00 2001
+From 05a99ecc4978355bccc95be925a2b479754b193c Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Fri, 18 Aug 2023 10:17:08 +0800
-Subject: [PATCH 065/116] mtk: wifi: mt76: mt7996: add per bss statistic info
+Subject: [PATCH 070/199] mtk: mt76: mt7996: add per bss statistic info
Whenever WED is enabled, unicast traffic might run through HW path.
As a result, we need to count them using WM event.
@@ -22,10 +22,10 @@
3 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/mt7996/init.c b/mt7996/init.c
-index de5122f..8b7c278 100644
+index 6563974d..9d918268 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -401,6 +401,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -403,6 +403,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_PUNCT);
@@ -34,7 +34,7 @@
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
diff --git a/mt7996/main.c b/mt7996/main.c
-index c7cc66e..801e480 100644
+index 3bc9dc15..d26c55ed 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -265,6 +265,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
@@ -46,7 +46,7 @@
mt7996_mac_wtbl_update(dev, idx,
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index f745139..a238fdd 100644
+index 7fa44f84..061461fb 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -524,6 +524,27 @@ mt7996_mcu_update_tx_gi(struct rate_info *rate, struct all_sta_trx_rate *mcu_rat
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0066-mtk-wifi-mt76-mt7996-do-not-report-netdev-stats-on-m.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0071-mtk-mt76-mt7996-do-not-report-netdev-stats-on-monito.patch
similarity index 84%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0066-mtk-wifi-mt76-mt7996-do-not-report-netdev-stats-on-m.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0071-mtk-mt76-mt7996-do-not-report-netdev-stats-on-monito.patch
index d86ca2c..72d71ff 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0066-mtk-wifi-mt76-mt7996-do-not-report-netdev-stats-on-m.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0071-mtk-mt76-mt7996-do-not-report-netdev-stats-on-monito.patch
@@ -1,8 +1,8 @@
-From 947b71bb7b65824acf8dbaa984ead4ce638f4005 Mon Sep 17 00:00:00 2001
+From 5d4625368dbd91070333a90e6e779d09cd6d3ca8 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 26 Oct 2023 17:27:43 +0800
-Subject: [PATCH 066/116] mtk: wifi: mt76: mt7996: do not report netdev stats
- on monitor vif
+Subject: [PATCH 071/199] mtk: mt76: mt7996: do not report netdev stats on
+ monitor vif
This fixes the following NULL pointer crash when enabling monitor mode:
[ 205.593158] Call trace:
@@ -19,7 +19,7 @@
1 file changed, 3 insertions(+)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index a238fdd..b886644 100644
+index 061461fb..9d96218b 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -540,6 +540,9 @@ static inline void __mt7996_stat_to_netdev(struct mt76_phy *mphy,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0067-mtk-wifi-mt76-mt7996-add-support-for-HW-ATF.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0072-mtk-mt76-mt7996-add-support-for-HW-ATF.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0067-mtk-wifi-mt76-mt7996-add-support-for-HW-ATF.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0072-mtk-mt76-mt7996-add-support-for-HW-ATF.patch
index dc84c18..3cc57cb 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0067-mtk-wifi-mt76-mt7996-add-support-for-HW-ATF.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0072-mtk-mt76-mt7996-add-support-for-HW-ATF.patch
@@ -1,7 +1,7 @@
-From f5372277983af2dd7cc3416563de0ad06ff6211c Mon Sep 17 00:00:00 2001
+From bf2d3c5764a6c6377cf9d806b4320ae4fdb5afa5 Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Mon, 11 Sep 2023 16:35:15 +0800
-Subject: [PATCH 067/116] mtk: wifi: mt76: mt7996: add support for HW-ATF
+Subject: [PATCH 072/199] mtk: mt76: mt7996: add support for HW-ATF
---
mt7996/debugfs.c | 90 ++++++++++++++++
@@ -13,10 +13,10 @@
6 files changed, 475 insertions(+), 26 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 8d63937..f8ba573 100644
+index 3301701a..3b58b8ba 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
-@@ -940,6 +940,91 @@ static const struct file_operations mt7996_efuse_ops = {
+@@ -927,6 +927,91 @@ static const struct file_operations mt7996_efuse_ops = {
.llseek = default_llseek,
};
@@ -108,7 +108,7 @@
int mt7996_init_debugfs(struct mt7996_phy *phy)
{
struct mt7996_dev *dev = phy->dev;
-@@ -967,6 +1052,11 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
+@@ -954,6 +1039,11 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
mt7996_twt_stats);
debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
debugfs_create_file("otp", 0400, dir, dev, &mt7996_efuse_ops);
@@ -121,10 +121,10 @@
if (phy->mt76->cap.has_5ghz) {
debugfs_create_u32("dfs_hw_pattern", 0400, dir,
diff --git a/mt7996/init.c b/mt7996/init.c
-index 8b7c278..c382ded 100644
+index 9d918268..440c4b7c 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -573,6 +573,37 @@ int mt7996_txbf_init(struct mt7996_dev *dev)
+@@ -575,6 +575,37 @@ int mt7996_txbf_init(struct mt7996_dev *dev)
return mt7996_mcu_set_txbf(dev, BF_HW_EN_UPDATE);
}
@@ -162,7 +162,7 @@
static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
enum mt76_band_id band)
{
-@@ -645,6 +676,12 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -647,6 +678,12 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
if (ret)
goto error;
@@ -189,7 +189,7 @@
if (ret)
goto error;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 78e35aa..be56abe 100644
+index 0c2fee66..dfc68a19 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -103,6 +103,7 @@ static void mt7996_mac_sta_poll(struct mt7996_dev *dev)
@@ -220,7 +220,7 @@
/* get signal strength of resp frames (CTS/BA/ACK) */
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index b886644..ef30d8e 100644
+index 9d96218b..4bcc415f 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -2225,34 +2225,37 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, struct ieee80211_vif *vif,
@@ -285,7 +285,7 @@
}
int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
-@@ -2308,7 +2311,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2311,7 +2314,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
mt7996_mcu_sta_bfee_tlv(dev, skb, vif, sta);
}
@@ -294,7 +294,7 @@
if (ret) {
dev_kfree_skb(skb);
return ret;
-@@ -5185,6 +5188,218 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
+@@ -5188,6 +5191,218 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
&req, sizeof(req), false);
}
@@ -514,7 +514,7 @@
void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
{
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 3c4ff7a..700330a 100644
+index 7077a664..c55fb527 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -965,6 +965,7 @@ enum {
@@ -526,10 +526,10 @@
UNI_VOW_RX_AT_AIRTIME_CLR_EN = 0x0e,
UNI_VOW_RED_ENABLE = 0x18,
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 453d224..c95c12b 100644
+index d40f95cd..a933e739 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -114,6 +114,12 @@
+@@ -115,6 +115,12 @@
#define MT7996_RX_MSDU_PAGE_SIZE (128 + \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
@@ -542,7 +542,7 @@
struct mt7996_vif;
struct mt7996_sta;
struct mt7996_dfs_pulse;
-@@ -215,6 +221,81 @@ enum mt7996_dpd_ch_num {
+@@ -216,6 +222,81 @@ enum mt7996_dpd_ch_num {
DPD_CH_NUM_TYPE_MAX,
};
@@ -624,7 +624,7 @@
struct mt7996_sta {
struct mt76_wcid wcid; /* must be first */
-@@ -234,6 +315,8 @@ struct mt7996_sta {
+@@ -235,6 +316,8 @@ struct mt7996_sta {
u8 flowid_mask;
struct mt7996_twt_flow flow[MT7996_MAX_STA_TWT_AGRT];
} twt;
@@ -633,7 +633,7 @@
};
struct mt7996_vif {
-@@ -499,6 +582,7 @@ struct mt7996_dev {
+@@ -500,6 +583,7 @@ struct mt7996_dev {
u8 wtbl_size_group;
@@ -641,7 +641,7 @@
#ifdef CONFIG_MTK_DEBUG
u16 wlan_idx;
struct {
-@@ -739,10 +823,12 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy);
+@@ -740,10 +824,12 @@ int mt7996_mcu_apply_tx_dpd(struct mt7996_phy *phy);
#ifdef CONFIG_NL80211_TESTMODE
void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb);
#endif
@@ -655,7 +655,7 @@
static inline u8 mt7996_max_interface_num(struct mt7996_dev *dev)
{
-@@ -792,6 +878,14 @@ static inline u16 mt7996_rx_chainmask(struct mt7996_phy *phy)
+@@ -793,6 +879,14 @@ static inline u16 mt7996_rx_chainmask(struct mt7996_phy *phy)
return tx_chainmask | (BIT(fls(tx_chainmask)) * phy->has_aux_rx);
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0068-mtk-wifi-mt76-mt7996-wed-add-SER0.5-support-w-wed3.0.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0073-mtk-mt76-mt7996-add-SER0.5-support-w-wed3.0.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0068-mtk-wifi-mt76-mt7996-wed-add-SER0.5-support-w-wed3.0.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0073-mtk-mt76-mt7996-add-SER0.5-support-w-wed3.0.patch
index 8865ef4..dae5c07 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0068-mtk-wifi-mt76-mt7996-wed-add-SER0.5-support-w-wed3.0.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0073-mtk-mt76-mt7996-add-SER0.5-support-w-wed3.0.patch
@@ -1,8 +1,7 @@
-From 21fac5083443173762f0bda68768acde71e7153e Mon Sep 17 00:00:00 2001
+From 73693f3833455addeaa13764ba39917f4fe8e171 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Thu, 12 Oct 2023 10:04:54 +0800
-Subject: [PATCH 068/116] mtk: wifi: mt76: mt7996: wed: add SER0.5 support w/
- wed3.0
+Subject: [PATCH 073/199] mtk: mt76: mt7996: add SER0.5 support w/ wed3.0
Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
---
@@ -18,7 +17,7 @@
9 files changed, 146 insertions(+), 64 deletions(-)
diff --git a/dma.c b/dma.c
-index da21f64..e23b744 100644
+index da21f641..e23b744b 100644
--- a/dma.c
+++ b/dma.c
@@ -218,9 +218,9 @@ void __mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q,
@@ -53,7 +52,7 @@
return 0;
}
diff --git a/dma.h b/dma.h
-index 1de5a2b..3a8c2e5 100644
+index 1de5a2b2..3a8c2e55 100644
--- a/dma.h
+++ b/dma.h
@@ -83,12 +83,12 @@ int mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q,
@@ -72,7 +71,7 @@
mt76_wed_dma_setup(dev, q, true);
}
diff --git a/mt76.h b/mt76.h
-index 37ef803..9f1f7fc 100644
+index f2052cf7..1236ddb4 100644
--- a/mt76.h
+++ b/mt76.h
@@ -301,7 +301,7 @@ struct mt76_queue_ops {
@@ -84,7 +83,7 @@
};
enum mt76_phy_type {
-@@ -1736,8 +1736,13 @@ static inline bool mt76_queue_is_wed_rro_ind(struct mt76_queue *q)
+@@ -1742,8 +1742,13 @@ static inline bool mt76_queue_is_wed_rro_ind(struct mt76_queue *q)
static inline bool mt76_queue_is_wed_rro_data(struct mt76_queue *q)
{
return mt76_queue_is_wed_rro(q) &&
@@ -100,7 +99,7 @@
}
static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
-@@ -1746,7 +1751,8 @@ static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
+@@ -1752,7 +1757,8 @@ static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
return false;
return FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX ||
@@ -111,7 +110,7 @@
}
diff --git a/mt792x_dma.c b/mt792x_dma.c
-index 5cc2d59..c224bcc 100644
+index 5cc2d59b..c224bcc8 100644
--- a/mt792x_dma.c
+++ b/mt792x_dma.c
@@ -181,13 +181,13 @@ mt792x_dma_reset(struct mt792x_dev *dev, bool force)
@@ -132,7 +131,7 @@
mt76_tx_status_check(&dev->mt76, true);
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index 5d85e9e..d9e1b17 100644
+index 5d85e9ea..d9e1b17f 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -711,21 +711,31 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
@@ -173,10 +172,10 @@
mt7996_dma_enable(dev, !force);
}
diff --git a/mt7996/init.c b/mt7996/init.c
-index c382ded..ff629e8 100644
+index 440c4b7c..3b1f4273 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -735,11 +735,91 @@ void mt7996_wfsys_reset(struct mt7996_dev *dev)
+@@ -737,11 +737,91 @@ void mt7996_wfsys_reset(struct mt7996_dev *dev)
msleep(20);
}
@@ -269,7 +268,7 @@
struct mt7996_wed_rro_addr *addr;
void *ptr;
int i;
-@@ -799,50 +879,9 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
+@@ -801,50 +881,9 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
addr++;
}
@@ -323,10 +322,10 @@
#else
return 0;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index be56abe..2ad9f48 100644
+index dfc68a19..be3fea21 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1764,6 +1764,31 @@ mt7996_mac_restart(struct mt7996_dev *dev)
+@@ -1761,6 +1761,31 @@ mt7996_mac_restart(struct mt7996_dev *dev)
if (ret)
goto out;
@@ -359,10 +358,10 @@
ret = mt7996_mcu_set_eeprom(dev);
if (ret)
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index c95c12b..4090fad 100644
+index a933e739..f0288cca 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -718,6 +718,7 @@ extern const struct mt76_testmode_ops mt7996_testmode_ops;
+@@ -719,6 +719,7 @@ extern const struct mt76_testmode_ops mt7996_testmode_ops;
struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
void __iomem *mem_base, u32 device_id);
void mt7996_wfsys_reset(struct mt7996_dev *dev);
@@ -371,7 +370,7 @@
u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif);
int mt7996_register_device(struct mt7996_dev *dev);
diff --git a/wed.c b/wed.c
-index 1c6d53c..61a6bad 100644
+index 1c6d53c8..61a6badf 100644
--- a/wed.c
+++ b/wed.c
@@ -155,7 +155,7 @@ int mt76_wed_dma_setup(struct mt76_dev *dev, struct mt76_queue *q, bool reset)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0069-mtk-wifi-mt76-mt7996-support-backaward-compatiable.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0074-mtk-mt76-mt7996-support-backaward-compatiable.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0069-mtk-wifi-mt76-mt7996-support-backaward-compatiable.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0074-mtk-mt76-mt7996-support-backaward-compatiable.patch
index 8890a59..45101c3 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0069-mtk-wifi-mt76-mt7996-support-backaward-compatiable.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0074-mtk-mt76-mt7996-support-backaward-compatiable.patch
@@ -1,13 +1,10 @@
-From 099ff0e39f8f83d3d6395db232da68448392b67b Mon Sep 17 00:00:00 2001
+From f5504bc5f7c41c0d8f1c944dd34cf22f284ed1c8 Mon Sep 17 00:00:00 2001
From: mtk27745 <rex.lu@mediatek.com>
Date: Fri, 6 Oct 2023 20:59:42 +0800
-Subject: [PATCH 069/116] mtk: wifi: mt76: mt7996: support backaward
- compatiable
+Subject: [PATCH 074/199] mtk: mt76: mt7996: support backaward compatiable
revert upstream wed trigger mode to polling mode
-Signed-off-by: mtk27745 <rex.lu@mediatek.com>
-
[Description]
Change the SW token size from 1024 to 15360 according to HW capability.
@@ -15,6 +12,7 @@
N/A
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: mtk27745 <rex.lu@mediatek.com>
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
---
mt76.h | 2 ++
@@ -27,7 +25,7 @@
7 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 9f1f7fc..677f68f 100644
+index 1236ddb4..e3c209ff 100644
--- a/mt76.h
+++ b/mt76.h
@@ -53,6 +53,8 @@
@@ -40,10 +38,10 @@
#define MT_QFLAG_WED_TYPE GENMASK(4, 2)
#define MT_QFLAG_WED BIT(5)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 2ad9f48..8396e6d 100644
+index be3fea21..1792726c 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1777,7 +1777,7 @@ mt7996_mac_restart(struct mt7996_dev *dev)
+@@ -1774,7 +1774,7 @@ mt7996_mac_restart(struct mt7996_dev *dev)
}
mt76_wr(dev, MT_INT_MASK_CSR, wed_irq_mask);
@@ -52,7 +50,7 @@
mt7996_irq_enable(dev, wed_irq_mask);
mt7996_irq_disable(dev, 0);
}
-@@ -2009,6 +2009,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -2006,6 +2006,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
mtk_wed_device_start_hw_rro(&dev->mt76.mmio.wed, wed_irq_mask,
true);
@@ -61,10 +59,10 @@
mt7996_irq_disable(dev, 0);
}
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index ef30d8e..6366cf0 100644
+index 4bcc415f..46611191 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3254,7 +3254,7 @@ static int mt7996_mcu_wa_red_config(struct mt7996_dev *dev)
+@@ -3257,7 +3257,7 @@ static int mt7996_mcu_wa_red_config(struct mt7996_dev *dev)
if (!mtk_wed_device_active(&dev->mt76.mmio.wed))
req.token_per_src[RED_TOKEN_SRC_CNT - 1] =
@@ -74,7 +72,7 @@
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_PARAM_CMD(SET),
&req, sizeof(req), false);
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index d29579f..1c2cea2 100644
+index 0d25c5ff..35573003 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -14,7 +14,7 @@
@@ -125,10 +123,10 @@
#else
return 0;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 4090fad..7011f66 100644
+index f0288cca..6254604f 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -73,6 +73,7 @@
+@@ -74,6 +74,7 @@
#define MT7996_EEPROM_BLOCK_SIZE 16
#define MT7996_TOKEN_SIZE 16384
#define MT7996_HW_TOKEN_SIZE 8192
@@ -137,7 +135,7 @@
#define MT7996_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
#define MT7996_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
diff --git a/mt7996/pci.c b/mt7996/pci.c
-index 05830c0..4e95777 100644
+index 05830c01..4e957771 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -171,7 +171,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
@@ -182,7 +180,7 @@
if (mtk_wed_device_active(&dev->mt76.mmio.wed_hif2))
mtk_wed_device_detach(&dev->mt76.mmio.wed_hif2);
diff --git a/wed.c b/wed.c
-index 61a6bad..634c95c 100644
+index 61a6badf..634c95cf 100644
--- a/wed.c
+++ b/wed.c
@@ -120,7 +120,7 @@ int mt76_wed_offload_enable(struct mtk_wed_device *wed)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0070-mtk-wifi-mt76-mt7996-wed-add-wed-support-for-mt7992.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0075-mtk-mt76-mt7996-add-wed-support-for-mt7992.patch
similarity index 95%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0070-mtk-wifi-mt76-mt7996-wed-add-wed-support-for-mt7992.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0075-mtk-mt76-mt7996-add-wed-support-for-mt7992.patch
index 2e43a51..dde0b77 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0070-mtk-wifi-mt76-mt7996-wed-add-wed-support-for-mt7992.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0075-mtk-mt76-mt7996-add-wed-support-for-mt7992.patch
@@ -1,13 +1,11 @@
-From 048688dc31d7f531fc9d99d0e20820189ede9c53 Mon Sep 17 00:00:00 2001
+From 3d75798a66a4bedb6b42cf28b7c79ed8076b263b Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Fri, 8 Sep 2023 11:57:39 +0800
-Subject: [PATCH 070/116] mtk: wifi: mt76: mt7996: wed: add wed support for
- mt7992
-
-Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
+Subject: [PATCH 075/199] mtk: mt76: mt7996: add wed support for mt7992
Fix incomplete WED initialization for Kite band-1 RX ring.
+Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
---
mt7996/dma.c | 91 +++++++++++++++++++++++++++++++++----------------
@@ -20,7 +18,7 @@
7 files changed, 142 insertions(+), 48 deletions(-)
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index d9e1b17..d62dc8b 100644
+index d9e1b17f..d62dc8ba 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -77,18 +77,23 @@ static void mt7996_dma_config(struct mt7996_dev *dev)
@@ -168,10 +166,10 @@
if (mt7996_band_valid(dev, MT_BAND2)) {
/* rx rro data queue for band2 */
diff --git a/mt7996/init.c b/mt7996/init.c
-index ff629e8..e29cebe 100644
+index 3b1f4273..f682423a 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -813,6 +813,7 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+@@ -815,6 +815,7 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
/* interrupt enable */
mt76_wr(dev, MT_RRO_HOST_INT_ENA,
MT_RRO_HOST_INT_ENA_HOST_RRO_DONE_ENA);
@@ -179,7 +177,7 @@
#endif
}
-@@ -865,6 +866,17 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
+@@ -867,6 +868,17 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
dev->wed_rro.addr_elem[i].phy_addr;
}
@@ -198,10 +196,10 @@
MT7996_RRO_WINDOW_MAX_LEN * sizeof(*addr),
&dev->wed_rro.session.phy_addr,
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 8396e6d..b470380 100644
+index 1792726c..1f3445bb 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -2007,6 +2007,10 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -2004,6 +2004,10 @@ void mt7996_mac_reset_work(struct work_struct *work)
mt76_wr(dev, MT_INT_MASK_CSR, wed_irq_mask);
@@ -213,7 +211,7 @@
true);
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index 1c2cea2..3f0692c 100644
+index 35573003..bfe92ceb 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -313,7 +313,8 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
@@ -305,10 +303,10 @@
dev->mt76.rx_token_size = MT7996_TOKEN_SIZE + wed->wlan.rx_npkt;
}
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 7011f66..929a077 100644
+index 6254604f..834e8fc0 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -121,6 +121,10 @@
+@@ -122,6 +122,10 @@
#define MT7996_DRR_STA_AC2_QNTM_MASK GENMASK(18, 16)
#define MT7996_DRR_STA_AC3_QNTM_MASK GENMASK(22, 20)
@@ -319,7 +317,7 @@
struct mt7996_vif;
struct mt7996_sta;
struct mt7996_dfs_pulse;
-@@ -180,7 +184,7 @@ enum mt7996_rxq_id {
+@@ -181,7 +185,7 @@ enum mt7996_rxq_id {
MT7996_RXQ_BAND1 = 5, /* for mt7992 */
MT7996_RXQ_BAND2 = 5,
MT7996_RXQ_RRO_BAND0 = 8,
@@ -328,7 +326,7 @@
MT7996_RXQ_RRO_BAND2 = 6,
MT7996_RXQ_MSDU_PG_BAND0 = 10,
MT7996_RXQ_MSDU_PG_BAND1 = 11,
-@@ -546,6 +550,10 @@ struct mt7996_dev {
+@@ -547,6 +551,10 @@ struct mt7996_dev {
void *ptr;
dma_addr_t phy_addr;
} session;
@@ -340,7 +338,7 @@
struct work_struct work;
struct list_head poll_list;
diff --git a/mt7996/pci.c b/mt7996/pci.c
-index 4e95777..f0d3f19 100644
+index 4e957771..f0d3f199 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -107,7 +107,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
@@ -376,7 +374,7 @@
goto free_wed_or_irq_vector;
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index 91159c6..e6427a3 100644
+index 91159c63..e6427a35 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -77,6 +77,8 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0071-mtk-wifi-mt76-mt7992-wed-add-2pcie-one-wed-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0076-mtk-mt76-add-2pcie-one-wed-support.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0071-mtk-wifi-mt76-mt7992-wed-add-2pcie-one-wed-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0076-mtk-mt76-add-2pcie-one-wed-support.patch
index cb745f1..0930043 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0071-mtk-wifi-mt76-mt7992-wed-add-2pcie-one-wed-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0076-mtk-mt76-add-2pcie-one-wed-support.patch
@@ -1,8 +1,7 @@
-From 2342f41c5f878f7d419d20a46daa3b025c024b08 Mon Sep 17 00:00:00 2001
+From 52d7db874a75d9efdbec2f42bdff2ce917e6dd01 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Wed, 13 Sep 2023 17:35:43 +0800
-Subject: [PATCH 071/116] mtk: wifi: mt76: mt7992: wed: add 2pcie one wed
- support
+Subject: [PATCH 076/199] mtk: mt76: add 2pcie one wed support
Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
---
@@ -14,7 +13,7 @@
5 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index d62dc8b..c23b0d6 100644
+index d62dc8ba..c23b0d65 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -355,6 +355,13 @@ static void mt7996_dma_enable(struct mt7996_dev *dev, bool reset)
@@ -55,7 +54,7 @@
dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].wed = wed;
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index 3f0692c..91567a0 100644
+index bfe92ceb..4baae0e9 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -375,10 +375,10 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
@@ -84,7 +83,7 @@
mt76_wr(dev, MT_INT_MASK_CSR, mdev->mmio.irqmask);
mt76_wr(dev, MT_INT1_MASK_CSR, mdev->mmio.irqmask);
diff --git a/mt7996/mtk_debug.h b/mt7996/mtk_debug.h
-index 27d8f1c..da2a607 100644
+index 27d8f1cb..da2a6072 100644
--- a/mt7996/mtk_debug.h
+++ b/mt7996/mtk_debug.h
@@ -561,6 +561,11 @@ struct queue_desc {
@@ -100,10 +99,10 @@
//#define WF_WFDMA_MCU_DMA0_BASE 0x02000
#define WF_WFDMA_MCU_DMA0_BASE 0x54000000
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index ff84d6f..70ff761 100644
+index 1f754796..06c0db3f 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -559,14 +559,22 @@ mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
+@@ -558,14 +558,22 @@ mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL0_ADDR);
dump_dma_rx_ring_info(s, dev, "R5:Data1(MAC2H)", "Both",
WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL0_ADDR);
@@ -130,7 +129,7 @@
dump_dma_rx_ring_info(s, dev, "R10:MSDU_PG0(MAC2H)", "Both",
WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL0_ADDR);
dump_dma_rx_ring_info(s, dev, "R11:MSDU_PG1(MAC2H)", "Both",
-@@ -584,15 +592,18 @@ mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
+@@ -583,15 +591,18 @@ mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL0_ADDR);
dump_dma_tx_ring_info(s, dev, "T22:TXD?(H2WA)", "AP",
WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL0_ADDR);
@@ -153,7 +152,7 @@
/* MCU DMA information */
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index e6427a3..cbd7170 100644
+index e6427a35..cbd71706 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -411,6 +411,7 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0072-mtk-wifi-mt76-mt7996-Remove-wed-rro-ring-add-napi-at.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0077-mtk-mt76-mt7996-Remove-wed-rro-ring-add-napi-at-init.patch
similarity index 81%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0072-mtk-wifi-mt76-mt7996-Remove-wed-rro-ring-add-napi-at.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0077-mtk-mt76-mt7996-Remove-wed-rro-ring-add-napi-at-init.patch
index 759ac00..afa7f1a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0072-mtk-wifi-mt76-mt7996-Remove-wed-rro-ring-add-napi-at.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0077-mtk-mt76-mt7996-Remove-wed-rro-ring-add-napi-at-init.patch
@@ -1,8 +1,8 @@
-From 6701c4d78ed81ac7d04b73c213f38f2d3ba1a735 Mon Sep 17 00:00:00 2001
+From 04d9010a357a8d1d98aefd5263fbf8d27bc19d06 Mon Sep 17 00:00:00 2001
From: mtk27745 <rex.lu@mediatek.com>
Date: Mon, 6 Nov 2023 10:16:34 +0800
-Subject: [PATCH 072/116] mtk: wifi: mt76: mt7996: Remove wed rro ring add napi
- at init state
+Subject: [PATCH 077/199] mtk: mt76: mt7996: Remove wed rro ring add napi at
+ init state
without this patch. rro ring will add napi at initial state. once rro ring add napi, it will have chance to be used by host driver. if host driver accessed the ring data, it will cause some issue.
@@ -12,7 +12,7 @@
1 file changed, 4 insertions(+)
diff --git a/dma.c b/dma.c
-index e23b744..38701c7 100644
+index e23b744b..38701c71 100644
--- a/dma.c
+++ b/dma.c
@@ -1017,6 +1017,10 @@ mt76_dma_init(struct mt76_dev *dev,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0073-mtk-wifi-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0078-mtk-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch
similarity index 76%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0073-mtk-wifi-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0078-mtk-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch
index 4e46bfe..987c14a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0073-mtk-wifi-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0078-mtk-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch
@@ -1,8 +1,7 @@
-From 86d498b85d7e85f5c75b83a39a17f744357481b7 Mon Sep 17 00:00:00 2001
+From a606926ce504162a64ebab655645fb39e2035f0e Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Wed, 29 Nov 2023 13:56:52 +0800
-Subject: [PATCH 073/116] mtk: wifi: mt76: mt7996: Remove wed_stop during L1
- SER
+Subject: [PATCH 078/199] mtk: mt76: mt7996: Remove wed_stop during L1 SER
Align logan L1 SER flow. During L1 SER, didn't need to close wed interrupt.
@@ -12,10 +11,10 @@
1 file changed, 6 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index b470380..0805251 100644
+index 1f3445bb..25f036bd 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1950,12 +1950,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
+@@ -1947,12 +1947,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
dev_info(dev->mt76.dev,"\n%s L1 SER recovery start.",
wiphy_name(dev->mt76.hw->wiphy));
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0074-mtk-wifi-mt76-mt7996-Refactor-rro-del-ba-command-for.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0079-mtk-mt76-mt7996-Refactor-rro-del-ba-command-format.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0074-mtk-wifi-mt76-mt7996-Refactor-rro-del-ba-command-for.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0079-mtk-mt76-mt7996-Refactor-rro-del-ba-command-format.patch
index 481382a..74173c9 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0074-mtk-wifi-mt76-mt7996-Refactor-rro-del-ba-command-for.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0079-mtk-mt76-mt7996-Refactor-rro-del-ba-command-format.patch
@@ -1,8 +1,7 @@
-From 319c0c7f599ca9835577ccfd91aff59af02b1999 Mon Sep 17 00:00:00 2001
+From 10e60d0f16d93912198c3903e5aa114e78fc527f Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Wed, 29 Nov 2023 15:51:04 +0800
-Subject: [PATCH 074/116] mtk: wifi: mt76: mt7996: Refactor rro del ba command
- format
+Subject: [PATCH 079/199] mtk: mt76: mt7996: Refactor rro del ba command format
1. remove unused struct
2. refactor upstream del ba command format
@@ -13,7 +12,7 @@
1 file changed, 3 insertions(+), 47 deletions(-)
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 700330a..a58f52d 100644
+index c55fb527..19572d85 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
@@ -273,7 +273,9 @@ struct mt7996_mcu_wed_rro_ba_delete_event {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0075-mtk-wifi-mt76-mt7996-get-airtime-and-RSSI-via-MCU-co.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0080-mtk-mt76-mt7996-get-airtime-and-RSSI-via-MCU-command.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0075-mtk-wifi-mt76-mt7996-get-airtime-and-RSSI-via-MCU-co.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0080-mtk-mt76-mt7996-get-airtime-and-RSSI-via-MCU-command.patch
index a553070..e0171ea 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0075-mtk-wifi-mt76-mt7996-get-airtime-and-RSSI-via-MCU-co.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0080-mtk-mt76-mt7996-get-airtime-and-RSSI-via-MCU-command.patch
@@ -1,37 +1,35 @@
-From a08f12c4e90f1c849c3e8dc0db60fe294b63f3fe Mon Sep 17 00:00:00 2001
+From ef1bc404cc98a3ab556f1efa25debc81008e91ec Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Fri, 17 Nov 2023 18:08:06 +0800
-Subject: [PATCH 075/116] mtk: wifi: mt76: mt7996: get airtime and RSSI via MCU
+Subject: [PATCH 080/199] mtk: mt76: mt7996: get airtime and RSSI via MCU
commands
Direct access to WTBL for airtime and RSSI may cause synchronization issue with FW.
Moreover, frequent access to WTBL, whenever TX-Free-Done event is received, leads to heavy CPU overheads.
Therefore, indirect access to WTBL, through FW, with lower frequence is performed.
-Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
---
- mt76.h | 20 +++++
+ mt76.h | 18 +++++
mt76_connac_mcu.h | 14 +++-
- mt7996/debugfs.c | 17 ++---
- mt7996/mac.c | 145 ++++++-----------------------------
- mt7996/mcu.c | 177 +++++++++++++++++++++++++++++++++++++++++--
- mt7996/mcu.h | 32 +++++++-
- mt7996/mt7996.h | 26 ++++++-
- mt7996/mtk_debugfs.c | 71 +++++++++++++++++
+ mt7996/debugfs.c | 17 +++--
+ mt7996/mac.c | 145 +++++++-------------------------------
+ mt7996/mcu.c | 161 +++++++++++++++++++++++++++++++++++++++++--
+ mt7996/mcu.h | 24 +++++++
+ mt7996/mt7996.h | 26 +++++--
+ mt7996/mtk_debugfs.c | 71 +++++++++++++++++++
mt7996/regs.h | 2 +
- 9 files changed, 361 insertions(+), 143 deletions(-)
+ 9 files changed, 336 insertions(+), 142 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 677f68f..28defd4 100644
+index e3c209ff..8f3541e2 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -332,11 +332,15 @@ struct mt76_sta_stats {
+@@ -332,11 +332,13 @@ struct mt76_sta_stats {
u32 tx_packets; /* unit: MSDU */
u32 tx_retries;
u32 tx_failed;
-+ u32 tx_total_mpdu_cnt;
-+ u32 tx_failed_mpdu_cnt;
+ u64 tx_airtime;
/* WED RX */
u64 rx_bytes;
@@ -42,7 +40,7 @@
};
enum mt76_wcid_flags {
-@@ -1335,6 +1339,22 @@ static inline int mt76_decr(int val, int size)
+@@ -1326,6 +1328,22 @@ static inline int mt76_decr(int val, int size)
u8 mt76_ac_to_hwq(u8 ac);
@@ -66,10 +64,10 @@
mtxq_to_txq(struct mt76_txq *mtxq)
{
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 61a14a8..f389470 100644
+index 6be7e6a6..f4574aaa 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1372,11 +1372,23 @@ enum {
+@@ -1382,11 +1382,23 @@ enum {
UNI_OFFLOAD_OFFLOAD_BMC_RPY_DETECT,
};
@@ -95,10 +93,10 @@
UNI_ALL_STA_GI_MODE,
UNI_ALL_STA_TXRX_MSDU_COUNT,
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index f8ba573..e26de48 100644
+index 3b58b8ba..8f8608fa 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
-@@ -992,12 +992,11 @@ mt7996_airtime_read(struct seq_file *s, void *data)
+@@ -979,12 +979,11 @@ mt7996_airtime_read(struct seq_file *s, void *data)
{
struct mt7996_dev *dev = dev_get_drvdata(s->private);
struct mt76_dev *mdev = &dev->mt76;
@@ -112,7 +110,7 @@
u16 i;
seq_printf(s, "VoW Airtime Information:\n");
-@@ -1009,16 +1008,16 @@ mt7996_airtime_read(struct seq_file *s, void *data)
+@@ -996,16 +995,16 @@ mt7996_airtime_read(struct seq_file *s, void *data)
msta = container_of(wcid, struct mt7996_sta, wcid);
sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
@@ -137,7 +135,7 @@
rcu_read_unlock();
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 0805251..782594c 100644
+index 25f036bd..06a86146 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -12,8 +12,6 @@
@@ -260,7 +258,7 @@
void mt7996_mac_enable_rtscts(struct mt7996_dev *dev,
struct ieee80211_vif *vif, bool enable)
{
-@@ -1206,8 +1100,6 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1209,8 +1103,6 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
}
}
@@ -326,7 +324,7 @@
ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
MT7996_WATCHDOG_TIME);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 6366cf0..b02303b 100644
+index 46611191..c7f9a56d 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -563,7 +563,8 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -382,7 +380,7 @@
ret = mt7996_mcu_set_vow_drr_ctrl(phy, msta, VOW_DRR_CTRL_STA_BSS_GROUP);
if (ret)
-@@ -4839,9 +4856,155 @@ int mt7996_mcu_set_rro(struct mt7996_dev *dev, u16 tag, u16 val)
+@@ -4842,9 +4859,139 @@ int mt7996_mcu_set_rro(struct mt7996_dev *dev, u16 tag, u16 val)
sizeof(req), true);
}
@@ -459,22 +457,6 @@
+ }
+ }
+ break;
-+ case UNI_PER_STA_TX_CNT:
-+ for (i = 0; i < sta_num; ++i) {
-+ wlan_idx = le16_to_cpu(res->tx_cnt[i].wlan_idx);
-+ wcid = rcu_dereference(dev->wcid[wlan_idx]);
-+ if (wcid) {
-+ wcid->stats.tx_total_mpdu_cnt +=
-+ le32_to_cpu(res->tx_cnt[i].total);
-+ wcid->stats.tx_failed_mpdu_cnt +=
-+ le32_to_cpu(res->tx_cnt[i].failed);
-+ } else {
-+ ret = -EINVAL;
-+ dev_err(dev->dev, "Failed to update TX MPDU counts "
-+ "for invalid WCID: %hu\n", wlan_idx);
-+ }
-+ }
-+ break;
+ default:
+ ret = -EINVAL;
+ dev_err(dev->dev, "Unknown UNI_PER_STA_INFO_TAG: %d\n", tag);
@@ -540,7 +522,7 @@
struct {
u8 _rsv[4];
-@@ -4852,7 +5015,7 @@ int mt7996_mcu_get_all_sta_info(struct mt7996_phy *phy, u16 tag)
+@@ -4855,7 +5002,7 @@ int mt7996_mcu_get_all_sta_info(struct mt7996_phy *phy, u16 tag)
.len = cpu_to_le16(sizeof(req) - 4),
};
@@ -550,10 +532,10 @@
}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index a58f52d..e64812c 100644
+index 19572d85..5aa55e4f 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -199,6 +199,31 @@ struct mt7996_mcu_mib {
+@@ -199,6 +199,23 @@ struct mt7996_mcu_mib {
__le64 data;
} __packed;
@@ -563,13 +545,6 @@
+ u8 rcpi[4];
+} __packed;
+
-+struct per_sta_tx_cnt {
-+ __le16 wlan_idx;
-+ u8 __rsv[2];
-+ __le32 total;
-+ __le32 failed;
-+} __packed;
-+
+struct mt7996_mcu_per_sta_info_event {
+ u8 __rsv[4];
+
@@ -578,38 +553,31 @@
+
+ union {
+ struct per_sta_rssi rssi[0];
-+ struct per_sta_tx_cnt tx_cnt[0];
+ };
+} __packed;
+
struct all_sta_trx_rate {
__le16 wlan_idx;
u8 __rsv1[2];
-@@ -237,13 +262,18 @@ struct mt7996_mcu_all_sta_info_event {
- __le32 tx_bytes[IEEE80211_NUM_ACS];
- __le32 rx_bytes[IEEE80211_NUM_ACS];
- } adm_stat[0] __packed;
--
- struct {
- __le16 wlan_idx;
- u8 rsv[2];
+@@ -244,6 +261,13 @@ struct mt7996_mcu_all_sta_info_event {
__le32 tx_msdu_cnt;
__le32 rx_msdu_cnt;
- } msdu_cnt[0] __packed;
-+ struct {
+ } __packed, msdu_cnt);
++
++ DECLARE_FLEX_ARRAY(struct {
+ __le16 wlan_idx;
-+ u8 __rsv[2];
++ u8 rsv[2];
+ __le32 tx[IEEE80211_NUM_ACS];
+ __le32 rx[IEEE80211_NUM_ACS];
-+ } airtime[0] __packed;
++ } __packed, airtime);
} __packed;
} __packed;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 929a077..a0cc8f3 100644
+index 834e8fc0..b0b61b12 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -125,6 +125,8 @@
+@@ -126,6 +126,8 @@
#define MT7996_RRO_MSDU_PG_CR_CNT 8
#define MT7996_RRO_MSDU_PG_SIZE_PER_CR 0x10000
@@ -618,7 +586,7 @@
struct mt7996_vif;
struct mt7996_sta;
struct mt7996_dfs_pulse;
-@@ -297,8 +299,6 @@ struct mt7996_vow_sta_ctrl {
+@@ -298,8 +300,6 @@ struct mt7996_vow_sta_ctrl {
bool paused;
u8 bss_grp_idx;
u8 drr_quantum[IEEE80211_NUM_ACS];
@@ -627,7 +595,7 @@
};
struct mt7996_sta {
-@@ -307,7 +307,6 @@ struct mt7996_sta {
+@@ -308,7 +308,6 @@ struct mt7996_sta {
struct mt7996_vif *vif;
struct list_head rc_list;
@@ -635,7 +603,7 @@
int ack_signal;
struct ewma_avg_signal avg_ack_signal;
-@@ -404,6 +403,21 @@ struct mt7996_air_monitor_ctrl {
+@@ -405,6 +404,21 @@ struct mt7996_air_monitor_ctrl {
};
#endif
@@ -657,7 +625,7 @@
struct mt7996_phy {
struct mt76_phy *mt76;
struct mt7996_dev *dev;
-@@ -599,6 +613,7 @@ struct mt7996_dev {
+@@ -600,6 +614,7 @@ struct mt7996_dev {
u32 fw_dbg_module;
u8 fw_dbg_lv;
u32 bcn_total_cnt[__MT_MAX_BAND];
@@ -665,7 +633,7 @@
} dbg;
const struct mt7996_dbg_reg_desc *dbg_reg;
#endif
-@@ -824,7 +839,10 @@ int mt7996_mcu_fw_dbg_ctrl(struct mt7996_dev *dev, u32 module, u8 level);
+@@ -825,7 +840,10 @@ int mt7996_mcu_fw_dbg_ctrl(struct mt7996_dev *dev, u32 module, u8 level);
int mt7996_mcu_trigger_assert(struct mt7996_dev *dev);
void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb);
void mt7996_mcu_exit(struct mt7996_dev *dev);
@@ -678,10 +646,10 @@
int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data);
int mt7996_mcu_get_tx_power_info(struct mt7996_phy *phy, u8 category, void *event);
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index 70ff761..dab5b23 100644
+index 06c0db3f..275beb48 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -3106,6 +3106,69 @@ mt7996_vow_drr_dbg(void *data, u64 val)
+@@ -3065,6 +3065,69 @@ mt7996_vow_drr_dbg(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(fops_vow_drr_dbg, NULL,
mt7996_vow_drr_dbg, "%lld\n");
@@ -751,7 +719,7 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -3205,6 +3268,14 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -3163,6 +3226,14 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
debugfs_create_file("muru_prot_thr", 0200, dir, phy, &fops_muru_prot_thr);
@@ -767,7 +735,7 @@
}
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index cbd7170..a001d9f 100644
+index cbd71706..a001d9fd 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -122,6 +122,8 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0076-mtk-wifi-mt76-mt7996-add-support-for-WMM-PBC-configu.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0081-mtk-mt76-mt7996-add-support-for-WMM-PBC-configuratio.patch
similarity index 92%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0076-mtk-wifi-mt76-mt7996-add-support-for-WMM-PBC-configu.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0081-mtk-mt76-mt7996-add-support-for-WMM-PBC-configuratio.patch
index c3b13e6..549d7e0 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0076-mtk-wifi-mt76-mt7996-add-support-for-WMM-PBC-configu.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0081-mtk-mt76-mt7996-add-support-for-WMM-PBC-configuratio.patch
@@ -1,7 +1,7 @@
-From b524ec9e1239ff6edd8ffadf8ce9fe03c2621f64 Mon Sep 17 00:00:00 2001
+From 3b97fa94c4e5a839ac9e31b63e07090b22e84330 Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Thu, 4 Jan 2024 09:47:00 +0800
-Subject: [PATCH 076/116] mtk: wifi: mt76: mt7996: add support for WMM PBC
+Subject: [PATCH 081/199] mtk: mt76: mt7996: add support for WMM PBC
configuration
Query per-AC-queue packet statistics from WA, and determine if multi-AC transmission is ongoing.
@@ -18,10 +18,10 @@
6 files changed, 105 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index f389470..92f0bd7 100644
+index f4574aaa..c8eedf36 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1027,6 +1027,7 @@ enum {
+@@ -1037,6 +1037,7 @@ enum {
MCU_EXT_EVENT_ASSERT_DUMP = 0x23,
MCU_EXT_EVENT_RDD_REPORT = 0x3a,
MCU_EXT_EVENT_CSA_NOTIFY = 0x4f,
@@ -29,7 +29,7 @@
MCU_EXT_EVENT_WA_TX_STAT = 0x74,
MCU_EXT_EVENT_BCC_NOTIFY = 0x75,
MCU_EXT_EVENT_MURU_CTRL = 0x9f,
-@@ -1226,6 +1227,7 @@ enum {
+@@ -1236,6 +1237,7 @@ enum {
MCU_EXT_CMD_TXDPD_CAL = 0x60,
MCU_EXT_CMD_CAL_CACHE = 0x67,
MCU_EXT_CMD_RED_ENABLE = 0x68,
@@ -38,7 +38,7 @@
MCU_EXT_CMD_SET_RADAR_TH = 0x7c,
MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d,
diff --git a/mt7996/init.c b/mt7996/init.c
-index e29cebe..f411146 100644
+index f682423a..7c273f9c 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
@@ -1536,6 +1536,8 @@ int mt7996_register_device(struct mt7996_dev *dev)
@@ -51,7 +51,7 @@
if (ret)
return ret;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 782594c..e3758ff 100644
+index 06a86146..099e97ef 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -2298,6 +2298,10 @@ void mt7996_mac_work(struct work_struct *work)
@@ -66,7 +66,7 @@
test_bit(MT76_STATE_RUNNING, &mdev->phys[i]->state))
break;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index b02303b..82ed9e8 100644
+index c7f9a56d..28cedb60 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -669,6 +669,82 @@ mt7996_mcu_rx_thermal_notify(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -162,10 +162,10 @@
break;
}
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index e64812c..d24874a 100644
+index 5aa55e4f..8ffb16f8 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -375,10 +375,25 @@ enum {
+@@ -369,10 +369,25 @@ enum {
MCU_WA_PARAM_CMD_DEBUG,
};
@@ -192,10 +192,10 @@
MCU_WA_PARAM_RED_CONFIG = 0x40,
};
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index a0cc8f3..1996539 100644
+index b0b61b12..fb1d1d84 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -606,6 +606,9 @@ struct mt7996_dev {
+@@ -607,6 +607,9 @@ struct mt7996_dev {
u8 wtbl_size_group;
struct mt7996_vow_ctrl vow;
@@ -205,7 +205,7 @@
#ifdef CONFIG_MTK_DEBUG
u16 wlan_idx;
struct {
-@@ -857,6 +860,7 @@ int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable);
+@@ -858,6 +861,7 @@ int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable);
int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, struct mt7996_sta *msta,
enum vow_drr_ctrl_id id);
int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0077-mtk-wifi-mt76-mt7996-eagle-support-extra-option_type.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0082-mtk-mt76-mt7996-eagle-support-extra-option_type.patch
similarity index 92%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0077-mtk-wifi-mt76-mt7996-eagle-support-extra-option_type.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0082-mtk-mt76-mt7996-eagle-support-extra-option_type.patch
index 658e5f7..9b0e560 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0077-mtk-wifi-mt76-mt7996-eagle-support-extra-option_type.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0082-mtk-mt76-mt7996-eagle-support-extra-option_type.patch
@@ -1,18 +1,16 @@
-From 0749ce8ea6a89c47f1e5b1a85ad5dfcd8fc4dc02 Mon Sep 17 00:00:00 2001
+From b464b7e32093adb25adb0949df6debcb5c60780e Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Thu, 1 Feb 2024 10:32:42 +0800
-Subject: [PATCH 077/116] mtk: wifi: mt76: mt7996: eagle support extra
- option_type
+Subject: [PATCH 082/199] mtk: mt76: mt7996: eagle support extra option_type
1. eagle + mt7988d option_type 2 support
2. eagle single pcie support
-Signed-off-by: Rex Lu <rex.lu@mediatek.com>
-
1. adjust pcie outstanding value by pcie speed. not no longer by option_type.
-Signed-off-by: Rex Lu <rex.lu@mediatek.com>
(cherry picked from commit 31d64e0f571eb06ed67f4916bc12fbcfe1263c47)
+
+Signed-off-by: Rex Lu <rex.lu@mediatek.com>
---
mt7996/dma.c | 51 +++++++++++++++++++++++++++++++++----
mt7996/init.c | 67 ++++++++++++++++++++++++++++++++++++++-----------
@@ -23,7 +21,7 @@
6 files changed, 123 insertions(+), 22 deletions(-)
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index c23b0d6..3dc0e8a 100644
+index c23b0d65..3dc0e8a1 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -12,12 +12,20 @@ int mt7996_init_tx_queues(struct mt7996_phy *phy, int idx, int n_desc,
@@ -111,10 +109,10 @@
mt76_wr(dev, MT_WFDMA0_PAUSE_RX_Q_45_TH + hif1_ofs, 0xc000c);
mt76_wr(dev, MT_WFDMA0_PAUSE_RX_Q_67_TH + hif1_ofs, 0x10008);
diff --git a/mt7996/init.c b/mt7996/init.c
-index f411146..1e7cd52 100644
+index 7c273f9c..910ffccf 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -511,7 +511,7 @@ static void mt7996_mac_init_basic_rates(struct mt7996_dev *dev)
+@@ -513,7 +513,7 @@ static void mt7996_mac_init_basic_rates(struct mt7996_dev *dev)
void mt7996_mac_init(struct mt7996_dev *dev)
{
#define HIF_TXD_V2_1 0x21
@@ -123,7 +121,7 @@
mt76_clear(dev, MT_MDP_DCR2, MT_MDP_DCR2_RX_TRANS_SHORT);
-@@ -525,22 +525,45 @@ void mt7996_mac_init(struct mt7996_dev *dev)
+@@ -527,22 +527,45 @@ void mt7996_mac_init(struct mt7996_dev *dev)
}
/* rro module init */
@@ -179,7 +177,7 @@
}
mt7996_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
-@@ -618,9 +641,22 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -620,9 +643,22 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
if (phy)
return 0;
@@ -205,7 +203,7 @@
}
mphy = mt76_alloc_phy(&dev->mt76, sizeof(*phy), &mt7996_ops, band);
-@@ -1059,6 +1095,9 @@ int mt7996_get_chip_sku(struct mt7996_dev *dev)
+@@ -1060,6 +1096,9 @@ int mt7996_get_chip_sku(struct mt7996_dev *dev)
static int mt7996_init_hardware(struct mt7996_dev *dev)
{
int ret, idx;
@@ -216,10 +214,10 @@
mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
if (is_mt7992(&dev->mt76)) {
diff --git a/mt7996/main.c b/mt7996/main.c
-index 801e480..1894588 100644
+index d26c55ed..534a476a 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -1606,8 +1606,19 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1610,8 +1610,19 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
@@ -242,7 +240,7 @@
if (!mtk_wed_device_active(wed))
return -ENODEV;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 1996539..3f1f9b3 100644
+index fb1d1d84..d17b169a 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -8,6 +8,7 @@
@@ -253,7 +251,7 @@
#include "../mt76_connac.h"
#include "regs.h"
-@@ -349,6 +350,8 @@ struct mt7996_hif {
+@@ -350,6 +351,8 @@ struct mt7996_hif {
struct device *dev;
void __iomem *regs;
int irq;
@@ -262,7 +260,7 @@
};
struct mt7996_scs_ctrl {
-@@ -579,6 +582,8 @@ struct mt7996_dev {
+@@ -580,6 +583,8 @@ struct mt7996_dev {
u8 eeprom_mode;
u32 bg_nxt_freq;
@@ -272,7 +270,7 @@
u8 fw_debug_wm;
u8 fw_debug_wa;
diff --git a/mt7996/pci.c b/mt7996/pci.c
-index f0d3f19..24d69d4 100644
+index f0d3f199..24d69d4d 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -5,7 +5,6 @@
@@ -292,7 +290,7 @@
list_add(&hif->list, &hif_list);
spin_unlock_bh(&hif_lock);
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index a001d9f..a0e4b3e 100644
+index a001d9fd..a0e4b3e1 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -435,6 +435,7 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0078-mtk-wifi-mt76-mt7996-support-enable-disable-thermal-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0083-mtk-mt76-mt7996-support-enable-disable-thermal-prote.patch
similarity index 85%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0078-mtk-wifi-mt76-mt7996-support-enable-disable-thermal-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0083-mtk-mt76-mt7996-support-enable-disable-thermal-prote.patch
index 90ce5bf..f6331d2 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0078-mtk-wifi-mt76-mt7996-support-enable-disable-thermal-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0083-mtk-mt76-mt7996-support-enable-disable-thermal-prote.patch
@@ -1,8 +1,8 @@
-From 4ced99d2b25f8804f194317675f3a7cce0f493b2 Mon Sep 17 00:00:00 2001
+From 49d072013ef5a88ca6040d18085885773967d5d4 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 27 Jul 2023 19:35:32 +0800
-Subject: [PATCH 078/116] mtk: wifi: mt76: mt7996: support enable/disable
- thermal protection mechanism
+Subject: [PATCH 083/199] mtk: mt76: mt7996: support enable/disable thermal
+ protection mechanism
This commit adds a new debugfs thermal_enable to enable/disable thermal
protection mechanism. The purpose of this commit is for autotest to
@@ -24,7 +24,7 @@
3 files changed, 47 insertions(+)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 1894588..775d81e 100644
+index 534a476a..8c93297a 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -91,6 +91,7 @@ int mt7996_run(struct ieee80211_hw *hw)
@@ -36,10 +36,10 @@
ret = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_SKU_POWER_LIMIT_CTRL,
dev->dbg.sku_disable ? 0 : phy->sku_limit_en);
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 3f1f9b3..3069e90 100644
+index d17b169a..6e96194b 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -488,6 +488,7 @@ struct mt7996_phy {
+@@ -489,6 +489,7 @@ struct mt7996_phy {
#ifdef CONFIG_MTK_DEBUG
bool sr_enable:1;
bool enhanced_sr_enable:1;
@@ -48,10 +48,10 @@
};
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index dab5b23..de21a95 100644
+index 275beb48..66ab74d2 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -3169,6 +3169,49 @@ mt7996_show_rro_mib(struct seq_file *s, void *data)
+@@ -3128,6 +3128,49 @@ mt7996_show_rro_mib(struct seq_file *s, void *data)
return 0;
}
@@ -101,7 +101,7 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -3276,6 +3319,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -3234,6 +3277,8 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
mt7996_show_rro_mib);
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0079-mtk-wifi-mt76-mt7996-support-thermal-recal-debug-com.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0084-mtk-mt76-mt7996-support-thermal-recal-debug-command.patch
similarity index 84%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0079-mtk-wifi-mt76-mt7996-support-thermal-recal-debug-com.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0084-mtk-mt76-mt7996-support-thermal-recal-debug-command.patch
index bf9ce92..e560caf 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0079-mtk-wifi-mt76-mt7996-support-thermal-recal-debug-com.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0084-mtk-mt76-mt7996-support-thermal-recal-debug-command.patch
@@ -1,7 +1,7 @@
-From 5a95bf563b00a4d60292580619c8bc041697b548 Mon Sep 17 00:00:00 2001
+From 857348ab99cd5ba83f73c4da02c70f2004b6f10b Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 4 Jan 2024 19:53:37 +0800
-Subject: [PATCH 079/116] mtk: wifi: mt76: mt7996: support thermal recal debug
+Subject: [PATCH 084/199] mtk: mt76: mt7996: support thermal recal debug
command
Add support thermal recal debug command.
@@ -23,10 +23,10 @@
4 files changed, 40 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 92f0bd7..c19f8e0 100644
+index c8eedf36..1589a716 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1287,6 +1287,7 @@ enum {
+@@ -1297,6 +1297,7 @@ enum {
MCU_UNI_CMD_TESTMODE_TRX_PARAM = 0x42,
MCU_UNI_CMD_TESTMODE_CTRL = 0x46,
MCU_UNI_CMD_PRECAL_RESULT = 0x47,
@@ -35,10 +35,10 @@
MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
MCU_UNI_CMD_PER_STA_INFO = 0x6d,
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 3069e90..69bcf78 100644
+index 6e96194b..0e6b7595 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -1032,6 +1032,7 @@ void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type);
+@@ -1033,6 +1033,7 @@ void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type);
void mt7996_tm_update_channel(struct mt7996_phy *phy);
int mt7996_mcu_set_vow_drr_dbg(struct mt7996_dev *dev, u32 val);
@@ -47,10 +47,10 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index de21a95..c787551 100644
+index 66ab74d2..cc1224ed 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -3212,6 +3212,22 @@ out:
+@@ -3171,6 +3171,22 @@ out:
DEFINE_DEBUGFS_ATTRIBUTE(fops_thermal_enable, mt7996_thermal_enable_get,
mt7996_thermal_enable_set, "%lld\n");
@@ -73,7 +73,7 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -3320,6 +3336,7 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -3278,6 +3294,7 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
}
debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
@@ -82,10 +82,10 @@
return 0;
}
diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
-index aed32e9..aa44b47 100644
+index 967ee874..809181e0 100644
--- a/mt7996/mtk_mcu.c
+++ b/mt7996/mtk_mcu.c
-@@ -1342,4 +1342,25 @@ int mt7996_mcu_set_vow_drr_dbg(struct mt7996_dev *dev, u32 val)
+@@ -1343,4 +1343,25 @@ int mt7996_mcu_set_vow_drr_dbg(struct mt7996_dev *dev, u32 val)
sizeof(req), true);
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0080-mtk-wifi-mt76-mt7996-add-kite-two-pcie-with-two-wed-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0085-mtk-mt76-mt7996-add-kite-two-pcie-with-two-wed-suppo.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0080-mtk-wifi-mt76-mt7996-add-kite-two-pcie-with-two-wed-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0085-mtk-mt76-mt7996-add-kite-two-pcie-with-two-wed-suppo.patch
index 7cf05e6..ddb26a5 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0080-mtk-wifi-mt76-mt7996-add-kite-two-pcie-with-two-wed-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0085-mtk-mt76-mt7996-add-kite-two-pcie-with-two-wed-suppo.patch
@@ -1,8 +1,8 @@
-From f56bd70e5c9b889582244a4f22a510de9b19bc74 Mon Sep 17 00:00:00 2001
+From 343d81213790ba2a9928ee104067f5a18bbeacca Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Tue, 19 Mar 2024 13:16:12 +0800
-Subject: [PATCH 080/116] mtk: wifi: mt76: mt7996: add kite two pcie with two
- wed support
+Subject: [PATCH 085/199] mtk: mt76: mt7996: add kite two pcie with two wed
+ support
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
---
@@ -15,7 +15,7 @@
6 files changed, 101 insertions(+), 47 deletions(-)
diff --git a/mt7996/dma.c b/mt7996/dma.c
-index 3dc0e8a..a2490fa 100644
+index 3dc0e8a1..a2490fa7 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -108,8 +108,8 @@ static void mt7996_dma_config(struct mt7996_dev *dev)
@@ -131,10 +131,10 @@
MT_RXQ_ID(MT_RXQ_BAND1_WA),
MT7996_RX_MCU_RING_SIZE,
diff --git a/mt7996/init.c b/mt7996/init.c
-index 1e7cd52..768979e 100644
+index 910ffccf..1e4e6e78 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -525,39 +525,46 @@ void mt7996_mac_init(struct mt7996_dev *dev)
+@@ -527,39 +527,46 @@ void mt7996_mac_init(struct mt7996_dev *dev)
}
/* rro module init */
@@ -202,7 +202,7 @@
if (dev->has_rro) {
u16 timeout;
-@@ -641,7 +648,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -643,7 +650,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
if (phy)
return 0;
@@ -211,7 +211,7 @@
switch (dev->option_type) {
case 2:
/* eagle + 7988d */
-@@ -651,7 +658,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -653,7 +660,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
}
break;
default:
@@ -222,10 +222,10 @@
wed = &dev->mt76.mmio.wed_hif2;
}
diff --git a/mt7996/main.c b/mt7996/main.c
-index 775d81e..c9e8108 100644
+index 8c93297a..a37aac43 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -1607,7 +1607,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1611,7 +1611,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
@@ -234,7 +234,7 @@
switch (dev->option_type) {
case 2:
/* eagle + 7988d */
-@@ -1615,7 +1615,8 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1619,7 +1619,8 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
wed = &dev->mt76.mmio.wed_hif2;
break;
default:
@@ -245,7 +245,7 @@
break;
}
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index 91567a0..6028182 100644
+index 4baae0e9..d4739fea 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -336,10 +336,16 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
@@ -287,7 +287,7 @@
if (mtk_wed_device_active(wed)) {
diff --git a/mt7996/pci.c b/mt7996/pci.c
-index 24d69d4..382b6a8 100644
+index 24d69d4d..382b6a89 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -110,7 +110,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
@@ -310,7 +310,7 @@
if (ret < 0)
goto free_wed_or_irq_vector;
diff --git a/mt7996/regs.h b/mt7996/regs.h
-index a0e4b3e..e189351 100644
+index a0e4b3e1..e1893517 100644
--- a/mt7996/regs.h
+++ b/mt7996/regs.h
@@ -525,6 +525,7 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0081-mtk-wifi-mt76-mt7992-add-support-to-enable-index-FW-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0086-mtk-mt76-add-support-to-enable-index-FW-log-for-Cons.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0081-mtk-wifi-mt76-mt7992-add-support-to-enable-index-FW-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0086-mtk-mt76-add-support-to-enable-index-FW-log-for-Cons.patch
index 0748f93..58d48b8 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0081-mtk-wifi-mt76-mt7992-add-support-to-enable-index-FW-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0086-mtk-mt76-add-support-to-enable-index-FW-log-for-Cons.patch
@@ -1,8 +1,8 @@
-From 4b13a975d69ad2c954791dbdfbcb3c7c7a5bf63f Mon Sep 17 00:00:00 2001
+From 575f1d50cf1917a498582fa07f352c7723f01e8d Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Thu, 11 Jan 2024 08:55:13 +0800
-Subject: [PATCH 081/116] mtk: wifi: mt76: mt7992: add support to enable index
- FW log for ConsysPlanet
+Subject: [PATCH 086/199] mtk: mt76: add support to enable index FW log for
+ ConsysPlanet
Add support to enable and record index FW log, which is the input for ConsysPlanet, via mt76-test command.
@@ -38,7 +38,7 @@
8 files changed, 295 insertions(+), 69 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index e26de48..8377586 100644
+index 8f8608fa..7395f6df 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -430,8 +430,8 @@ create_buf_file_cb(const char *filename, struct dentry *parent, umode_t mode,
@@ -106,7 +106,7 @@
static int
mt7996_fw_util_wa_show(struct seq_file *file, void *data)
{
-@@ -1042,6 +1089,7 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
+@@ -1029,6 +1076,7 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
debugfs_create_file("fw_debug_wm", 0600, dir, dev, &fops_fw_debug_wm);
debugfs_create_file("fw_debug_wa", 0600, dir, dev, &fops_fw_debug_wa);
debugfs_create_file("fw_debug_bin", 0600, dir, dev, &fops_fw_debug_bin);
@@ -114,7 +114,7 @@
/* TODO: wm fw cpu utilization */
debugfs_create_file("fw_util_wa", 0400, dir, dev,
&mt7996_fw_util_wa_fops);
-@@ -1108,6 +1156,32 @@ mt7996_debugfs_write_fwlog(struct mt7996_dev *dev, const void *hdr, int hdrlen,
+@@ -1095,6 +1143,32 @@ mt7996_debugfs_write_fwlog(struct mt7996_dev *dev, const void *hdr, int hdrlen,
spin_unlock_irqrestore(&lock, flags);
}
@@ -147,7 +147,7 @@
void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int len)
{
struct {
-@@ -1132,11 +1206,15 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
+@@ -1119,11 +1193,15 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len)
{
@@ -168,7 +168,7 @@
return true;
}
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index e3758ff..8c44442 100644
+index 099e97ef..564f080d 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -2279,11 +2279,9 @@ void mt7996_mac_work(struct work_struct *work)
@@ -198,7 +198,7 @@
test_bit(MT76_STATE_RUNNING, &mdev->phys[i]->state))
break;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 82ed9e8..e38a507 100644
+index 28cedb60..8cc907f9 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -400,6 +400,7 @@ static void
@@ -219,7 +219,7 @@
return;
data += sizeof(*tlv) + 4;
-@@ -3184,6 +3186,36 @@ int mt7996_mcu_fw_dbg_ctrl(struct mt7996_dev *dev, u32 module, u8 level)
+@@ -3187,6 +3189,36 @@ int mt7996_mcu_fw_dbg_ctrl(struct mt7996_dev *dev, u32 module, u8 level)
sizeof(data), false);
}
@@ -257,10 +257,10 @@
{
struct {
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index d24874a..814072e 100644
+index 8ffb16f8..b15796dc 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -357,7 +357,8 @@ enum {
+@@ -351,7 +351,8 @@ enum {
MCU_FW_LOG_WM,
MCU_FW_LOG_WA,
MCU_FW_LOG_TO_HOST,
@@ -270,7 +270,7 @@
};
enum {
-@@ -950,6 +951,7 @@ enum {
+@@ -944,6 +945,7 @@ enum {
UNI_WSYS_CONFIG_FW_LOG_CTRL,
UNI_WSYS_CONFIG_FW_DBG_CTRL,
UNI_CMD_CERT_CFG = 6,
@@ -279,10 +279,10 @@
enum {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 69bcf78..d03d3d9 100644
+index 0e6b7595..d5162885 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -591,9 +591,11 @@ struct mt7996_dev {
+@@ -592,9 +592,11 @@ struct mt7996_dev {
u8 fw_debug_bin;
u16 fw_debug_seq;
bool fw_debug_muru_disable;
@@ -294,7 +294,7 @@
void *cal;
u32 cur_prek_offset;
-@@ -845,6 +847,7 @@ int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
+@@ -846,6 +848,7 @@ int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
int mt7996_mcu_red_config(struct mt7996_dev *dev, bool enable);
int mt7996_mcu_fw_log_2_host(struct mt7996_dev *dev, u8 type, u8 ctrl);
int mt7996_mcu_fw_dbg_ctrl(struct mt7996_dev *dev, u32 module, u8 level);
@@ -303,7 +303,7 @@
void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb);
void mt7996_mcu_exit(struct mt7996_dev *dev);
diff --git a/tools/fwlog.c b/tools/fwlog.c
-index 3c6a61d..0e2de2d 100644
+index 3c6a61d7..0e2de2dc 100644
--- a/tools/fwlog.c
+++ b/tools/fwlog.c
@@ -29,10 +29,9 @@ static const char *debugfs_path(const char *phyname, const char *file)
@@ -591,7 +591,7 @@
return ret;
}
diff --git a/tools/main.c b/tools/main.c
-index 699a9ee..e9e2556 100644
+index 699a9eea..e9e25567 100644
--- a/tools/main.c
+++ b/tools/main.c
@@ -198,6 +198,8 @@ int main(int argc, char **argv)
@@ -604,7 +604,7 @@
usage();
diff --git a/tools/mt76-test.h b/tools/mt76-test.h
-index d2fafa8..b9d508c 100644
+index d2fafa86..b9d508c5 100644
--- a/tools/mt76-test.h
+++ b/tools/mt76-test.h
@@ -22,6 +22,8 @@
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0082-wifi-mt76-mt7996-implement-and-switch-to-hw-scan-cal.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0087-mtk-mt76-mt7996-implement-and-switch-to-hw-scan-call.patch
similarity index 90%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0082-wifi-mt76-mt7996-implement-and-switch-to-hw-scan-cal.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0087-mtk-mt76-mt7996-implement-and-switch-to-hw-scan-call.patch
index c76593a..452ba1f 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0082-wifi-mt76-mt7996-implement-and-switch-to-hw-scan-cal.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0087-mtk-mt76-mt7996-implement-and-switch-to-hw-scan-call.patch
@@ -1,7 +1,7 @@
-From 8a1c29f6a9b99d2f3d699fe6100704349406fc4b Mon Sep 17 00:00:00 2001
+From c2213afbe5f0c0b36ba7fb19c2bd9f04cea01cc9 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 3 Nov 2023 21:44:45 +0800
-Subject: [PATCH 082/116] wifi: mt76: mt7996: implement and switch to hw scan
+Subject: [PATCH 087/199] mtk: mt76: mt7996: implement and switch to hw scan
callbacks
To support MLO, hw_scan callbacks are mandatory. However, the
@@ -13,10 +13,10 @@
request should be unicast.
This works for ML probe request, which should be unicast.
-Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
-Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mac80211.c | 3 +-
@@ -29,10 +29,10 @@
7 files changed, 248 insertions(+), 12 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index 3c2c2af..0ad3f25 100644
+index 3e054d9d..032a13a5 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -821,7 +821,7 @@ bool mt76_has_tx_pending(struct mt76_phy *phy)
+@@ -820,7 +820,7 @@ bool mt76_has_tx_pending(struct mt76_phy *phy)
}
EXPORT_SYMBOL_GPL(mt76_has_tx_pending);
@@ -41,7 +41,7 @@
mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
{
struct mt76_sband *msband;
-@@ -837,6 +837,7 @@ mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
+@@ -836,6 +836,7 @@ mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
idx = c - &msband->sband.channels[0];
return &msband->chan[idx];
}
@@ -50,10 +50,10 @@
void mt76_update_survey_active_time(struct mt76_phy *phy, ktime_t time)
{
diff --git a/mt76.h b/mt76.h
-index 28defd4..8ca7907 100644
+index 8f3541e2..6a7752ef 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -1477,6 +1477,8 @@ void mt76_release_buffered_frames(struct ieee80211_hw *hw,
+@@ -1469,6 +1469,8 @@ void mt76_release_buffered_frames(struct ieee80211_hw *hw,
enum ieee80211_frame_release_type reason,
bool more_data);
bool mt76_has_tx_pending(struct mt76_phy *phy);
@@ -63,10 +63,10 @@
void mt76_update_survey(struct mt76_phy *phy);
void mt76_update_survey_active_time(struct mt76_phy *phy, ktime_t time);
diff --git a/mt7996/init.c b/mt7996/init.c
-index 768979e..9523568 100644
+index 1e4e6e78..2b396d94 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -457,6 +457,9 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -459,6 +459,9 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy->available_antennas_rx = phy->mt76->antenna_mask;
wiphy->available_antennas_tx = phy->mt76->antenna_mask;
@@ -76,7 +76,7 @@
}
static void
-@@ -677,6 +680,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -679,6 +682,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
mphy->dev->phys[band] = mphy;
INIT_DELAYED_WORK(&mphy->mac_work, mt7996_mac_work);
@@ -93,7 +93,7 @@
INIT_LIST_HEAD(&dev->sta_rc_list);
INIT_LIST_HEAD(&dev->twt_list);
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 8c44442..4e9dd2c 100644
+index 564f080d..7578cbb0 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -2693,3 +2693,144 @@ void mt7996_mac_twt_teardown_flow(struct mt7996_dev *dev,
@@ -242,7 +242,7 @@
+ ieee80211_queue_delayed_work(hw, &phy->scan_work, duration);
+}
diff --git a/mt7996/main.c b/mt7996/main.c
-index c9e8108..5c1735e 100644
+index a37aac43..c640fb61 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -312,6 +312,8 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
@@ -309,7 +309,7 @@
if (dev->cal) {
ret = mt7996_mcu_apply_tx_dpd(phy);
-@@ -381,6 +413,19 @@ out:
+@@ -385,6 +417,19 @@ out:
return ret;
}
@@ -329,7 +329,7 @@
static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_vif *vif, struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
-@@ -477,11 +522,7 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
+@@ -481,11 +526,7 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
if (ret)
return ret;
@@ -342,7 +342,7 @@
}
if (changed & (IEEE80211_CONF_CHANGE_POWER |
-@@ -1648,6 +1689,42 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1652,6 +1693,42 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
#endif
@@ -383,9 +383,9 @@
+}
+
const struct ieee80211_ops mt7996_ops = {
- .tx = mt7996_tx,
- .start = mt7996_start,
-@@ -1666,8 +1743,8 @@ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -1674,8 +1751,8 @@ const struct ieee80211_ops mt7996_ops = {
.ampdu_action = mt7996_ampdu_action,
.set_rts_threshold = mt7996_set_rts_threshold,
.wake_tx_queue = mt76_wake_tx_queue,
@@ -397,10 +397,10 @@
.get_txpower = mt76_get_txpower,
.channel_switch_beacon = mt7996_channel_switch_beacon,
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index e38a507..9f2d125 100644
+index 8cc907f9..214c157c 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -3775,7 +3775,8 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
+@@ -3778,7 +3778,8 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
if (phy->mt76->hw->conf.flags & IEEE80211_CONF_MONITOR)
req.switch_reason = CH_SWITCH_NORMAL;
else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL ||
@@ -411,10 +411,10 @@
else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef,
NL80211_IFTYPE_AP))
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index d03d3d9..fbf1e83 100644
+index d5162885..f94cb496 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -458,6 +458,13 @@ struct mt7996_phy {
+@@ -459,6 +459,13 @@ struct mt7996_phy {
u8 pp_mode;
u16 punct_bitmap;
@@ -428,7 +428,7 @@
struct mt7996_scs_ctrl scs_ctrl;
u32 red_drop;
-@@ -806,7 +813,7 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+@@ -807,7 +814,7 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_he_obss_pd *he_obss_pd);
int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool changed);
@@ -437,7 +437,7 @@
int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag);
int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif);
int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
-@@ -964,6 +971,8 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+@@ -965,6 +972,8 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
struct sk_buff *skb, u32 *info);
bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len);
void mt7996_stats_work(struct work_struct *work);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0087-wifi-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0087-wifi-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch
deleted file mode 100644
index c1cf6ec..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0087-wifi-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From e0f1ba7574dc2a68c51a3a1d9f926dbebfbefc55 Mon Sep 17 00:00:00 2001
-From: Shayne Chen <shayne.chen@mediatek.com>
-Date: Wed, 29 Nov 2023 11:04:50 +0800
-Subject: [PATCH 087/116] wifi: mt76: extend wcid and sta flow for MLO support
-
-Add link related info to wcid, and split sta connection flow of common
-parts for MLO supported chipsets.
-This is a preliminary patch to add MLO support for mt7996 chipsets.
-
-Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
-Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
-Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
----
- mac80211.c | 12 +++++++++++-
- mt76.h | 7 ++++++-
- 2 files changed, 17 insertions(+), 2 deletions(-)
-
-diff --git a/mac80211.c b/mac80211.c
-index 0ad3f25..4e96b39 100644
---- a/mac80211.c
-+++ b/mac80211.c
-@@ -1067,6 +1067,10 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
- sizeof(mstat.chain_signal));
- memcpy(status->chain_signal, mstat.chain_signal,
- sizeof(mstat.chain_signal));
-+ if (mstat.wcid) {
-+ status->link_valid = mstat.wcid->link_valid;
-+ status->link_id = mstat.wcid->link_id;
-+ }
-
- *sta = wcid_to_sta(mstat.wcid);
- *hw = mt76_phy_hw(dev, mstat.phy_idx);
-@@ -1375,6 +1379,9 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif,
- if (ret)
- goto out;
-
-+ if (phy->hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)
-+ goto out;
-+
- for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
- struct mt76_txq *mtxq;
-
-@@ -1404,12 +1411,15 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif,
- struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
- int i, idx = wcid->idx;
-
-- for (i = 0; i < ARRAY_SIZE(wcid->aggr); i++)
-+ for (i = 0; !sta->valid_links && i < ARRAY_SIZE(wcid->aggr); i++)
- mt76_rx_aggr_stop(dev, wcid, i);
-
- if (dev->drv->sta_remove)
- dev->drv->sta_remove(dev, vif, sta);
-
-+ if (sta->valid_links)
-+ return;
-+
- mt76_wcid_cleanup(dev, wcid);
-
- mt76_wcid_mask_clear(dev->wcid_mask, idx);
-diff --git a/mt76.h b/mt76.h
-index 8ca7907..c3ab96a 100644
---- a/mt76.h
-+++ b/mt76.h
-@@ -381,6 +381,9 @@ struct mt76_wcid {
- u8 sta:1;
- u8 amsdu:1;
- u8 phy_idx:2;
-+ u8 link_id:4;
-+ bool link_valid;
-+ struct mt76_wcid *def_wcid;
-
- u8 rx_check_pn;
- u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6];
-@@ -1366,11 +1369,13 @@ mtxq_to_txq(struct mt76_txq *mtxq)
- static inline struct ieee80211_sta *
- wcid_to_sta(struct mt76_wcid *wcid)
- {
-- void *ptr = wcid;
-+ void *ptr;
-
- if (!wcid || !wcid->sta)
- return NULL;
-
-+ ptr = wcid->def_wcid ?: wcid;
-+
- return container_of(ptr, struct ieee80211_sta, drv_priv);
- }
-
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0083-wifi-mt76-mt7996-implement-and-switch-to-chanctx-cal.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0088-mtk-mt76-mt7996-implement-and-switch-to-chanctx-call.patch
similarity index 89%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0083-wifi-mt76-mt7996-implement-and-switch-to-chanctx-cal.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0088-mtk-mt76-mt7996-implement-and-switch-to-chanctx-call.patch
index 0e99f39..be4a016 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0083-wifi-mt76-mt7996-implement-and-switch-to-chanctx-cal.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0088-mtk-mt76-mt7996-implement-and-switch-to-chanctx-call.patch
@@ -1,7 +1,7 @@
-From d225140776409dcf5b526034682768803e551dbb Mon Sep 17 00:00:00 2001
+From f51442617a3575a1af73981d95316811e8488e3f Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 6 Nov 2023 16:17:11 +0800
-Subject: [PATCH 083/116] wifi: mt76: mt7996: implement and switch to chanctx
+Subject: [PATCH 088/199] mtk: mt76: mt7996: implement and switch to chanctx
callbacks
To support MLO, chanctx callbacks are mandatory, since one VIF (MLD) could
@@ -20,10 +20,10 @@
5 files changed, 211 insertions(+), 18 deletions(-)
diff --git a/mt7996/init.c b/mt7996/init.c
-index 9523568..6eeec3b 100644
+index 2b396d94..d18db618 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -382,6 +382,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -384,6 +384,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
hw->sta_data_size = sizeof(struct mt7996_sta);
hw->vif_data_size = sizeof(struct mt7996_vif);
@@ -31,7 +31,7 @@
wiphy->iface_combinations = if_comb;
wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
-@@ -417,6 +418,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -419,6 +420,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
@@ -39,7 +39,7 @@
hw->max_tx_fragments = 4;
-@@ -637,6 +639,22 @@ static int mt7996_vow_init(struct mt7996_phy *phy)
+@@ -639,6 +641,22 @@ static int mt7996_vow_init(struct mt7996_phy *phy)
return mt7996_mcu_set_vow_feature_ctrl(phy);
}
@@ -62,7 +62,7 @@
static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
enum mt76_band_id band)
{
-@@ -720,6 +738,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -722,6 +740,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
if (ret)
goto error;
@@ -81,7 +81,7 @@
if (ret)
return ret;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 4e9dd2c..0879c77 100644
+index 7578cbb0..fc6e383b 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -2785,7 +2785,10 @@ void mt7996_scan_work(struct work_struct *work)
@@ -109,7 +109,7 @@
ieee80211_queue_delayed_work(hw, &phy->scan_work, HZ / 10);
diff --git a/mt7996/main.c b/mt7996/main.c
-index 5c1735e..dff0f1f 100644
+index c640fb61..f7910abe 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -76,6 +76,11 @@ int mt7996_run(struct ieee80211_hw *hw)
@@ -124,7 +124,7 @@
ret = mt7996_mcu_set_thermal_throttling(phy, MT7996_THERMAL_THROTTLE_MAX);
if (ret)
goto out;
-@@ -510,21 +515,6 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
+@@ -514,21 +519,6 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
struct mt7996_phy *phy = mt7996_hw_phy(hw);
int ret;
@@ -146,7 +146,7 @@
if (changed & (IEEE80211_CONF_CHANGE_POWER |
IEEE80211_CONF_CHANGE_CHANNEL)) {
ret = mt7996_mcu_set_txpower_sku(phy);
-@@ -1725,6 +1715,158 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+@@ -1729,6 +1719,158 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_unlock(&phy->dev->mt76.mutex);
}
@@ -303,9 +303,9 @@
+}
+
const struct ieee80211_ops mt7996_ops = {
- .tx = mt7996_tx,
- .start = mt7996_start,
-@@ -1775,4 +1917,10 @@ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -1783,4 +1925,10 @@ const struct ieee80211_ops mt7996_ops = {
.net_fill_forward_path = mt7996_net_fill_forward_path,
.net_setup_tc = mt76_wed_net_setup_tc,
#endif
@@ -317,10 +317,10 @@
+ .switch_vif_chanctx = mt7996_switch_vif_chanctx,
};
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 9f2d125..5319cc3 100644
+index 214c157c..7faf0916 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -5309,7 +5309,7 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
+@@ -5296,7 +5296,7 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
.bitmap = cpu_to_le16(bitmap),
};
@@ -330,10 +330,10 @@
return 0;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index fbf1e83..84aafb4 100644
+index f94cb496..3597bbbf 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -332,6 +332,8 @@ struct mt7996_vif {
+@@ -333,6 +333,8 @@ struct mt7996_vif {
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
struct cfg80211_bitrate_mask bitrate_mask;
@@ -342,7 +342,7 @@
};
/* crash-dump */
-@@ -421,6 +423,14 @@ struct mt7996_rro_ba_session {
+@@ -422,6 +424,14 @@ struct mt7996_rro_ba_session {
u32 last_in_rxtime :12;
};
@@ -357,7 +357,7 @@
struct mt7996_phy {
struct mt76_phy *mt76;
struct mt7996_dev *dev;
-@@ -464,6 +474,7 @@ struct mt7996_phy {
+@@ -465,6 +475,7 @@ struct mt7996_phy {
struct cfg80211_scan_request *scan_req;
struct ieee80211_vif *scan_vif;
int scan_chan_idx;
@@ -365,7 +365,7 @@
struct mt7996_scs_ctrl scs_ctrl;
u32 red_drop;
-@@ -752,6 +763,12 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
+@@ -753,6 +764,12 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
return 1;
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0084-wifi-mt76-mt7996-use-.sta_state-to-replace-.sta_add-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0089-mtk-mt76-mt7996-use-.sta_state-to-replace-.sta_add-a.patch
similarity index 86%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0084-wifi-mt76-mt7996-use-.sta_state-to-replace-.sta_add-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0089-mtk-mt76-mt7996-use-.sta_state-to-replace-.sta_add-a.patch
index cc84e17..e6cbe6c 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0084-wifi-mt76-mt7996-use-.sta_state-to-replace-.sta_add-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0089-mtk-mt76-mt7996-use-.sta_state-to-replace-.sta_add-a.patch
@@ -1,8 +1,8 @@
-From 21ea1ffbe885bbaba0266f0b835cf58574cecc5f Mon Sep 17 00:00:00 2001
+From 29120502dfe63ff9cde7c6445b34019fd9729cd4 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 8 Nov 2023 18:52:26 +0800
-Subject: [PATCH 084/116] wifi: mt76: mt7996: use .sta_state to replace
- .sta_add and .sta_remove
+Subject: [PATCH 089/199] mtk: mt76: mt7996: use .sta_state to replace .sta_add
+ and .sta_remove
MAC80211 mostly uses MLD address through TX path, and leaves the header
translation procedure to driver. To perform address translation, driver
@@ -21,10 +21,10 @@
3 files changed, 24 insertions(+), 32 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index dff0f1f..9eb4c5b 100644
+index f7910abe..0580b9ff 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -784,7 +784,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -788,7 +788,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
u8 band_idx = mvif->phy->mt76->band_idx;
@@ -33,7 +33,7 @@
#ifdef CONFIG_MTK_VENDOR
struct mt7996_phy *phy = &dev->phy;
-@@ -802,23 +802,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -806,23 +806,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
msta->wcid.phy_idx = band_idx;
msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
@@ -57,7 +57,7 @@
#ifdef CONFIG_MTK_VENDOR
switch (band_idx) {
case MT_BAND1:
-@@ -839,6 +826,25 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -843,6 +830,25 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
return 0;
}
@@ -83,7 +83,7 @@
void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
-@@ -958,22 +964,6 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -962,22 +968,6 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return ret;
}
@@ -106,7 +106,7 @@
static int
mt7996_get_stats(struct ieee80211_hw *hw,
struct ieee80211_low_level_stats *stats)
-@@ -1877,8 +1867,7 @@ const struct ieee80211_ops mt7996_ops = {
+@@ -1885,8 +1875,7 @@ const struct ieee80211_ops mt7996_ops = {
.conf_tx = mt7996_conf_tx,
.configure_filter = mt7996_configure_filter,
.bss_info_changed = mt7996_bss_info_changed,
@@ -117,7 +117,7 @@
.sta_rc_update = mt7996_sta_rc_update,
.set_key = mt7996_set_key,
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index 6028182..6abbcb6 100644
+index d4739fea..b94155c4 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -655,6 +655,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
@@ -129,10 +129,10 @@
.update_survey = mt7996_update_channel,
};
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 84aafb4..2b266d1 100644
+index 3597bbbf..75073a1b 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -966,6 +966,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+@@ -967,6 +967,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
void mt7996_mac_set_coverage_class(struct mt7996_phy *phy);
int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0085-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0090-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch
similarity index 92%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0085-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0090-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch
index f035710..d7ad06b 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0085-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0090-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch
@@ -1,7 +1,7 @@
-From a8c22741f0614f90922e3dcac3a94666e29e4682 Mon Sep 17 00:00:00 2001
+From 737e6a82f962447ef85055ebb32c07568fc8c722 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 24 Nov 2023 11:31:55 +0800
-Subject: [PATCH 085/116] wifi: mt76: mt7996: switch to per-link data structure
+Subject: [PATCH 090/199] mtk: mt76: mt7996: switch to per-link data structure
of vif
Introduce struct mt7996_bss_conf, data structure for per-link BSS.
@@ -22,10 +22,10 @@
7 files changed, 463 insertions(+), 363 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 8377586..06015d6 100644
+index 7395f6df..5d4d69ea 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
-@@ -739,7 +739,7 @@ static void
+@@ -726,7 +726,7 @@ static void
mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -34,7 +34,7 @@
struct seq_file *s = data;
u8 ac;
-@@ -759,7 +759,7 @@ mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
+@@ -746,7 +746,7 @@ mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
GENMASK(11, 0));
seq_printf(s, "\tSTA %pM wcid %d: AC%d%d queued:%d\n",
sta->addr, msta->wcid.idx,
@@ -43,7 +43,7 @@
}
}
-@@ -1023,7 +1023,7 @@ mt7996_atf_enable_set(void *data, u64 val)
+@@ -1010,7 +1010,7 @@ mt7996_atf_enable_set(void *data, u64 val)
int ret;
vow->max_deficit = val ? 64 : 1;
@@ -52,7 +52,7 @@
if (ret)
return ret;
-@@ -1055,7 +1055,7 @@ mt7996_airtime_read(struct seq_file *s, void *data)
+@@ -1042,7 +1042,7 @@ mt7996_airtime_read(struct seq_file *s, void *data)
msta = container_of(wcid, struct mt7996_sta, wcid);
sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
@@ -61,7 +61,7 @@
stats = &wcid->stats;
seq_printf(s, "%pM WCID: %hu BandIdx: %hhu OmacIdx: 0x%hhx\t"
-@@ -1230,7 +1230,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
+@@ -1217,7 +1217,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
#define LONG_PREAMBLE 1
struct ieee80211_sta *sta = file->private_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -71,10 +71,10 @@
char buf[100];
int ret;
diff --git a/mt7996/init.c b/mt7996/init.c
-index 6eeec3b..381e129 100644
+index d18db618..86bb0661 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -628,11 +628,11 @@ static int mt7996_vow_init(struct mt7996_phy *phy)
+@@ -630,11 +630,11 @@ static int mt7996_vow_init(struct mt7996_phy *phy)
vow->drr_quantum[6] = VOW_DRR_QUANTUM_L6;
vow->drr_quantum[7] = VOW_DRR_QUANTUM_L7;
@@ -89,10 +89,10 @@
return ret;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 0879c77..63b16f9 100644
+index fc6e383b..5fbcfc74 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -897,8 +897,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -900,8 +900,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
if (vif) {
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -103,7 +103,7 @@
}
txp->fw.token = cpu_to_le16(id);
-@@ -1518,12 +1519,15 @@ static void
+@@ -1515,12 +1516,15 @@ static void
mt7996_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
struct ieee80211_hw *hw = priv;
@@ -186,7 +186,7 @@
list_del_init(&flow->list);
diff --git a/mt7996/main.c b/mt7996/main.c
-index 9eb4c5b..bc4863d 100644
+index 0580b9ff..8a32ec69 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -205,29 +205,30 @@ static int get_omac_idx(enum nl80211_iftype type, u64 mask)
@@ -251,14 +251,14 @@
- mvif->mt76.omac_idx = idx;
- mvif->phy = phy;
- mvif->mt76.band_idx = band_idx;
-- mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
+- mvif->mt76.wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
-
- ret = mt7996_mcu_add_dev_info(phy, vif, true);
+ mconf->mt76.omac_idx = idx;
+ mconf->vif = mvif;
+ mconf->phy = phy;
+ mconf->mt76.band_idx = band_idx;
-+ mconf->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
++ mconf->mt76.wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
+ mvif->dev = dev;
+
+ ret = mt7996_mcu_add_dev_info(phy, conf, mconf, true);
@@ -361,7 +361,7 @@
}
static void ___mt7996_set_channel(struct mt7996_phy *phy,
-@@ -441,6 +448,8 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -445,6 +452,8 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct mt7996_sta *msta = sta ? (struct mt7996_sta *)sta->drv_priv :
&mvif->sta;
struct mt76_wcid *wcid = &msta->wcid;
@@ -370,7 +370,7 @@
u8 *wcid_keyidx = &wcid->hw_key_idx;
int idx = key->keyidx;
int err = 0;
-@@ -482,9 +491,11 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -486,9 +495,11 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mutex_lock(&dev->mt76.mutex);
@@ -385,7 +385,7 @@
}
if (cmd == SET_KEY) {
-@@ -498,9 +509,9 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -502,9 +513,9 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mt76_wcid_key_setup(&dev->mt76, wcid, key);
if (key->keyidx == 6 || key->keyidx == 7)
@@ -397,7 +397,7 @@
MCU_WMWA_UNI_CMD(STA_REC_UPDATE),
&msta->wcid, cmd);
out:
-@@ -547,7 +558,9 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -551,7 +562,9 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id, u16 queue,
const struct ieee80211_tx_queue_params *params)
{
@@ -407,7 +407,7 @@
static const u8 mq_to_aci[] = {
[IEEE80211_AC_VO] = 3,
[IEEE80211_AC_VI] = 2,
-@@ -555,10 +568,15 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -559,10 +572,15 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
[IEEE80211_AC_BK] = 1,
};
@@ -424,7 +424,7 @@
return 0;
}
-@@ -619,22 +637,20 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
+@@ -623,22 +641,20 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
}
static void
@@ -451,7 +451,7 @@
break;
default:
break;
-@@ -642,16 +658,15 @@ mt7996_update_bss_color(struct ieee80211_hw *hw,
+@@ -646,16 +662,15 @@ mt7996_update_bss_color(struct ieee80211_hw *hw,
}
static u8
@@ -472,7 +472,7 @@
if (beacon) {
struct mt7996_phy *phy = mphy->priv;
-@@ -672,23 +687,22 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -676,23 +691,22 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if ((mt76_rates[i].hw_value & GENMASK(7, 0)) == idx)
return MT7996_BASIC_RATES_TBL + 2 * i;
@@ -502,7 +502,7 @@
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS0(band), mu[0]);
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS1(band), mu[1]);
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS2(band), mu[2]);
-@@ -700,20 +714,22 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
+@@ -704,20 +718,22 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_bss_conf *info,
u64 changed)
{
@@ -528,7 +528,7 @@
!!(changed & BSS_CHANGED_BSSID));
}
-@@ -725,42 +741,42 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
+@@ -729,42 +745,42 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
if (slottime != phy->slottime) {
phy->slottime = slottime;
@@ -584,7 +584,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -771,9 +787,14 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
+@@ -775,9 +791,14 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -600,7 +600,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -783,7 +804,8 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -787,7 +808,8 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -610,7 +610,7 @@
int idx;
#ifdef CONFIG_MTK_VENDOR
-@@ -803,7 +825,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -807,7 +829,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
#ifdef CONFIG_MTK_VENDOR
@@ -619,7 +619,7 @@
#endif
#ifdef CONFIG_MTK_VENDOR
-@@ -830,15 +852,20 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -834,15 +856,20 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
@@ -642,7 +642,7 @@
ewma_avg_signal_init(&msta->avg_ack_signal);
-@@ -849,10 +876,15 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -853,10 +880,15 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
@@ -659,7 +659,7 @@
mt7996_mac_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
-@@ -984,7 +1016,7 @@ mt7996_get_stats(struct ieee80211_hw *hw,
+@@ -988,7 +1020,7 @@ mt7996_get_stats(struct ieee80211_hw *hw,
return 0;
}
@@ -668,7 +668,7 @@
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
-@@ -996,8 +1028,8 @@ u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif)
+@@ -1000,8 +1032,8 @@ u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif)
lockdep_assert_held(&dev->mt76.mutex);
@@ -679,7 +679,7 @@
/* TSF software read */
mt76_rmw(dev, MT_LPON_TCR(phy->mt76->band_idx, n), MT_LPON_TCR_SW_MODE,
MT_LPON_TCR_SW_READ);
-@@ -1012,10 +1044,12 @@ mt7996_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+@@ -1016,10 +1048,12 @@ mt7996_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -693,7 +693,7 @@
mutex_unlock(&dev->mt76.mutex);
return ret;
-@@ -1028,6 +1062,7 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1032,6 +1066,7 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
@@ -701,7 +701,7 @@
union {
u64 t64;
u32 t32[2];
-@@ -1036,8 +1071,9 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1040,8 +1075,9 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
@@ -713,7 +713,7 @@
mt76_wr(dev, MT_LPON_UTTR0(phy->mt76->band_idx), tsf.t32[0]);
mt76_wr(dev, MT_LPON_UTTR1(phy->mt76->band_idx), tsf.t32[1]);
/* TSF software overwrite */
-@@ -1054,6 +1090,7 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1058,6 +1094,7 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
@@ -721,7 +721,7 @@
union {
u64 t64;
u32 t32[2];
-@@ -1062,8 +1099,9 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1066,8 +1103,9 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
@@ -733,7 +733,7 @@
mt76_wr(dev, MT_LPON_UTTR0(phy->mt76->band_idx), tsf.t32[0]);
mt76_wr(dev, MT_LPON_UTTR1(phy->mt76->band_idx), tsf.t32[1]);
/* TSF software adjust*/
-@@ -1179,7 +1217,7 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
+@@ -1183,7 +1221,7 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -742,7 +742,7 @@
u32 *changed = data;
spin_lock_bh(&dev->mt76.sta_poll_lock);
-@@ -1215,9 +1253,13 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1219,9 +1257,13 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mt7996_dev *dev = phy->dev;
@@ -757,7 +757,7 @@
/* if multiple rates across different preambles are given we can
* reconfigure this info with all peers using sta_rec command with
-@@ -1239,14 +1281,20 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
+@@ -1243,14 +1285,20 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
bool enabled)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -779,7 +779,7 @@
}
static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
-@@ -1255,14 +1303,20 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
+@@ -1259,14 +1307,20 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
bool enabled)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -801,7 +801,7 @@
}
static const char mt7996_gstrings_stats[][ETH_GSTRING_LEN] = {
-@@ -1395,7 +1449,7 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
+@@ -1399,7 +1453,7 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
struct mt76_ethtool_worker_info *wi = wi_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -810,7 +810,7 @@
return;
mt76_ethtool_worker(wi, &msta->wcid.stats, true);
-@@ -1409,15 +1463,17 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,
+@@ -1413,15 +1467,17 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -829,7 +829,7 @@
mt7996_mac_update_stats(phy);
-@@ -1623,6 +1679,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1627,6 +1683,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
struct net_device_path *path)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -837,7 +837,7 @@
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
-@@ -1652,7 +1709,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1656,7 +1713,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
path->type = DEV_PATH_MTK_WDMA;
path->dev = ctx->dev;
path->mtk_wdma.wdma_idx = wed->wdma_idx;
@@ -846,7 +846,7 @@
path->mtk_wdma.queue = 0;
path->mtk_wdma.wcid = msta->wcid.idx;
-@@ -1784,6 +1841,7 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1788,6 +1845,7 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
struct mt7996_phy *phy = ctx->phy;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -854,7 +854,7 @@
wiphy_info(hw->wiphy, "Assign VIF (addr: %pM, type: %d, link_id: %d) to channel context: %d MHz\n",
vif->addr, vif->type, link_conf->link_id,
-@@ -1791,7 +1849,8 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1795,7 +1853,8 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&phy->dev->mt76.mutex);
@@ -864,7 +864,7 @@
ctx->nbss_assigned++;
mutex_unlock(&phy->dev->mt76.mutex);
-@@ -1807,6 +1866,7 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1811,6 +1870,7 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
struct mt7996_phy *phy = ctx->phy;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -872,7 +872,7 @@
wiphy_info(hw->wiphy, "Remove VIF (addr: %pM, type: %d, link_id: %d) from channel context: %d MHz\n",
vif->addr, vif->type, link_conf->link_id,
-@@ -1818,7 +1878,8 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1822,7 +1882,8 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (test_bit(MT76_SCANNING, &phy->mt76->state))
mt7996_scan_complete(phy, true);
@@ -883,7 +883,7 @@
mutex_unlock(&phy->dev->mt76.mutex);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 5319cc3..ebd3192 100644
+index 7faf0916..1e0fca2d 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -117,12 +117,12 @@ mt7996_mcu_get_sta_nss(u16 mcs_map)
@@ -1353,11 +1353,11 @@
if (bfee)
- return vif->bss_conf.eht_su_beamformee &&
+ return conf->eht_su_beamformee &&
- EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]);
+ EHT_PHY(CAP0_SU_BEAMFORMER, pe->phy_cap_info[0]);
else
- return vif->bss_conf.eht_su_beamformer &&
+ return conf->eht_su_beamformer &&
- EHT_PHY(CAP0_SU_BEAMFORMER, pe->phy_cap_info[0]);
+ EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]);
}
@@ -1640,10 +1631,10 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_vif *vif,
@@ -1533,8 +1533,8 @@
ra->valid = true;
ra->auto_rate = true;
-- ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
-+ ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, sta);
+- ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, &sta->deflink);
++ ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, &sta->deflink);
ra->channel = chandef->chan->hw_value;
ra->bw = (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_320) ?
CMD_CBW_320MHZ : sta->deflink.bandwidth;
@@ -1635,18 +1635,18 @@
{
+ struct ieee80211_vif *vif = conf->vif;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct ieee80211_link_sta *link_sta;
struct mt7996_sta *msta;
- struct sk_buff *skb;
-@@ -2365,7 +2362,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
-
+@@ -2367,7 +2364,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
+ link_sta = sta ? &sta->deflink : NULL;
- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
&msta->wcid,
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
-@@ -2387,7 +2384,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2390,7 +2387,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
/* starec hdrt mode */
mt7996_mcu_sta_hdrt_tlv(dev, skb);
/* starec bfer */
@@ -1655,7 +1655,7 @@
/* starec ht */
mt7996_mcu_sta_ht_tlv(skb, sta);
/* starec vht */
-@@ -2397,18 +2394,18 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2400,18 +2397,18 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
/* starec amsdu */
mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, sta);
/* starec he */
@@ -1678,7 +1678,7 @@
if (ret) {
dev_kfree_skb(skb);
return ret;
-@@ -2463,16 +2460,15 @@ mt7996_mcu_sta_key_tlv(struct mt76_wcid *wcid,
+@@ -2466,16 +2463,15 @@ mt7996_mcu_sta_key_tlv(struct mt76_wcid *wcid,
return 0;
}
@@ -1698,7 +1698,7 @@
if (IS_ERR(skb))
return PTR_ERR(skb);
-@@ -2483,17 +2479,18 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
+@@ -2486,17 +2482,18 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true);
}
@@ -1721,7 +1721,7 @@
if (IS_ERR(skb))
return PTR_ERR(skb);
-@@ -2517,10 +2514,11 @@ static int mt7996_mcu_get_pn(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2520,10 +2517,11 @@ static int mt7996_mcu_get_pn(struct mt7996_dev *dev, struct ieee80211_vif *vif,
return 0;
}
@@ -1735,7 +1735,7 @@
struct mt7996_mcu_bcn_prot_tlv *bcn_prot;
struct sk_buff *skb;
struct tlv *tlv;
-@@ -2529,7 +2527,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
+@@ -2532,7 +2530,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
sizeof(struct mt7996_mcu_bcn_prot_tlv);
int ret;
@@ -1744,7 +1744,7 @@
if (IS_ERR(skb))
return PTR_ERR(skb);
-@@ -2537,7 +2535,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
+@@ -2540,7 +2538,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
bcn_prot = (struct mt7996_mcu_bcn_prot_tlv *)tlv;
@@ -1753,7 +1753,7 @@
if (ret) {
dev_kfree_skb(skb);
return ret;
-@@ -2570,10 +2568,10 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
+@@ -2573,10 +2571,10 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
MCU_WMWA_UNI_CMD(BSS_INFO_UPDATE), true);
}
int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
@@ -1766,7 +1766,7 @@
struct {
struct req_hdr {
u8 omac_idx;
-@@ -2589,8 +2587,8 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
+@@ -2592,8 +2590,8 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
} __packed tlv;
} data = {
.hdr = {
@@ -1777,7 +1777,7 @@
},
.tlv = {
.tag = cpu_to_le16(DEV_INFO_ACTIVE),
-@@ -2599,16 +2597,16 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
+@@ -2602,16 +2600,16 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
},
};
@@ -1798,7 +1798,7 @@
struct sk_buff *skb,
struct ieee80211_mutable_offsets *offs)
{
-@@ -2619,7 +2617,7 @@ mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
+@@ -2622,7 +2620,7 @@ mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
if (!offs->cntdwn_counter_offs[0])
return;
@@ -1807,7 +1807,7 @@
tlv = mt7996_mcu_add_uni_tlv(rskb, tag, sizeof(*info));
-@@ -2629,14 +2627,15 @@ mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
+@@ -2632,14 +2630,15 @@ mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
static void
mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
@@ -1825,7 +1825,7 @@
return;
tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_MBSSID, sizeof(*mbss));
-@@ -2681,7 +2680,7 @@ mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
+@@ -2684,7 +2683,7 @@ mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
}
static void
@@ -1834,7 +1834,7 @@
struct sk_buff *rskb, struct sk_buff *skb,
struct bss_bcn_content_tlv *bcn,
struct ieee80211_mutable_offsets *offs)
-@@ -2695,9 +2694,9 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2698,9 +2697,9 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
if (offs->cntdwn_counter_offs[0]) {
u16 offset = offs->cntdwn_counter_offs[0];
@@ -1846,7 +1846,7 @@
bcn->bcc_ie_pos = cpu_to_le16(offset - 3);
}
-@@ -2709,11 +2708,11 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -2712,11 +2711,11 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
}
int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
@@ -1860,7 +1860,7 @@
struct ieee80211_mutable_offsets offs;
struct ieee80211_tx_info *info;
struct sk_buff *skb, *rskb;
-@@ -2721,15 +2720,15 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+@@ -2724,15 +2723,15 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
struct bss_bcn_content_tlv *bcn;
int len;
@@ -1879,7 +1879,7 @@
if (!skb) {
dev_kfree_skb(rskb);
return -EINVAL;
-@@ -2752,9 +2751,9 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+@@ -2755,9 +2754,9 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
if (!en)
goto out;
@@ -1892,7 +1892,7 @@
out:
dev_kfree_skb(skb);
return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb,
-@@ -2762,14 +2761,15 @@ out:
+@@ -2765,14 +2764,15 @@ out:
}
int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
@@ -1911,7 +1911,7 @@
enum nl80211_band band = chandef->chan->band;
struct mt76_wcid *wcid = &dev->mt76.global_wcid;
struct bss_inband_discovery_tlv *discov;
-@@ -2779,20 +2779,20 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
+@@ -2782,20 +2782,20 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
u8 *buf, interval;
int len;
@@ -1937,7 +1937,7 @@
skb = ieee80211_get_unsol_bcast_probe_resp_tmpl(hw, vif);
}
-@@ -3456,7 +3456,7 @@ int mt7996_mcu_set_hdr_trans(struct mt7996_dev *dev, bool hdr_trans)
+@@ -3459,7 +3459,7 @@ int mt7996_mcu_set_hdr_trans(struct mt7996_dev *dev, bool hdr_trans)
MCU_WM_UNI_CMD(RX_HDR_TRANS), true);
}
@@ -1946,7 +1946,7 @@
{
#define MCU_EDCA_AC_PARAM 0
#define WMM_AIFS_SET BIT(0)
-@@ -3465,12 +3465,11 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
+@@ -3468,12 +3468,11 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
#define WMM_TXOP_SET BIT(3)
#define WMM_PARAM_SET (WMM_AIFS_SET | WMM_CW_MIN_SET | \
WMM_CW_MAX_SET | WMM_TXOP_SET)
@@ -1960,7 +1960,7 @@
};
struct sk_buff *skb;
int len = sizeof(hdr) + IEEE80211_NUM_ACS * sizeof(struct edca);
-@@ -3483,7 +3482,7 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
+@@ -3486,7 +3485,7 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
skb_put_data(skb, &hdr, sizeof(hdr));
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
@@ -1969,7 +1969,7 @@
struct edca *e;
struct tlv *tlv;
-@@ -4496,12 +4495,12 @@ mt7996_mcu_set_obss_spr_pd(struct mt7996_phy *phy,
+@@ -4499,12 +4498,12 @@ mt7996_mcu_set_obss_spr_pd(struct mt7996_phy *phy,
}
static int
@@ -1985,7 +1985,7 @@
struct {
u8 band_idx;
u8 __rsv[3];
-@@ -4573,7 +4572,8 @@ mt7996_mcu_set_obss_spr_bitmap(struct mt7996_phy *phy,
+@@ -4576,7 +4575,8 @@ mt7996_mcu_set_obss_spr_bitmap(struct mt7996_phy *phy,
sizeof(req), true);
}
@@ -1995,7 +1995,7 @@
struct ieee80211_he_obss_pd *he_obss_pd)
{
int ret;
-@@ -4607,7 +4607,7 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+@@ -4610,7 +4610,7 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
return ret;
/* Set SR prohibit */
@@ -2004,7 +2004,7 @@
if (ret)
return ret;
-@@ -4615,16 +4615,16 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+@@ -4618,16 +4618,16 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
return mt7996_mcu_set_obss_spr_bitmap(phy, he_obss_pd);
}
@@ -2024,7 +2024,7 @@
if (IS_ERR(skb))
return PTR_ERR(skb);
-@@ -4643,7 +4643,7 @@ int mt7996_mcu_update_bss_color(struct mt7996_dev *dev, struct ieee80211_vif *vi
+@@ -4646,7 +4646,7 @@ int mt7996_mcu_update_bss_color(struct mt7996_dev *dev, struct ieee80211_vif *vi
#define TWT_AGRT_PROTECT BIT(2)
int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
@@ -2033,7 +2033,7 @@
struct mt7996_twt_flow *flow,
int cmd)
{
-@@ -4674,12 +4674,12 @@ int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
+@@ -4677,12 +4677,12 @@ int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
.len = cpu_to_le16(sizeof(req) - 4),
.tbl_idx = flow->table_id,
.cmd = cmd,
@@ -2049,7 +2049,7 @@
.start_tsf = cpu_to_le64(flow->tsf),
.mantissa = flow->mantissa,
.exponent = flow->exp,
-@@ -4810,15 +4810,15 @@ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev, bool disable
+@@ -4813,15 +4813,15 @@ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev, bool disable
int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
struct ieee80211_vif *vif,
@@ -2068,7 +2068,7 @@
&msta->wcid,
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
-@@ -5462,8 +5462,9 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
+@@ -5449,8 +5449,9 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
&req, sizeof(req), false);
}
@@ -2080,7 +2080,7 @@
{
struct mt7996_vow_sta_ctrl *vow = msta ? &msta->vow : NULL;
u32 val = 0;
-@@ -5489,9 +5490,9 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, struct mt7996_sta *msta,
+@@ -5476,9 +5477,9 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, struct mt7996_sta *msta,
.len = cpu_to_le16(sizeof(req) - 4),
.wlan_idx = cpu_to_le16(msta ? msta->wcid.idx : 0),
.band_idx = phy->mt76->band_idx,
@@ -2092,7 +2092,7 @@
};
switch (id) {
-@@ -5679,7 +5680,7 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+@@ -5666,7 +5667,7 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
{
u8 mode, val;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -2101,7 +2101,7 @@
mode = FIELD_GET(RATE_CFG_MODE, *((u32 *)data));
val = FIELD_GET(RATE_CFG_VAL, *((u32 *)data));
-@@ -5710,11 +5711,11 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+@@ -5697,11 +5698,11 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -2116,10 +2116,10 @@
}
#endif
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 2b266d1..6b03ee1 100644
+index 75073a1b..46964079 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -324,18 +324,25 @@ struct mt7996_sta {
+@@ -325,18 +325,25 @@ struct mt7996_sta {
struct mt7996_vow_sta_ctrl vow;
};
@@ -2148,7 +2148,7 @@
/* crash-dump */
struct mt7996_crash_data {
guid_t guid;
-@@ -769,6 +776,13 @@ mt7996_chanctx_get(struct ieee80211_chanctx_conf *ctx)
+@@ -770,6 +777,13 @@ mt7996_chanctx_get(struct ieee80211_chanctx_conf *ctx)
return (struct mt7996_chanctx *)&ctx->drv_priv;
}
@@ -2162,7 +2162,7 @@
extern const struct ieee80211_ops mt7996_ops;
extern struct pci_driver mt7996_pci_driver;
extern struct pci_driver mt7996_hif_driver;
-@@ -779,7 +793,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
+@@ -780,7 +794,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
void mt7996_wfsys_reset(struct mt7996_dev *dev);
void mt7996_rro_hw_init(struct mt7996_dev *dev);
irqreturn_t mt7996_irq_handler(int irq, void *dev_instance);
@@ -2171,7 +2171,7 @@
int mt7996_register_device(struct mt7996_dev *dev);
void mt7996_unregister_device(struct mt7996_dev *dev);
const char *mt7996_eeprom_name(struct mt7996_dev *dev);
-@@ -805,37 +819,47 @@ int mt7996_run(struct ieee80211_hw *hw);
+@@ -806,37 +820,47 @@ int mt7996_run(struct ieee80211_hw *hw);
int mt7996_mcu_init(struct mt7996_dev *dev);
int mt7996_mcu_init_firmware(struct mt7996_dev *dev);
int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
@@ -2232,7 +2232,7 @@
struct ieee80211_sta *sta, void *data, u32 field);
int mt7996_mcu_set_eeprom(struct mt7996_dev *dev);
int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf);
-@@ -850,7 +874,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index,
+@@ -851,7 +875,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index,
const struct mt7996_dfs_pattern *pattern);
int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable);
int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val);
@@ -2241,7 +2241,7 @@
int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch);
int mt7996_mcu_get_temperature(struct mt7996_phy *phy);
int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state);
-@@ -890,8 +914,9 @@ void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb);
+@@ -891,8 +915,9 @@ void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb);
int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable);
void mt7996_mcu_scs_sta_poll(struct work_struct *work);
int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable);
@@ -2253,7 +2253,7 @@
int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy);
void mt7996_mcu_wmm_pbc_work(struct work_struct *work);
-@@ -1000,13 +1025,16 @@ void mt7996_update_channel(struct mt76_phy *mphy);
+@@ -1001,13 +1026,16 @@ void mt7996_update_channel(struct mt76_phy *mphy);
int mt7996_init_debugfs(struct mt7996_phy *phy);
void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int len);
bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len);
@@ -2273,7 +2273,7 @@
int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index 784a8be..bf55b43 100644
+index 784a8bea..bf55b430 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -223,6 +223,7 @@ static void
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0086-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0091-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0086-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0091-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch
index 7256cb2..8dcbc38 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0086-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0091-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch
@@ -1,7 +1,7 @@
-From 88111ec93e8bfd47f020965dd075849bd2233e40 Mon Sep 17 00:00:00 2001
+From bb417654387169098f02664031be303d1f1a7f16 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 27 Nov 2023 10:43:34 +0800
-Subject: [PATCH 086/116] wifi: mt76: mt7996: switch to per-link data structure
+Subject: [PATCH 091/199] mtk: mt76: mt7996: switch to per-link data structure
of sta
Introduce struct mt7996_link_sta, data structure for per-link STA.
@@ -12,167 +12,19 @@
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mt7615/mcu.c | 4 +-
- mt76_connac_mcu.c | 18 +-
- mt76_connac_mcu.h | 7 +-
- mt7915/mcu.c | 4 +-
- mt7925/mcu.c | 4 +-
mt7996/debugfs.c | 20 ++-
mt7996/mac.c | 109 ++++++------
mt7996/main.c | 223 +++++++++++++++---------
mt7996/mcu.c | 430 ++++++++++++++++++++++++----------------------
mt7996/mt7996.h | 44 +++--
mt7996/testmode.c | 6 +-
- 11 files changed, 482 insertions(+), 387 deletions(-)
+ 6 files changed, 461 insertions(+), 371 deletions(-)
-diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index a931066..8f4f203 100644
---- a/mt7615/mcu.c
-+++ b/mt7615/mcu.c
-@@ -862,8 +862,8 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
- else
- mvif->sta_added = true;
- }
-- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, sta, enable,
-- new_entry);
-+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, &sta->deflink,
-+ enable, new_entry);
- if (enable && sta)
- mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0,
- MT76_STA_INFO_STATE_ASSOC);
-diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 0c7b693..d83d314 100644
---- a/mt76_connac_mcu.c
-+++ b/mt76_connac_mcu.c
-@@ -371,9 +371,10 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_bss_omac_tlv);
-
- void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
- struct ieee80211_vif *vif,
-- struct ieee80211_sta *sta,
-+ struct ieee80211_link_sta *link_sta,
- bool enable, bool newly)
- {
-+ struct ieee80211_sta *sta = link_sta ? link_sta->sta : NULL;
- struct sta_rec_basic *basic;
- struct tlv *tlv;
- int conn_type;
-@@ -431,7 +432,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
- break;
- }
-
-- memcpy(basic->peer_addr, sta->addr, ETH_ALEN);
-+ memcpy(basic->peer_addr, link_sta->addr, ETH_ALEN);
- basic->qos = sta->wme;
- }
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv);
-@@ -1055,7 +1056,7 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
- return PTR_ERR(skb);
-
- if (info->sta || !info->offload_fw)
-- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta,
-+ mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, &info->sta->deflink,
- info->enable, info->newly);
- if (info->sta && info->enable)
- mt76_connac_mcu_sta_tlv(phy, skb, info->sta,
-@@ -1306,7 +1307,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
- EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba);
-
- u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
-- enum nl80211_band band, struct ieee80211_sta *sta)
-+ enum nl80211_band band,
-+ struct ieee80211_link_sta *link_sta)
- {
- struct mt76_dev *dev = phy->dev;
- const struct ieee80211_sta_he_cap *he_cap;
-@@ -1317,10 +1319,10 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
- if (is_connac_v1(dev))
- return 0x38;
-
-- if (sta) {
-- ht_cap = &sta->deflink.ht_cap;
-- vht_cap = &sta->deflink.vht_cap;
-- he_cap = &sta->deflink.he_cap;
-+ if (link_sta) {
-+ ht_cap = &link_sta->ht_cap;
-+ vht_cap = &link_sta->vht_cap;
-+ he_cap = &link_sta->he_cap;
- } else {
- struct ieee80211_supported_band *sband;
-
-diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index c19f8e0..740b9f5 100644
---- a/mt76_connac_mcu.h
-+++ b/mt76_connac_mcu.h
-@@ -1910,8 +1910,8 @@ int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy);
- int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif);
- void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
- struct ieee80211_vif *vif,
-- struct ieee80211_sta *sta, bool enable,
-- bool newly);
-+ struct ieee80211_link_sta *link_sta,
-+ bool enable, bool newly);
- void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, void *sta_wtbl,
-@@ -2019,7 +2019,8 @@ mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
- const struct ieee80211_sta_eht_cap *
- mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
- u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
-- enum nl80211_band band, struct ieee80211_sta *sta);
-+ enum nl80211_band band,
-+ struct ieee80211_link_sta *link_sta);
- u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
- enum nl80211_band band);
-
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 363ea0e..cb2e3b2 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -1504,7 +1504,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
-
- ra->valid = true;
- ra->auto_rate = true;
-- ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
-+ ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, &sta->deflink);
- ra->channel = chandef->chan->hw_value;
- ra->bw = sta->deflink.bandwidth;
- ra->phy.bw = sta->deflink.bandwidth;
-@@ -1669,7 +1669,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
- return PTR_ERR(skb);
-
- /* starec basic */
-- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable,
-+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, &sta->deflink, enable,
- !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx]));
- if (!enable)
- goto out;
-diff --git a/mt7925/mcu.c b/mt7925/mcu.c
-index 652a9ac..80e1828 100644
---- a/mt7925/mcu.c
-+++ b/mt7925/mcu.c
-@@ -1626,7 +1626,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
- return PTR_ERR(skb);
-
- if (info->sta || !info->offload_fw)
-- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta,
-+ mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, &info->sta->deflink,
- info->enable, info->newly);
- if (info->sta && info->enable) {
- mt7925_mcu_sta_phy_tlv(skb, info->vif, info->sta);
-@@ -2092,7 +2092,7 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb,
- basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_OFDM_INDEX);
-
- memcpy(basic_req->bssid, vif->bss_conf.bssid, ETH_ALEN);
-- basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, sta);
-+ basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, &sta->deflink);
- basic_req->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int);
- basic_req->dtim_period = vif->bss_conf.dtim_period;
- basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx);
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 06015d6..56e2192 100644
+index 5d4d69ea..62658dbc 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
-@@ -739,14 +739,15 @@ static void
+@@ -726,14 +726,15 @@ static void
mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -190,7 +42,7 @@
ctrl = BIT(31) | BIT(11) | (ac << 24);
val = mt76_rr(dev, MT_PLE_AC_QEMPTY(ac, idx));
-@@ -754,11 +755,11 @@ mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
+@@ -741,11 +742,11 @@ mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
if (val & BIT(offs))
continue;
@@ -204,7 +56,7 @@
msta->vif->deflink.mt76.wmm_idx, ac, qlen);
}
}
-@@ -1041,7 +1042,7 @@ mt7996_airtime_read(struct seq_file *s, void *data)
+@@ -1028,7 +1029,7 @@ mt7996_airtime_read(struct seq_file *s, void *data)
struct mt76_dev *mdev = &dev->mt76;
struct mt76_sta_stats *stats;
struct ieee80211_sta *sta;
@@ -213,7 +65,7 @@
struct mt76_wcid *wcid;
struct mt76_vif *vif;
u16 i;
-@@ -1053,9 +1054,9 @@ mt7996_airtime_read(struct seq_file *s, void *data)
+@@ -1040,9 +1041,9 @@ mt7996_airtime_read(struct seq_file *s, void *data)
if (!wcid || !wcid->sta)
continue;
@@ -226,7 +78,7 @@
stats = &wcid->stats;
seq_printf(s, "%pM WCID: %hu BandIdx: %hhu OmacIdx: 0x%hhx\t"
-@@ -1230,6 +1231,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
+@@ -1217,6 +1218,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
#define LONG_PREAMBLE 1
struct ieee80211_sta *sta = file->private_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -234,7 +86,7 @@
struct mt7996_dev *dev = msta->vif->deflink.phy->dev;
struct ra_rate phy = {};
char buf[100];
-@@ -1265,7 +1267,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
+@@ -1252,7 +1254,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
goto out;
}
@@ -244,7 +96,7 @@
phy.ltf = cpu_to_le16(ltf);
phy.ldpc = phy.ldpc ? 7 : 0;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 63b16f9..3cff43d 100644
+index 5fbcfc74..fbe6c0bd 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -54,7 +54,7 @@ static const struct mt7996_dfs_radar_spec jp_radar_specs = {
@@ -295,7 +147,7 @@
hw_aggr = status->aggr;
memset(status, 0, sizeof(*status));
-@@ -380,10 +379,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+@@ -378,10 +377,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
status->wcid = mt7996_rx_get_wcid(dev, idx, unicast);
if (status->wcid) {
@@ -309,7 +161,7 @@
&dev->mt76.sta_poll_list);
spin_unlock_bh(&dev->mt76.sta_poll_lock);
}
-@@ -592,7 +591,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+@@ -586,7 +585,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
#endif
} else {
status->flag |= RX_FLAG_8023;
@@ -318,7 +170,7 @@
*info);
}
-@@ -942,6 +941,7 @@ static void
+@@ -945,6 +944,7 @@ static void
mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
{
struct mt7996_sta *msta;
@@ -326,7 +178,7 @@
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
u16 fc, tid;
-@@ -970,7 +970,8 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
+@@ -973,7 +973,8 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
return;
msta = (struct mt7996_sta *)sta->drv_priv;
@@ -336,7 +188,7 @@
ieee80211_start_tx_ba_session(sta, tid, 0);
}
-@@ -1048,7 +1049,7 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1051,7 +1052,7 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
*/
info = le32_to_cpu(*cur_info);
if (info & MT_TXFREE_INFO_PAIR) {
@@ -345,7 +197,7 @@
u16 idx;
idx = FIELD_GET(MT_TXFREE_INFO_WLAN_ID, info);
-@@ -1057,10 +1058,10 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1060,10 +1061,10 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
if (!sta)
continue;
@@ -359,7 +211,7 @@
&mdev->sta_poll_list);
spin_unlock_bh(&mdev->sta_poll_lock);
continue;
-@@ -1265,7 +1266,7 @@ out:
+@@ -1268,7 +1269,7 @@ out:
static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
{
@@ -368,7 +220,7 @@
struct mt76_wcid *wcid;
__le32 *txs_data = data;
u16 wcidx;
-@@ -1286,16 +1287,15 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
+@@ -1289,16 +1290,15 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
if (!wcid)
goto out;
@@ -590,7 +442,7 @@
rcu_read_unlock();
diff --git a/mt7996/main.c b/mt7996/main.c
-index bc4863d..4e5ba58 100644
+index 8a32ec69..e071c5fa 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -229,6 +229,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
@@ -685,7 +537,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -447,10 +451,10 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -451,10 +455,10 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = sta ? (struct mt7996_sta *)sta->drv_priv :
&mvif->sta;
@@ -698,7 +550,7 @@
int idx = key->keyidx;
int err = 0;
-@@ -464,6 +468,12 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -468,6 +472,12 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
return -EOPNOTSUPP;
@@ -711,7 +563,7 @@
/* fall back to sw encryption for unsupported ciphers */
switch (key->cipher) {
case WLAN_CIPHER_SUITE_TKIP:
-@@ -486,16 +496,13 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -490,16 +500,13 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
default:
@@ -730,7 +582,7 @@
}
if (cmd == SET_KEY) {
-@@ -506,14 +513,14 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -510,14 +517,14 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
goto out;
}
@@ -748,7 +600,7 @@
out:
mutex_unlock(&dev->mt76.mutex);
-@@ -716,25 +723,27 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
+@@ -720,25 +727,27 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_bss_conf *mconf;
@@ -779,7 +631,7 @@
if (changed & BSS_CHANGED_ERP_SLOT) {
int slottime = info->use_short_slot ? 9 : 20;
-@@ -805,6 +814,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -809,6 +818,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_bss_conf *mconf = mconf_dereference_protected(mvif, 0);
@@ -787,7 +639,7 @@
u8 band_idx = mconf->phy->mt76->band_idx;
int idx;
-@@ -816,13 +826,16 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -820,13 +830,16 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (idx < 0)
return -ENOSPC;
@@ -810,7 +662,7 @@
#ifdef CONFIG_MTK_VENDOR
mt7996_vendor_amnt_sta_remove(mconf->phy, sta);
-@@ -855,19 +868,25 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -859,19 +872,25 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_bss_conf *mconf;
@@ -842,7 +694,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -879,25 +898,31 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -883,25 +902,31 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_bss_conf *mconf;
@@ -882,7 +734,7 @@
}
static void mt7996_tx(struct ieee80211_hw *hw,
-@@ -909,19 +934,22 @@ static void mt7996_tx(struct ieee80211_hw *hw,
+@@ -913,19 +938,22 @@ static void mt7996_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = info->control.vif;
struct mt76_wcid *wcid = &dev->mt76.global_wcid;
@@ -909,7 +761,7 @@
}
mt76_tx(mphy, control->sta, wcid, skb);
-@@ -948,6 +976,7 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -952,6 +980,7 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta = params->sta;
struct ieee80211_txq *txq = sta->txq[params->tid];
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -917,7 +769,7 @@
u16 tid = params->tid;
u16 ssn = params->ssn;
struct mt76_txq *mtxq;
-@@ -959,14 +988,15 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -963,14 +992,15 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mtxq = (struct mt76_txq *)txq->drv_priv;
mutex_lock(&dev->mt76.mutex);
@@ -935,7 +787,7 @@
ret = mt7996_mcu_add_rx_ba(dev, params, false);
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
-@@ -977,16 +1007,16 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -981,16 +1011,16 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
case IEEE80211_AMPDU_TX_STOP_FLUSH:
case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
mtxq->aggr = false;
@@ -955,7 +807,7 @@
ret = mt7996_mcu_add_tx_ba(dev, params, false);
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
break;
-@@ -1165,10 +1195,19 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
+@@ -1169,10 +1199,19 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
struct station_info *sinfo)
{
@@ -976,7 +828,7 @@
if (txrate->legacy || txrate->flags) {
if (txrate->legacy) {
sinfo->txrate.legacy = txrate->legacy;
-@@ -1187,44 +1226,52 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
+@@ -1191,44 +1230,52 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
sinfo->txrate.flags = txrate->flags;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
@@ -1040,7 +892,7 @@
}
static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
-@@ -1238,7 +1285,7 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
+@@ -1242,7 +1289,7 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
if (!msta->vif) {
dev_warn(dev->mt76.dev, "Un-initialized STA %pM wcid %d in rc_work\n",
@@ -1049,7 +901,7 @@
return;
}
-@@ -1284,16 +1331,18 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
+@@ -1288,16 +1335,18 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_bss_conf *mconf;
@@ -1071,7 +923,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1306,16 +1355,18 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
+@@ -1310,16 +1359,18 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_bss_conf *mconf;
@@ -1093,7 +945,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1448,11 +1499,12 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
+@@ -1452,11 +1503,12 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
{
struct mt76_ethtool_worker_info *wi = wi_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -1107,7 +959,7 @@
}
static
-@@ -1555,10 +1607,12 @@ mt7996_twt_teardown_request(struct ieee80211_hw *hw,
+@@ -1559,10 +1611,12 @@ mt7996_twt_teardown_request(struct ieee80211_hw *hw,
u8 flowid)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -1121,7 +973,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1681,6 +1735,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1685,6 +1739,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_bss_conf *mconf = &mvif->deflink;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -1129,7 +981,7 @@
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
-@@ -1703,7 +1758,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1707,7 +1762,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
if (!mtk_wed_device_active(wed))
return -ENODEV;
@@ -1138,7 +990,7 @@
return -EIO;
path->type = DEV_PATH_MTK_WDMA;
-@@ -1711,11 +1766,11 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1715,11 +1770,11 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
path->mtk_wdma.wdma_idx = wed->wdma_idx;
path->mtk_wdma.bss = mconf->mt76.idx;
path->mtk_wdma.queue = 0;
@@ -1153,7 +1005,7 @@
path->mtk_wdma.amsdu = 0;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index ebd3192..cab4a0a 100644
+index 1e0fca2d..20b84c93 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -117,13 +117,13 @@ mt7996_mcu_get_sta_nss(u16 mcs_map)
@@ -1496,7 +1348,7 @@
if (bfee)
@@ -1627,8 +1630,8 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf,
- EHT_PHY(CAP0_SU_BEAMFORMER, pe->phy_cap_info[0]);
+ EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]);
}
- if (sta->deflink.he_cap.has_he) {
@@ -1874,7 +1726,7 @@
ra->valid = true;
ra->auto_rate = true;
-- ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, sta);
+- ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, &sta->deflink);
+ ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, link_sta);
ra->channel = chandef->chan->hw_value;
- ra->bw = (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_320) ?
@@ -2019,7 +1871,7 @@
u8 omac_idx = mconf->mt76.omac_idx;
int ret;
-@@ -2339,73 +2347,70 @@ mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf, struct mt7996_sta *msta)
+@@ -2339,33 +2347,28 @@ mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf, struct mt7996_sta *msta)
vow->drr_quantum[IEEE80211_AC_BE] = VOW_DRR_QUANTUM_IDX2;
vow->drr_quantum[IEEE80211_AC_BK] = VOW_DRR_QUANTUM_IDX2;
@@ -2046,11 +1898,13 @@
{
struct ieee80211_vif *vif = conf->vif;
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- struct ieee80211_link_sta *link_sta;
- struct mt7996_sta *msta;
struct sk_buff *skb;
int ret;
- msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
+- link_sta = sta ? &sta->deflink : NULL;
-
skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
- &msta->wcid,
@@ -2058,12 +1912,7 @@
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
return PTR_ERR(skb);
-
- /* starec basic */
-- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, newly);
-+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, link_sta, enable, newly);
-
- if (!enable)
+@@ -2378,37 +2381,37 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
goto out;
/* starec hdr trans */
@@ -2114,7 +1963,7 @@
if (ret) {
dev_kfree_skb(skb);
return ret;
-@@ -2481,16 +2486,16 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
+@@ -2484,16 +2487,16 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
static int mt7996_mcu_get_pn(struct mt7996_dev *dev,
struct ieee80211_bss_conf *conf,
@@ -2134,7 +1983,7 @@
if (IS_ERR(skb))
return PTR_ERR(skb);
-@@ -2517,6 +2522,7 @@ static int mt7996_mcu_get_pn(struct mt7996_dev *dev,
+@@ -2520,6 +2523,7 @@ static int mt7996_mcu_get_pn(struct mt7996_dev *dev,
int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev,
struct ieee80211_bss_conf *conf,
struct mt7996_bss_conf *mconf,
@@ -2142,7 +1991,7 @@
struct ieee80211_key_conf *key)
{
struct mt7996_mcu_bcn_prot_tlv *bcn_prot;
-@@ -2535,7 +2541,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev,
+@@ -2538,7 +2542,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev,
bcn_prot = (struct mt7996_mcu_bcn_prot_tlv *)tlv;
@@ -2151,7 +2000,7 @@
if (ret) {
dev_kfree_skb(skb);
return ret;
-@@ -4811,21 +4817,18 @@ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev, bool disable
+@@ -4814,21 +4818,18 @@ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev, bool disable
int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
struct ieee80211_vif *vif,
struct mt7996_bss_conf *mconf,
@@ -2176,7 +2025,7 @@
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
}
-@@ -5014,7 +5017,7 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+@@ -5017,7 +5018,7 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
switch (tag) {
case UNI_PER_STA_RSSI:
for (i = 0; i < sta_num; ++i) {
@@ -2185,7 +2034,7 @@
struct mt76_phy *phy;
s8 rssi[4];
u8 *rcpi;
-@@ -5028,10 +5031,10 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+@@ -5031,10 +5032,10 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
rssi[2] = to_rssi(MT_PRXV_RCPI0, rcpi[2]);
rssi[3] = to_rssi(MT_PRXV_RCPI0, rcpi[3]);
@@ -2200,7 +2049,7 @@
} else {
ret = -EINVAL;
dev_err(dev->dev, "Failed to update RSSI for "
-@@ -5069,7 +5072,7 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev)
+@@ -5056,7 +5057,7 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev)
{
u16 sta_list[PER_STA_INFO_MAX_NUM];
LIST_HEAD(sta_poll_list);
@@ -2209,7 +2058,7 @@
int i, ret;
bool empty = false;
-@@ -5089,13 +5092,13 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev)
+@@ -5076,13 +5077,13 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev)
empty = true;
break;
}
@@ -2227,7 +2076,7 @@
}
ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_RSSI,
-@@ -5385,10 +5388,18 @@ int mt7996_mcu_set_scs_stats(struct mt7996_phy *phy)
+@@ -5372,10 +5373,18 @@ int mt7996_mcu_set_scs_stats(struct mt7996_phy *phy)
void mt7996_sta_rssi_work(void *data, struct ieee80211_sta *sta)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -2248,7 +2097,7 @@
}
void mt7996_mcu_scs_sta_poll(struct work_struct *work)
-@@ -5464,9 +5475,10 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
+@@ -5451,9 +5460,10 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
struct mt7996_bss_conf *mconf,
@@ -2261,7 +2110,7 @@
u32 val = 0;
struct {
u8 __rsv1[4];
-@@ -5488,11 +5500,11 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
+@@ -5475,11 +5485,11 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
} __packed req = {
.tag = cpu_to_le16(UNI_VOW_DRR_CTRL),
.len = cpu_to_le16(sizeof(req) - 4),
@@ -2277,10 +2126,10 @@
switch (id) {
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 6b03ee1..3701720 100644
+index 46964079..1732ff36 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -302,10 +302,10 @@ struct mt7996_vow_sta_ctrl {
+@@ -303,10 +303,10 @@ struct mt7996_vow_sta_ctrl {
u8 drr_quantum[IEEE80211_NUM_ACS];
};
@@ -2293,7 +2142,7 @@
struct list_head rc_list;
-@@ -324,6 +324,13 @@ struct mt7996_sta {
+@@ -325,6 +325,13 @@ struct mt7996_sta {
struct mt7996_vow_sta_ctrl vow;
};
@@ -2307,7 +2156,7 @@
struct mt7996_bss_conf {
struct mt76_vif mt76; /* must be first */
-@@ -783,6 +790,13 @@ mconf_dereference_protected(struct mt7996_vif *mvif, u8 link_id)
+@@ -784,6 +791,13 @@ mconf_dereference_protected(struct mt7996_vif *mvif, u8 link_id)
lockdep_is_held(&mvif->dev->mt76.mutex));
}
@@ -2321,7 +2170,7 @@
extern const struct ieee80211_ops mt7996_ops;
extern struct pci_driver mt7996_pci_driver;
extern struct pci_driver mt7996_hif_driver;
-@@ -827,10 +841,12 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
+@@ -828,10 +842,12 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
struct mt7996_bss_conf *mconf, bool enable);
int mt7996_mcu_add_bss_info(struct mt7996_phy *phy,
struct ieee80211_bss_conf *conf,
@@ -2337,7 +2186,7 @@
int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
struct ieee80211_ampdu_params *params,
bool add);
-@@ -852,7 +868,8 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy,
+@@ -853,7 +869,8 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy,
int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
struct ieee80211_bss_conf *conf,
struct mt7996_bss_conf *mconf,
@@ -2347,7 +2196,7 @@
int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef);
int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag);
int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf);
-@@ -860,7 +877,9 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
+@@ -861,7 +878,9 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
void *data, u16 version);
int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev,
struct mt7996_bss_conf *mconf,
@@ -2358,7 +2207,7 @@
int mt7996_mcu_set_eeprom(struct mt7996_dev *dev);
int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf);
int mt7996_mcu_get_eeprom_free_block(struct mt7996_dev *dev, u8 *block_num);
-@@ -916,7 +935,8 @@ void mt7996_mcu_scs_sta_poll(struct work_struct *work);
+@@ -917,7 +936,8 @@ void mt7996_mcu_scs_sta_poll(struct work_struct *work);
int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable);
int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
struct mt7996_bss_conf *mconf,
@@ -2368,7 +2217,7 @@
int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy);
void mt7996_mcu_wmm_pbc_work(struct work_struct *work);
-@@ -983,7 +1003,7 @@ void mt7996_mac_reset_counters(struct mt7996_phy *phy);
+@@ -984,7 +1004,7 @@ void mt7996_mac_reset_counters(struct mt7996_phy *phy);
void mt7996_mac_cca_stats_reset(struct mt7996_phy *phy);
void mt7996_mac_enable_nf(struct mt7996_dev *dev, u8 band);
void mt7996_mac_enable_rtscts(struct mt7996_dev *dev,
@@ -2377,7 +2226,7 @@
void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct mt76_wcid *wcid,
struct ieee80211_key_conf *key, int pid,
-@@ -1001,8 +1021,7 @@ void mt7996_mac_dump_work(struct work_struct *work);
+@@ -1002,8 +1022,7 @@ void mt7996_mac_dump_work(struct work_struct *work);
void mt7996_mac_sta_rc_work(struct work_struct *work);
void mt7996_mac_update_stats(struct mt7996_phy *phy);
void mt7996_mac_twt_teardown_flow(struct mt7996_dev *dev,
@@ -2387,7 +2236,7 @@
void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
struct ieee80211_twt_setup *twt);
-@@ -1031,11 +1050,12 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
+@@ -1032,11 +1051,12 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev,
struct ieee80211_bss_conf *conf,
struct mt7996_bss_conf *mconf,
@@ -2402,7 +2251,7 @@
int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
#ifdef CONFIG_MAC80211_DEBUGFS
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index bf55b43..ba17f94 100644
+index bf55b430..ba17f947 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -235,8 +235,8 @@ mt7996_tm_init(struct mt7996_phy *phy, bool en)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0092-mtk-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0092-mtk-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch
new file mode 100644
index 0000000..5ca3404
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0092-mtk-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch
@@ -0,0 +1,50 @@
+From f9ceb3601873e92e296383b3f8f124cf7d84e6fe Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 29 Nov 2023 11:04:50 +0800
+Subject: [PATCH 092/199] mtk: mt76: extend wcid and sta flow for MLO support
+
+Add link related info to wcid, and split sta connection flow of common
+parts for MLO supported chipsets.
+This is a preliminary patch to add MLO support for mt7996 chipsets.
+
+Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mac80211.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/mac80211.c b/mac80211.c
+index 032a13a5..49834afe 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -1368,6 +1368,9 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif,
+ if (ret)
+ goto out;
+
++ if (phy->hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)
++ goto out;
++
+ for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
+ struct mt76_txq *mtxq;
+
+@@ -1397,12 +1400,15 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif,
+ struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
+ int i, idx = wcid->idx;
+
+- for (i = 0; i < ARRAY_SIZE(wcid->aggr); i++)
++ for (i = 0; !sta->valid_links && i < ARRAY_SIZE(wcid->aggr); i++)
+ mt76_rx_aggr_stop(dev, wcid, i);
+
+ if (dev->drv->sta_remove)
+ dev->drv->sta_remove(dev, vif, sta);
+
++ if (sta->valid_links)
++ return;
++
+ mt76_wcid_cleanup(dev, wcid);
+
+ mt76_wcid_mask_clear(dev->wcid_mask, idx);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0088-wifi-mt76-mt7996-enable-MLO-capability.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0093-mtk-mt76-mt7996-enable-MLO-capability.patch
similarity index 79%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0088-wifi-mt76-mt7996-enable-MLO-capability.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0093-mtk-mt76-mt7996-enable-MLO-capability.patch
index 9fbb44a..ee007e2 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0088-wifi-mt76-mt7996-enable-MLO-capability.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0093-mtk-mt76-mt7996-enable-MLO-capability.patch
@@ -1,21 +1,21 @@
-From ebe94f1d3aa73deefe0057ae93974a06b55db1ce Mon Sep 17 00:00:00 2001
+From 208cd15d45360f69c2811bed72b2715c83632b3b Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 30 Nov 2023 16:31:17 +0800
-Subject: [PATCH 088/116] wifi: mt76: mt7996: enable MLO capability
+Subject: [PATCH 093/199] mtk: mt76: mt7996: enable MLO capability
This is a preliminary patch to add MLO support for mt7996 chipsets.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7996/eeprom.c | 6 ++++++
- mt7996/init.c | 40 ++++++++++++++++++++++++++++++++++++++--
- 2 files changed, 44 insertions(+), 2 deletions(-)
+ mt7996/init.c | 38 ++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 51455d8..0393e93 100644
+index c4714982..cd93a3c2 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
-@@ -387,6 +387,12 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
+@@ -390,6 +390,12 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
break;
}
@@ -29,23 +29,19 @@
}
diff --git a/mt7996/init.c b/mt7996/init.c
-index 381e129..c6eb6a5 100644
+index 86bb0661..2fe869c9 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -34,16 +34,45 @@ static const struct ieee80211_iface_combination if_comb[] = {
+@@ -35,7 +35,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
.limits = if_limits,
.n_limits = ARRAY_SIZE(if_limits),
.max_interfaces = MT7996_MAX_INTERFACES,
- .num_different_channels = 1,
+ .num_different_channels = 3,
.beacon_int_infra_match = true,
-+ /*
.radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
BIT(NL80211_CHAN_WIDTH_20) |
- BIT(NL80211_CHAN_WIDTH_40) |
- BIT(NL80211_CHAN_WIDTH_80) |
- BIT(NL80211_CHAN_WIDTH_160),
-+ */
+@@ -46,6 +46,33 @@ static const struct ieee80211_iface_combination if_comb[] = {
}
};
@@ -79,7 +75,7 @@
static ssize_t mt7996_thermal_temp_show(struct device *dev,
struct device_attribute *attr,
char *buf)
-@@ -417,8 +446,9 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -419,8 +446,9 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
@@ -90,7 +86,7 @@
hw->max_tx_fragments = 4;
-@@ -462,6 +492,12 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+@@ -464,6 +492,12 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy->max_scan_ssids = 4;
wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0089-wifi-mt76-mt7996-support-multi-link-vif-links-and-ML.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0094-mtk-mt76-mt7996-support-multi-link-vif-links-and-MLO.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0089-wifi-mt76-mt7996-support-multi-link-vif-links-and-ML.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0094-mtk-mt76-mt7996-support-multi-link-vif-links-and-MLO.patch
index c4d110d..db2ebfa 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0089-wifi-mt76-mt7996-support-multi-link-vif-links-and-ML.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0094-mtk-mt76-mt7996-support-multi-link-vif-links-and-MLO.patch
@@ -1,7 +1,7 @@
-From 9b5284be6784cf32222425a9cbbd9622db38aafd Mon Sep 17 00:00:00 2001
+From db6f06e9685bd4297e87b10b6f2550b4430e3b0a Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 23 Nov 2023 18:22:11 +0800
-Subject: [PATCH 089/116] wifi: mt76: mt7996: support multi-link vif links and
+Subject: [PATCH 094/199] mtk: mt76: mt7996: support multi-link vif links and
MLO bss callbacks
Rework add/remove interface functions to add/remove bss_conf functions,
@@ -12,13 +12,13 @@
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mt7996/main.c | 298 +++++++++++++++++++++++++++++++++++++++---------
+ mt7996/main.c | 295 +++++++++++++++++++++++++++++++++++++++---------
mt7996/mcu.c | 29 +++--
mt7996/mt7996.h | 9 ++
- 3 files changed, 270 insertions(+), 66 deletions(-)
+ 3 files changed, 267 insertions(+), 66 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 4e5ba58..9fbb86c 100644
+index e071c5fa..3abae2fe 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -205,6 +205,38 @@ static int get_omac_idx(enum nl80211_iftype type, u64 mask)
@@ -162,7 +162,7 @@
mconf->vif = mvif;
mconf->phy = phy;
mconf->mt76.band_idx = band_idx;
- mconf->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
+ mconf->mt76.wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
- mvif->dev = dev;
+ mconf->link_id = link_id;
@@ -284,7 +284,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -716,10 +817,31 @@ mt7996_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+@@ -720,10 +821,31 @@ mt7996_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS3(band), mu[3]);
}
@@ -320,7 +320,7 @@
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_bss_conf *mconf;
-@@ -735,7 +857,6 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
+@@ -739,7 +861,6 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
* and then peer references bss_info_rfch to set bandwidth cap.
*/
if ((changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) ||
@@ -328,7 +328,7 @@
(changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) {
mt7996_mcu_add_bss_info(phy, info, mconf, mlink, true);
mt7996_mcu_add_sta(dev, info, mconf, NULL, mlink, true,
-@@ -1078,7 +1199,7 @@ mt7996_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+@@ -1082,7 +1203,7 @@ mt7996_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
u64 ret;
mutex_lock(&dev->mt76.mutex);
@@ -337,7 +337,7 @@
ret = __mt7996_get_tsf(hw, mconf);
mutex_unlock(&dev->mt76.mutex);
-@@ -1101,7 +1222,7 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1105,7 +1226,7 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
@@ -346,7 +346,7 @@
n = mconf->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
: mconf->mt76.omac_idx;
mt76_wr(dev, MT_LPON_UTTR0(phy->mt76->band_idx), tsf.t32[0]);
-@@ -1129,7 +1250,7 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1133,7 +1254,7 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
@@ -355,7 +355,7 @@
n = mconf->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
: mconf->mt76.omac_idx;
mt76_wr(dev, MT_LPON_UTTR0(phy->mt76->band_idx), tsf.t32[0]);
-@@ -1304,7 +1425,7 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1308,7 +1429,7 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 changed = IEEE80211_RC_SUPP_RATES_CHANGED;
mutex_lock(&dev->mt76.mutex);
@@ -364,7 +364,7 @@
mconf->bitrate_mask = *mask;
mutex_unlock(&dev->mt76.mutex);
-@@ -1524,7 +1645,7 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,
+@@ -1528,7 +1649,7 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,
int i, ei = 0;
mutex_lock(&dev->mt76.mutex);
@@ -373,7 +373,7 @@
wi.idx = mconf->mt76.idx,
mt7996_mac_update_stats(phy);
-@@ -1897,6 +2018,8 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1901,6 +2022,8 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_phy *phy = ctx->phy;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_bss_conf *mconf;
@@ -382,7 +382,7 @@
wiphy_info(hw->wiphy, "Assign VIF (addr: %pM, type: %d, link_id: %d) to channel context: %d MHz\n",
vif->addr, vif->type, link_conf->link_id,
-@@ -1904,10 +2027,24 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1908,10 +2031,24 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&phy->dev->mt76.mutex);
@@ -408,7 +408,7 @@
mutex_unlock(&phy->dev->mt76.mutex);
return 0;
-@@ -1933,7 +2070,7 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1937,7 +2074,7 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (test_bit(MT76_SCANNING, &phy->mt76->state))
mt7996_scan_complete(phy, true);
@@ -417,7 +417,7 @@
mconf->chanctx = NULL;
ctx->nbss_assigned--;
-@@ -1973,6 +2110,57 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+@@ -1977,6 +2114,54 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
return mt7996_set_channel(phy, &new_ctx->chandef);
}
@@ -438,9 +438,6 @@
+
+ mutex_lock(&dev->mt76.mutex);
+
-+ /* check if there's legacy bss needed to be removed */
-+ if (rcu_access_pointer(mvif->link[0]) == &mvif->deflink)
-+ rem |= BIT(0);
+ /* remove first */
+ for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct mt7996_bss_conf *mconf =
@@ -473,9 +470,9 @@
+}
+
const struct ieee80211_ops mt7996_ops = {
- .tx = mt7996_tx,
- .start = mt7996_start,
-@@ -1982,7 +2170,8 @@ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -1990,7 +2175,8 @@ const struct ieee80211_ops mt7996_ops = {
.config = mt7996_config,
.conf_tx = mt7996_conf_tx,
.configure_filter = mt7996_configure_filter,
@@ -485,14 +482,14 @@
.sta_state = mt76_sta_state,
.sta_pre_rcu_remove = mt76_sta_pre_rcu_remove,
.sta_rc_update = mt7996_sta_rc_update,
-@@ -2028,4 +2217,5 @@ const struct ieee80211_ops mt7996_ops = {
+@@ -2036,4 +2222,5 @@ const struct ieee80211_ops mt7996_ops = {
.assign_vif_chanctx = mt7996_assign_vif_chanctx,
.unassign_vif_chanctx = mt7996_unassign_vif_chanctx,
.switch_vif_chanctx = mt7996_switch_vif_chanctx,
+ .change_vif_links = mt7996_change_vif_links,
};
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index cab4a0a..2a17299 100644
+index 20b84c93..d3e244ee 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1047,15 +1047,23 @@ static void
@@ -552,10 +549,10 @@
if (vif->type == NL80211_IFTYPE_MONITOR)
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 3701720..ed8c82e 100644
+index 1732ff36..09b1088e 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -340,6 +340,9 @@ struct mt7996_bss_conf {
+@@ -341,6 +341,9 @@ struct mt7996_bss_conf {
struct cfg80211_bitrate_mask bitrate_mask;
struct mt7996_chanctx *chanctx;
@@ -565,7 +562,7 @@
};
struct mt7996_vif {
-@@ -348,6 +351,10 @@ struct mt7996_vif {
+@@ -349,6 +352,10 @@ struct mt7996_vif {
struct mt7996_sta sta;
struct mt7996_dev *dev;
@@ -576,7 +573,7 @@
};
/* crash-dump */
-@@ -549,6 +556,8 @@ struct mt7996_dev {
+@@ -550,6 +557,8 @@ struct mt7996_dev {
u16 chainmask;
u8 chainshift[__MT_MAX_BAND];
u32 hif_idx;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0090-wifi-mt76-mt7996-support-multi-link-sta-links-and-ML.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0090-wifi-mt76-mt7996-support-multi-link-sta-links-and-ML.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch
index b4ea4c0..1338a68 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0090-wifi-mt76-mt7996-support-multi-link-sta-links-and-ML.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch
@@ -1,7 +1,7 @@
-From 707513db7b37788147180eda7215eb23561d579f Mon Sep 17 00:00:00 2001
+From 9fb46d0e65f5f37975a71ad433db8290ee586566 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 29 Nov 2023 10:12:39 +0800
-Subject: [PATCH 090/116] wifi: mt76: mt7996: support multi-link sta links and
+Subject: [PATCH 095/199] mtk: mt76: mt7996: support multi-link sta links and
MLO sta callbacks
Rework add_sta functions to add_link_sta functions, and support
@@ -12,32 +12,17 @@
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mt76_connac_mcu.h | 2 +
- mt7996/main.c | 309 ++++++++++++++++++++++++++++++++++++----------
- mt7996/mcu.c | 117 ++++++++++++++++++
- mt7996/mcu.h | 29 +++++
- mt7996/mt7996.h | 7 ++
- 5 files changed, 398 insertions(+), 66 deletions(-)
+ mt7996/main.c | 309 +++++++++++++++++++++++++++++++++++++-----------
+ mt7996/mcu.c | 117 ++++++++++++++++++
+ mt7996/mcu.h | 29 +++++
+ mt7996/mt7996.h | 7 ++
+ 4 files changed, 396 insertions(+), 66 deletions(-)
-diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 740b9f5..728ffb3 100644
---- a/mt76_connac_mcu.h
-+++ b/mt76_connac_mcu.h
-@@ -814,7 +814,9 @@ enum {
- STA_REC_HE_6G = 0x17,
- STA_REC_HE_V2 = 0x19,
- STA_REC_MLD = 0x20,
-+ STA_REC_EHT_MLD = 0x21,
- STA_REC_EHT = 0x22,
-+ STA_REC_MLD_TEARDOWN = 0x23,
- STA_REC_PN_INFO = 0x26,
- STA_REC_KEY_V3 = 0x27,
- STA_REC_HDRT = 0x28,
diff --git a/mt7996/main.c b/mt7996/main.c
-index 9fbb86c..37e065f 100644
+index 3abae2fe..e850942f 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -928,42 +928,234 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
+@@ -932,42 +932,234 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
mutex_unlock(&dev->mt76.mutex);
}
@@ -292,7 +277,7 @@
case MT_BAND1:
phy = mt7996_phy2(dev);
break;
-@@ -986,28 +1178,11 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -990,28 +1182,11 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
@@ -323,7 +308,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1016,34 +1191,9 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -1020,34 +1195,9 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
@@ -360,7 +345,7 @@
}
static void mt7996_tx(struct ieee80211_hw *hw,
-@@ -2161,6 +2311,32 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2162,6 +2312,32 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return ret;
}
@@ -391,19 +376,19 @@
+}
+
const struct ieee80211_ops mt7996_ops = {
- .tx = mt7996_tx,
- .start = mt7996_start,
-@@ -2218,4 +2394,5 @@ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -2223,4 +2399,5 @@ const struct ieee80211_ops mt7996_ops = {
.unassign_vif_chanctx = mt7996_unassign_vif_chanctx,
.switch_vif_chanctx = mt7996_switch_vif_chanctx,
.change_vif_links = mt7996_change_vif_links,
+ .change_sta_links = mt7996_change_sta_links,
};
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 2a17299..16352d1 100644
+index d3e244ee..7138230e 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -2425,6 +2425,123 @@ out:
+@@ -2426,6 +2426,123 @@ out:
MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
}
@@ -518,7 +503,7 @@
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
-+ mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_TEARDOWN, sizeof(struct tlv));
++ mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_OFF, sizeof(struct tlv));
+
+ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
@@ -528,10 +513,10 @@
mt7996_mcu_sta_key_tlv(struct mt76_wcid *wcid,
struct sk_buff *skb,
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 814072e..ee36cf5 100644
+index b15796dc..23d44cd3 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -698,6 +698,35 @@ struct sta_rec_hdr_trans {
+@@ -692,6 +692,35 @@ struct sta_rec_hdr_trans {
u8 mesh;
} __packed;
@@ -568,10 +553,10 @@
__le16 tag;
__le16 len;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index ed8c82e..913aff1 100644
+index 09b1088e..4775e1f8 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -329,6 +329,8 @@ struct mt7996_sta {
+@@ -330,6 +330,8 @@ struct mt7996_sta {
struct mt7996_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
struct mt7996_vif *vif;
@@ -580,7 +565,7 @@
};
struct mt7996_bss_conf {
-@@ -856,6 +858,9 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+@@ -857,6 +859,9 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
struct mt7996_bss_conf *mconf,
struct ieee80211_link_sta *link_sta,
struct mt7996_link_sta *mlink, bool enable, bool newly);
@@ -590,7 +575,7 @@
int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
struct ieee80211_ampdu_params *params,
bool add);
-@@ -879,6 +884,8 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+@@ -880,6 +885,8 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
struct mt7996_bss_conf *mconf,
struct ieee80211_link_sta *link_sta,
struct mt7996_link_sta *mlink, bool changed);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0091-wifi-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ba.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0096-mtk-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ban.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0091-wifi-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ba.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0096-mtk-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ban.patch
index 45d16d3..4a5208f 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0091-wifi-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ba.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0096-mtk-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ban.patch
@@ -1,8 +1,8 @@
-From 5aa4150e28fdef37bedc7231913a17c260b7aef0 Mon Sep 17 00:00:00 2001
+From 05433210ece4bbeee342650a8c4ea98c8e1c823c Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 1 Dec 2023 16:01:53 +0800
-Subject: [PATCH 091/116] wifi: mt76: mt7996: introduce mt7996_band_phy() for
- ch band and phy mapping
+Subject: [PATCH 096/199] mtk: mt76: mt7996: introduce mt7996_band_phy() for ch
+ band and phy mapping
For MLO devices, one ieee80211_hw can be mapped to several bands, and
thus several mt76_phy. Add mt7996_band_phy() to temporarily do the
@@ -16,7 +16,7 @@
2 files changed, 112 insertions(+), 59 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 37e065f..e443761 100644
+index e850942f..ab99f1cf 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -41,9 +41,8 @@ static void mt7996_testmode_disable_all(struct mt7996_dev *dev)
@@ -90,13 +90,13 @@
+ ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH);
+ if (ret)
+ goto out;
-
-- ret = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_SKU_POWER_LIMIT_CTRL,
-- dev->dbg.sku_disable ? 0 : phy->sku_limit_en);
++
+ ret = mt7996_mcu_set_thermal_throttling(phy, MT7996_THERMAL_THROTTLE_MAX);
+ if (ret)
+ goto out;
-+
+
+- ret = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_SKU_POWER_LIMIT_CTRL,
+- dev->dbg.sku_disable ? 0 : phy->sku_limit_en);
+ ret = mt7996_mcu_set_thermal_protect(phy, true);
+ if (ret)
+ goto out;
@@ -187,7 +187,7 @@
}
static inline int get_free_idx(u32 mask, u8 start, u8 end)
-@@ -2057,7 +2077,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2061,7 +2081,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_scan_request *hw_req)
{
struct cfg80211_scan_request *req = &hw_req->req;
@@ -196,7 +196,7 @@
mutex_lock(&phy->dev->mt76.mutex);
if (WARN_ON(phy->scan_req || phy->scan_chan)) {
-@@ -2079,19 +2099,30 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2083,19 +2103,30 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static void
mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
@@ -234,10 +234,10 @@
int ret;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 913aff1..4c090ba 100644
+index 4775e1f8..d5b61a2e 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -788,6 +788,28 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
+@@ -789,6 +789,28 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
return 1;
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0092-wifi-mt76-mt7996-rework-ieee80211_ops-callbacks-for-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0097-mtk-mt76-mt7996-rework-ieee80211_ops-callbacks-for-l.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0092-wifi-mt76-mt7996-rework-ieee80211_ops-callbacks-for-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0097-mtk-mt76-mt7996-rework-ieee80211_ops-callbacks-for-l.patch
index 13bff79..5e2b865 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0092-wifi-mt76-mt7996-rework-ieee80211_ops-callbacks-for-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0097-mtk-mt76-mt7996-rework-ieee80211_ops-callbacks-for-l.patch
@@ -1,8 +1,8 @@
-From 31581304bf759bc9d85325c233731aaa5667d311 Mon Sep 17 00:00:00 2001
+From 874f7bc5d6481d84d3d38f0a598ca791dc9755d8 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 1 Dec 2023 17:26:43 +0800
-Subject: [PATCH 092/116] wifi: mt76: mt7996: rework ieee80211_ops callbacks
- for link consideration
+Subject: [PATCH 097/199] mtk: mt76: mt7996: rework ieee80211_ops callbacks for
+ link consideration
Extend ieee80211 callback functions to support multi-link operation.
This is a preliminary patch to add MLO support for mt7996 chipsets.
@@ -15,10 +15,10 @@
1 file changed, 204 insertions(+), 109 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index e443761..f5658d4 100644
+index ab99f1cf..6148c834 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -568,7 +568,6 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -572,7 +572,6 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_key_conf *key)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -26,7 +26,7 @@
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = sta ? (struct mt7996_sta *)sta->drv_priv :
&mvif->sta;
-@@ -578,70 +577,77 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -582,70 +581,77 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
u8 *wcid_keyidx;
int idx = key->keyidx;
int err = 0;
@@ -159,7 +159,7 @@
out:
mutex_unlock(&dev->mt76.mutex);
-@@ -697,7 +703,11 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -701,7 +707,11 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
};
mutex_lock(&dev->mt76.mutex);
@@ -172,7 +172,7 @@
/* firmware uses access class index */
mconf->queue_params[mq_to_aci[queue]] = *params;
-@@ -840,19 +850,26 @@ mt7996_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+@@ -844,19 +854,26 @@ mt7996_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
static void mt7996_vif_cfg_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u64 changed)
{
@@ -206,7 +206,7 @@
}
mutex_unlock(&dev->mt76.mutex);
-@@ -871,8 +888,13 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
+@@ -875,8 +892,13 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
mutex_lock(&dev->mt76.mutex);
@@ -222,7 +222,7 @@
/* station mode uses BSSID to map the wlan entry to a peer,
* and then peer references bss_info_rfch to set bandwidth cap.
*/
-@@ -928,6 +950,7 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
+@@ -932,6 +954,7 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_MU_GROUPS)
mt7996_update_mu_group(hw, info, mconf);
@@ -230,7 +230,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -938,13 +961,22 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
+@@ -942,13 +965,22 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -258,7 +258,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1216,34 +1248,74 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -1220,34 +1252,74 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7996_mac_sta_remove_links(dev, vif, sta, rem);
}
@@ -345,7 +345,7 @@
}
static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
-@@ -1279,7 +1351,7 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1283,7 +1355,7 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mtxq = (struct mt76_txq *)txq->drv_priv;
mutex_lock(&dev->mt76.mutex);
@@ -354,7 +354,7 @@
switch (action) {
case IEEE80211_AMPDU_RX_START:
mt76_rx_aggr_start(&dev->mt76, &mlink->wcid, tid, ssn,
-@@ -1494,7 +1566,7 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
+@@ -1498,7 +1570,7 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
/* TODO: support per-link rate report */
mutex_lock(&dev->mt76.mutex);
@@ -363,7 +363,7 @@
if (!mlink)
goto out;
-@@ -1554,7 +1626,7 @@ static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta)
+@@ -1558,7 +1630,7 @@ static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta)
u32 *changed = data;
rcu_read_lock();
@@ -372,7 +372,7 @@
spin_lock_bh(&dev->mt76.sta_poll_lock);
mlink->changed |= *changed;
-@@ -1621,19 +1693,26 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
+@@ -1625,19 +1697,26 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -408,7 +408,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1645,19 +1724,26 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
+@@ -1649,19 +1728,26 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -444,7 +444,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1790,9 +1876,13 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
+@@ -1794,9 +1880,13 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
{
struct mt76_ethtool_worker_info *wi = wi_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
@@ -460,7 +460,7 @@
return;
mt76_ethtool_worker(wi, &mlink->wcid.stats, true);
-@@ -2024,12 +2114,13 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -2028,12 +2118,13 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
struct net_device_path *path)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
@@ -476,7 +476,7 @@
if (dev->hif2) {
switch (dev->option_type) {
-@@ -2049,6 +2140,10 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -2053,6 +2144,10 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
if (!mtk_wed_device_active(wed))
return -ENODEV;
@@ -487,7 +487,7 @@
if (mlink->wcid.idx > MT7996_WTBL_STA)
return -EIO;
-@@ -2380,7 +2475,7 @@ const struct ieee80211_ops mt7996_ops = {
+@@ -2385,7 +2480,7 @@ const struct ieee80211_ops mt7996_ops = {
.vif_cfg_changed = mt7996_vif_cfg_changed,
.link_info_changed = mt7996_link_info_changed,
.sta_state = mt76_sta_state,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0093-wifi-mt76-mt7996-rework-TXD-for-multi-link-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0098-mtk-mt76-mt7996-rework-TXD-for-multi-link-support.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0093-wifi-mt76-mt7996-rework-TXD-for-multi-link-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0098-mtk-mt76-mt7996-rework-TXD-for-multi-link-support.patch
index 6509b04..120bcda 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0093-wifi-mt76-mt7996-rework-TXD-for-multi-link-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0098-mtk-mt76-mt7996-rework-TXD-for-multi-link-support.patch
@@ -1,7 +1,7 @@
-From 59f38b9ffa5320f9d80c0752d8ffc15dcf0114c5 Mon Sep 17 00:00:00 2001
+From 993bb57ca7933d2de1e8b77693e5d006e6968c4c Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 4 Dec 2023 11:25:54 +0800
-Subject: [PATCH 093/116] wifi: mt76: mt7996: rework TXD for multi-link support
+Subject: [PATCH 098/199] mtk: mt76: mt7996: rework TXD for multi-link support
This is a preliminary patch to add MLO support for mt7996 chipsets.
@@ -14,10 +14,10 @@
2 files changed, 73 insertions(+), 24 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 3cff43d..0fa3266 100644
+index fbe6c0bd..b0ad48dd 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -621,9 +621,8 @@ mt7996_mac_write_txwi_8023(struct mt7996_dev *dev, __le32 *txwi,
+@@ -615,9 +615,8 @@ mt7996_mac_write_txwi_8023(struct mt7996_dev *dev, __le32 *txwi,
u32 val;
if (wcid->sta) {
@@ -28,7 +28,7 @@
wmm = sta->wme;
}
-@@ -724,6 +723,10 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+@@ -727,6 +726,10 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
txwi[3] |= cpu_to_le32(val);
txwi[3] &= ~cpu_to_le32(MT_TXD3_HW_AMSDU);
}
@@ -39,7 +39,7 @@
}
void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
-@@ -733,10 +736,12 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+@@ -736,10 +739,12 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = info->control.vif;
@@ -53,7 +53,7 @@
u16 tx_count = 15;
u32 val;
bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
-@@ -744,11 +749,16 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+@@ -747,11 +752,16 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
bool beacon = !!(changed & (BSS_CHANGED_BEACON |
BSS_CHANGED_BEACON_ENABLED)) && (!inband_disc);
@@ -75,7 +75,7 @@
}
if (inband_disc) {
-@@ -795,7 +805,10 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+@@ -798,7 +808,10 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
val |= MT_TXD5_TX_STATUS_HOST;
txwi[5] = cpu_to_le32(val);
@@ -87,7 +87,7 @@
if (is_mt7996(&dev->mt76))
val |= FIELD_PREP(MT_TXD6_MSDU_CNT, 1);
else
-@@ -814,16 +827,18 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+@@ -817,16 +830,18 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
is_multicast_ether_addr(hdr->addr1);
u8 idx = MT7996_BASIC_RATES_TBL;
@@ -112,7 +112,7 @@
txwi[6] |= cpu_to_le32(val);
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
}
-@@ -839,17 +854,48 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -842,17 +857,48 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_info->skb);
struct ieee80211_key_conf *key = info->control.hw_key;
struct ieee80211_vif *vif = info->control.vif;
@@ -163,7 +163,7 @@
t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
t->skb = tx_info->skb;
-@@ -894,13 +940,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -897,13 +943,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
if (!is_8023 && ieee80211_is_mgmt(hdr->frame_control))
txp->fw.flags |= cpu_to_le16(MT_CT_INFO_MGMT_FRAME);
@@ -179,10 +179,10 @@
txp->fw.rept_wds_wcid = cpu_to_le16(sta ? wcid->idx : 0xfff);
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 4c090ba..21a95c1 100644
+index d5b61a2e..72988c9e 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -830,6 +830,15 @@ mlink_dereference_protected(struct mt7996_sta *msta, u8 link_id)
+@@ -831,6 +831,15 @@ mlink_dereference_protected(struct mt7996_sta *msta, u8 link_id)
lockdep_is_held(&msta->vif->dev->mt76.mutex));
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0094-wifi-mt76-mt7996-rework-TXS-for-multi-link-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0099-mtk-mt76-mt7996-rework-TXS-for-multi-link-support.patch
similarity index 64%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0094-wifi-mt76-mt7996-rework-TXS-for-multi-link-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0099-mtk-mt76-mt7996-rework-TXS-for-multi-link-support.patch
index 8e6acb1..6ee0a2b 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0094-wifi-mt76-mt7996-rework-TXS-for-multi-link-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0099-mtk-mt76-mt7996-rework-TXS-for-multi-link-support.patch
@@ -1,24 +1,34 @@
-From 13cf1c4b8027b2747c067d1bdd2f927f8c266b31 Mon Sep 17 00:00:00 2001
+From 907d640dec0609331c193539094c3620ae848543 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 4 Dec 2023 11:57:38 +0800
-Subject: [PATCH 094/116] wifi: mt76: mt7996: rework TXS for multi-link support
+Subject: [PATCH 099/199] mtk: mt76: mt7996: rework TXS for multi-link support
This is a preliminary patch to add MLO support for mt7996 chipsets.
+The wcidx and band idx in the TXS are sometimes mismatched
+since FW will select a link to TX based on its algorithm.
+That is, the wcidx in the TXS would be the one
+registered by the driver rather than the actual TXed wcidx.
+However, the band idx in the TXS is the actual TXed band.
+Therefore, we should get the driver-registered wcid in order
+to notify the driver that the packet has been acked; otherwise,
+the driver will be unable to match the TXed packet and its TXS.
+
Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mt7996/mac.c | 9 +++++----
+ mt7996/mac.c | 4 ++--
mt7996/main.c | 1 +
- mt7996/mt7996.h | 28 ++++++++++++++++++++++++++++
- 3 files changed, 34 insertions(+), 4 deletions(-)
+ mt7996/mt7996.h | 31 +++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 0fa3266..65431c7 100644
+index b0ad48dd..c910f353 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -1192,7 +1192,7 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+@@ -1195,7 +1195,7 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
struct ieee80211_sta *sta;
u8 tid;
@@ -27,28 +37,7 @@
tid = FIELD_GET(MT_TXS0_TID, txs);
ieee80211_refresh_tx_agg_session_timer(sta, tid);
}
-@@ -1310,9 +1310,10 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
- struct mt76_wcid *wcid;
- __le32 *txs_data = data;
- u16 wcidx;
-- u8 pid;
-+ u8 band, pid;
-
- wcidx = le32_get_bits(txs_data[2], MT_TXS2_WCID);
-+ band = le32_get_bits(txs_data[2], MT_TXS2_BAND);
- pid = le32_get_bits(txs_data[3], MT_TXS3_PID);
-
- if (pid < MT_PACKET_ID_NO_SKB)
-@@ -1323,7 +1324,7 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
-
- rcu_read_lock();
-
-- wcid = rcu_dereference(dev->mt76.wcid[wcidx]);
-+ wcid = mt7996_get_link_wcid(dev, wcidx, band);
- if (!wcid)
- goto out;
-
-@@ -1332,7 +1333,7 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
+@@ -1335,7 +1335,7 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
if (!wcid->sta)
goto out;
@@ -58,10 +47,10 @@
if (list_empty(&mlink->wcid.poll_list))
list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list);
diff --git a/mt7996/main.c b/mt7996/main.c
-index f5658d4..a94955c 100644
+index 6148c834..65e244da 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -2317,6 +2317,7 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2321,6 +2321,7 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mconf = mconf_dereference_protected(mvif, link_id);
mconf->chanctx = ctx;
ctx->nbss_assigned++;
@@ -70,10 +59,10 @@
if (mt7996_hw_phy(hw) == phy)
mvif->master_link_id = link_id;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 21a95c1..c6ca00f 100644
+index 72988c9e..b7e623cb 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -357,6 +357,8 @@ struct mt7996_vif {
+@@ -358,6 +358,8 @@ struct mt7996_vif {
u8 master_link_id;
u8 group_mld_id;
u8 mld_remap_id;
@@ -82,7 +71,7 @@
};
/* crash-dump */
-@@ -839,6 +841,32 @@ wcid_to_mlink(struct mt76_wcid *wcid)
+@@ -840,6 +842,35 @@ wcid_to_mlink(struct mt76_wcid *wcid)
return container_of(wcid, struct mt7996_link_sta, wcid);
}
@@ -96,6 +85,9 @@
+ if (!idx || idx >= ARRAY_SIZE(dev->mt76.wcid))
+ return NULL;
+
++ if (!mt7996_band_valid(dev, band_idx))
++ return NULL;
++
+ wcid = rcu_dereference(dev->mt76.wcid[idx]);
+ if (!wcid)
+ return NULL;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0095-wifi-mt76-mt7996-rework-RXD-for-multi-link-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0100-mtk-mt76-mt7996-rework-RXD-for-multi-link-support.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0095-wifi-mt76-mt7996-rework-RXD-for-multi-link-support.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0100-mtk-mt76-mt7996-rework-RXD-for-multi-link-support.patch
index 3d24613..2581dc2 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0095-wifi-mt76-mt7996-rework-RXD-for-multi-link-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0100-mtk-mt76-mt7996-rework-RXD-for-multi-link-support.patch
@@ -1,7 +1,7 @@
-From eeabbc93450223a64bfbb812c2dd938219e58bc2 Mon Sep 17 00:00:00 2001
+From ec6837fa5ce9c356989cd027ff518d013beaa665 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 4 Dec 2023 14:50:47 +0800
-Subject: [PATCH 095/116] wifi: mt76: mt7996: rework RXD for multi-link support
+Subject: [PATCH 100/199] mtk: mt76: mt7996: rework RXD for multi-link support
This is a preliminary patch to add MLO support for mt7996 chipsets.
@@ -13,7 +13,7 @@
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 65431c7..a32b416 100644
+index c910f353..8d6a153c 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -51,29 +51,6 @@ static const struct mt7996_dfs_radar_spec jp_radar_specs = {
@@ -46,7 +46,7 @@
bool mt7996_mac_wtbl_update(struct mt7996_dev *dev, int idx, u32 mask)
{
mt76_rmw(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_WLAN_IDX,
-@@ -376,10 +353,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+@@ -374,10 +351,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
unicast = FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) == MT_RXD3_NORMAL_U2M;
idx = FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0096-wifi-mt76-mt7996-rework-mac-functions-for-multi-link.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0101-mtk-mt76-mt7996-rework-mac-functions-for-multi-link-.patch
similarity index 90%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0096-wifi-mt76-mt7996-rework-mac-functions-for-multi-link.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0101-mtk-mt76-mt7996-rework-mac-functions-for-multi-link-.patch
index fcb59e6..1e50891 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0096-wifi-mt76-mt7996-rework-mac-functions-for-multi-link.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0101-mtk-mt76-mt7996-rework-mac-functions-for-multi-link-.patch
@@ -1,7 +1,7 @@
-From 0bd2c0dd6b87178561f38f27cd0be5009b56d43c Mon Sep 17 00:00:00 2001
+From c5aaee0305b927c4e3a5e39bca3d19d3325b2ee8 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 4 Dec 2023 18:31:02 +0800
-Subject: [PATCH 096/116] wifi: mt76: mt7996: rework mac functions for
+Subject: [PATCH 101/199] mtk: mt76: mt7996: rework mac functions for
multi-link support
This is a preliminary patch to add MLO support for mt7996 chipsets.
@@ -14,7 +14,7 @@
1 file changed, 65 insertions(+), 26 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index a32b416..31b9166 100644
+index 8d6a153c..6d0506fc 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -85,10 +85,11 @@ static int mt7996_reverse_frag0_hdr_trans(struct sk_buff *skb, u16 hdr_gap)
@@ -57,7 +57,7 @@
break;
case IEEE80211_FCTL_FROMDS:
ether_addr_copy(hdr.addr3, eth_hdr->h_source);
-@@ -955,15 +959,21 @@ u32 mt7996_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
+@@ -958,15 +962,21 @@ u32 mt7996_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
}
static void
@@ -81,7 +81,7 @@
return;
tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
-@@ -987,17 +997,17 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
+@@ -990,17 +1000,17 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
return;
msta = (struct mt7996_sta *)sta->drv_priv;
@@ -102,7 +102,7 @@
__le32 *txwi;
u16 wcid_idx;
-@@ -1007,11 +1017,10 @@ mt7996_txwi_free(struct mt7996_dev *dev, struct mt76_txwi_cache *t,
+@@ -1010,11 +1020,10 @@ mt7996_txwi_free(struct mt7996_dev *dev, struct mt76_txwi_cache *t,
txwi = (__le32 *)mt76_get_txwi_ptr(mdev, t);
if (sta) {
@@ -115,7 +115,7 @@
} else {
wcid_idx = le32_get_bits(txwi[9], MT_TXD9_WLAN_IDX);
}
-@@ -1066,7 +1075,9 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1069,7 +1078,9 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
*/
info = le32_to_cpu(*cur_info);
if (info & MT_TXFREE_INFO_PAIR) {
@@ -126,7 +126,7 @@
u16 idx;
idx = FIELD_GET(MT_TXFREE_INFO_WLAN_ID, info);
-@@ -1075,11 +1086,17 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1078,11 +1089,17 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
if (!sta)
continue;
@@ -148,7 +148,7 @@
spin_unlock_bh(&mdev->sta_poll_lock);
continue;
} else if (info & MT_TXFREE_INFO_HEADER) {
-@@ -1115,7 +1132,8 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+@@ -1118,7 +1135,8 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
if (!txwi)
continue;
@@ -158,7 +158,7 @@
}
}
-@@ -1537,19 +1555,29 @@ static void
+@@ -1533,19 +1551,29 @@ static void
mt7996_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
struct ieee80211_hw *hw = priv;
@@ -191,7 +191,7 @@
}
static void
-@@ -1585,7 +1613,7 @@ void mt7996_tx_token_put(struct mt7996_dev *dev)
+@@ -1581,7 +1609,7 @@ void mt7996_tx_token_put(struct mt7996_dev *dev)
spin_lock_bh(&dev->mt76.token_lock);
idr_for_each_entry(&dev->mt76.token, txwi, id) {
@@ -200,7 +200,7 @@
dev->mt76.token_count--;
}
spin_unlock_bh(&dev->mt76.token_lock);
-@@ -2266,21 +2294,31 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
+@@ -2265,21 +2293,31 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
u32 changed;
LIST_HEAD(list);
@@ -236,7 +236,7 @@
if (changed & (IEEE80211_RC_SUPP_RATES_CHANGED |
IEEE80211_RC_NSS_CHANGED |
-@@ -2295,6 +2333,7 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
+@@ -2294,6 +2332,7 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
}
spin_unlock_bh(&dev->mt76.sta_poll_lock);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0097-wifi-mt76-connac-rework-mcu-functions-for-multi-link.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0102-mtk-mt76-rework-mcu-functions-for-multi-link-support.patch
similarity index 70%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0097-wifi-mt76-connac-rework-mcu-functions-for-multi-link.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0102-mtk-mt76-rework-mcu-functions-for-multi-link-support.patch
index c4caeb7..d6cf909 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0097-wifi-mt76-connac-rework-mcu-functions-for-multi-link.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0102-mtk-mt76-rework-mcu-functions-for-multi-link-support.patch
@@ -1,38 +1,20 @@
-From c83a1297e94b7b05b1acb8245347ed6443f8b50e Mon Sep 17 00:00:00 2001
+From 06755ac0b2b1c2e38ce8fbb6da62f966ec7d219a Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 7 Dec 2023 15:39:03 +0800
-Subject: [PATCH 097/116] wifi: mt76: connac: rework mcu functions for
- multi-link support
+Subject: [PATCH 102/199] mtk: mt76: rework mcu functions for multi-link
+ support
This is a preliminary patch to add MLO support for mt7996 chipsets.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mt7615/mcu.c | 4 +--
- mt76_connac_mcu.c | 11 ++++----
+ mt76_connac_mcu.c | 10 +++----
mt76_connac_mcu.h | 2 +-
- mt7915/mcu.c | 3 +-
- mt7925/mcu.c | 3 +-
mt7996/mcu.c | 70 +++++++++++++++++++++++++++++++++--------------
- 6 files changed, 63 insertions(+), 30 deletions(-)
+ 3 files changed, 56 insertions(+), 26 deletions(-)
-diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index 8f4f203..e72dd65 100644
---- a/mt7615/mcu.c
-+++ b/mt7615/mcu.c
-@@ -862,8 +862,8 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
- else
- mvif->sta_added = true;
- }
-- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, &sta->deflink,
-- enable, new_entry);
-+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, &vif->bss_conf,
-+ &sta->deflink, enable, new_entry);
- if (enable && sta)
- mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0,
- MT76_STA_INFO_STATE_ASSOC);
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index d83d314..9ea7471 100644
+index 33cbf4c2..de4e0019 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -370,10 +370,11 @@ void mt76_connac_mcu_bss_omac_tlv(struct sk_buff *skb,
@@ -45,12 +27,12 @@
bool enable, bool newly)
{
+ struct ieee80211_vif *vif = conf->vif;
- struct ieee80211_sta *sta = link_sta ? link_sta->sta : NULL;
struct sta_rec_basic *basic;
struct tlv *tlv;
-@@ -394,10 +395,9 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
+ int conn_type;
+@@ -393,10 +394,9 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
- if (!sta) {
+ if (!link_sta) {
basic->conn_type = cpu_to_le32(CONNECTION_INFRA_BC);
-
if (vif->type == NL80211_IFTYPE_STATION &&
@@ -61,21 +43,20 @@
basic->aid = cpu_to_le16(vif->cfg.aid);
} else {
eth_broadcast_addr(basic->peer_addr);
-@@ -1056,7 +1056,8 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
- return PTR_ERR(skb);
+@@ -1059,7 +1059,7 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
+ link_sta = info->sta ? &info->sta->deflink : NULL;
if (info->sta || !info->offload_fw)
-- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, &info->sta->deflink,
+- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif,
+ mt76_connac_mcu_sta_basic_tlv(dev, skb, &info->vif->bss_conf,
-+ &info->sta->deflink,
- info->enable, info->newly);
+ link_sta, info->enable,
+ info->newly);
if (info->sta && info->enable)
- mt76_connac_mcu_sta_tlv(phy, skb, info->sta,
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 728ffb3..b93b5e0 100644
+index 1589a716..226e9a94 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1911,7 +1911,7 @@ mt76_connac_mcu_add_tlv(struct sk_buff *skb, int tag, int len)
+@@ -1923,7 +1923,7 @@ mt76_connac_mcu_add_tlv(struct sk_buff *skb, int tag, int len)
int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy);
int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif);
void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
@@ -84,36 +65,8 @@
struct ieee80211_link_sta *link_sta,
bool enable, bool newly);
void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index cb2e3b2..d2294e5 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -1669,7 +1669,8 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
- return PTR_ERR(skb);
-
- /* starec basic */
-- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, &sta->deflink, enable,
-+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, &vif->bss_conf,
-+ &sta->deflink, enable,
- !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx]));
- if (!enable)
- goto out;
-diff --git a/mt7925/mcu.c b/mt7925/mcu.c
-index 80e1828..a814b2a 100644
---- a/mt7925/mcu.c
-+++ b/mt7925/mcu.c
-@@ -1626,7 +1626,8 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
- return PTR_ERR(skb);
-
- if (info->sta || !info->offload_fw)
-- mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, &info->sta->deflink,
-+ mt76_connac_mcu_sta_basic_tlv(dev, skb, &info->vif->bss_conf,
-+ &info->sta->deflink,
- info->enable, info->newly);
- if (info->sta && info->enable) {
- mt7925_mcu_sta_phy_tlv(skb, info->vif, info->sta);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 16352d1..7f31dd9 100644
+index 7138230e..1f320a7b 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1169,10 +1169,12 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
@@ -210,12 +163,12 @@
return PTR_ERR(skb);
/* starec basic */
-- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, link_sta, enable, newly);
-+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, conf, link_sta, enable, newly);
+- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, link_sta,
++ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, conf, link_sta,
+ enable, newly);
if (!enable)
- goto out;
-@@ -2840,7 +2870,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+@@ -2841,7 +2871,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
struct mt7996_bss_conf *mconf, int en)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -224,7 +177,7 @@
struct ieee80211_mutable_offsets offs;
struct ieee80211_tx_info *info;
struct sk_buff *skb, *rskb;
-@@ -2856,7 +2886,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+@@ -2857,7 +2887,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
if (IS_ERR(rskb))
return PTR_ERR(rskb);
@@ -233,7 +186,7 @@
if (!skb) {
dev_kfree_skb(rskb);
return -EINVAL;
-@@ -2894,9 +2924,9 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
+@@ -2895,9 +2925,9 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
{
#define OFFLOAD_TX_MODE_SU BIT(0)
#define OFFLOAD_TX_MODE_MU BIT(1)
@@ -245,7 +198,7 @@
struct cfg80211_chan_def *chandef = &mconf->phy->mt76->chandef;
enum nl80211_band band = chandef->chan->band;
struct mt76_wcid *wcid = &dev->mt76.global_wcid;
-@@ -5154,7 +5184,7 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+@@ -5155,7 +5185,7 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
rssi[3] = to_rssi(MT_PRXV_RCPI0, rcpi[3]);
mlink = container_of(wcid, struct mt7996_link_sta, wcid);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0098-wifi-mt76-connac-rework-connac-helpers.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0103-mtk-mt76-rework-connac-helpers.patch
similarity index 88%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0098-wifi-mt76-connac-rework-connac-helpers.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0103-mtk-mt76-rework-connac-helpers.patch
index 02d240f..59c3a83 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0098-wifi-mt76-connac-rework-connac-helpers.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0103-mtk-mt76-rework-connac-helpers.patch
@@ -1,7 +1,7 @@
-From 056ff64bf4b942ff77e1b5931cdabd236f9d0f83 Mon Sep 17 00:00:00 2001
+From 7ee1d3297a47a4e1d14fef747bee991dadd6298b Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 11 Dec 2023 18:45:00 +0800
-Subject: [PATCH 098/116] wifi: mt76: connac: rework connac helpers
+Subject: [PATCH 103/199] mtk: mt76: rework connac helpers
Rework connac helpers related to rate and phymode.
This is a preliminary patch to add MLO support for mt7996 chipsets.
@@ -20,7 +20,7 @@
7 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
-index 445d0f0..f7766a9 100644
+index 445d0f0a..f7766a98 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -427,7 +427,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
@@ -33,7 +33,7 @@
bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
__le32 *txs_data);
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index b841bf6..c1e9ba0 100644
+index b841bf62..c1e9ba0f 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -291,12 +291,11 @@ EXPORT_SYMBOL_GPL(mt76_connac_init_tx_queues);
@@ -93,10 +93,10 @@
u32 val = MT_TXD6_FIXED_BW;
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 9ea7471..71f3d30 100644
+index de4e0019..ab7cf4a6 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
-@@ -1361,7 +1361,7 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
+@@ -1366,7 +1366,7 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
}
EXPORT_SYMBOL_GPL(mt76_connac_get_phy_mode);
@@ -105,7 +105,7 @@
enum nl80211_band band)
{
const struct ieee80211_sta_eht_cap *eht_cap;
-@@ -1372,9 +1372,9 @@ u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
+@@ -1377,9 +1377,9 @@ u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
mode |= PHY_MODE_AX_6G;
sband = phy->hw->wiphy->bands[band];
@@ -118,23 +118,23 @@
switch (band) {
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index b93b5e0..4d0fd4b 100644
+index 226e9a94..f6a0d328 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -2023,7 +2023,7 @@ mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
+@@ -2036,7 +2036,7 @@ mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
enum nl80211_band band,
- struct ieee80211_link_sta *link_sta);
+ struct ieee80211_link_sta *sta);
-u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
+u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_bss_conf *conf,
enum nl80211_band band);
int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
diff --git a/mt7925/main.c b/mt7925/main.c
-index 1f07ec5..6d7ec77 100644
+index 8c0768bf..c1b1cd8a 100644
--- a/mt7925/main.c
+++ b/mt7925/main.c
-@@ -675,7 +675,7 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -793,7 +793,7 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u16 rate;
u8 i, idx, ht;
@@ -144,10 +144,10 @@
if (beacon && ht) {
diff --git a/mt7996/main.c b/mt7996/main.c
-index a94955c..0245b6b 100644
+index 65e244da..1ea81d62 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -804,7 +804,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+@@ -808,7 +808,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
u16 rate;
u8 i, idx;
@@ -157,7 +157,7 @@
if (beacon) {
struct mt7996_phy *phy = mphy->priv;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 7f31dd9..f3d162a 100644
+index 1f320a7b..bf7231cd 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1219,7 +1219,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0099-wifi-mt76-mt7996-handle-mapping-for-hw-and-phy.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0104-mtk-mt76-mt7996-handle-mapping-for-hw-and-phy.patch
similarity index 83%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0099-wifi-mt76-mt7996-handle-mapping-for-hw-and-phy.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0104-mtk-mt76-mt7996-handle-mapping-for-hw-and-phy.patch
index e1391b5..4d17271 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0099-wifi-mt76-mt7996-handle-mapping-for-hw-and-phy.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0104-mtk-mt76-mt7996-handle-mapping-for-hw-and-phy.patch
@@ -1,7 +1,7 @@
-From b359a84d5cb94c2856285a0d82422a6b232f7f70 Mon Sep 17 00:00:00 2001
+From 55f4ab5ef60b32bb44395dc818b0dbc55fb7d81a Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 5 Dec 2023 13:56:51 +0800
-Subject: [PATCH 099/116] wifi: mt76: mt7996: handle mapping for hw and phy
+Subject: [PATCH 104/199] mtk: mt76: mt7996: handle mapping for hw and phy
We've used mt7996_band_phy() to do mapping from ieee80211_hw to mt7996_phy,
and this patch is a temporal workaround for opposite direction.
@@ -16,10 +16,10 @@
4 files changed, 55 insertions(+), 14 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index 4e96b39..de2c00d 100644
+index 49834afe..bf7ead01 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -824,9 +824,13 @@ EXPORT_SYMBOL_GPL(mt76_has_tx_pending);
+@@ -823,9 +823,13 @@ EXPORT_SYMBOL_GPL(mt76_has_tx_pending);
struct mt76_channel_state *
mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
{
@@ -33,7 +33,7 @@
if (c->band == NL80211_BAND_2GHZ)
msband = &phy->sband_2g;
else if (c->band == NL80211_BAND_6GHZ)
-@@ -835,6 +839,11 @@ mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
+@@ -834,6 +838,11 @@ mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
msband = &phy->sband_5g;
idx = c - &msband->sband.channels[0];
@@ -51,14 +51,14 @@
*sta = wcid_to_sta(mstat.wcid);
- *hw = mt76_phy_hw(dev, mstat.phy_idx);
+ *hw = mt76_main_hw(dev->phys[mstat.phy_idx]);
+ }
- if ((mstat.flag & RX_FLAG_8023) || ieee80211_is_data_qos(hdr->frame_control)) {
- struct mt76_phy *phy = mt76_dev_phy(dev, mstat.phy_idx);
+ static void
diff --git a/mt76.h b/mt76.h
-index c3ab96a..ebfd379 100644
+index 6a7752ef..f037284a 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -831,6 +831,7 @@ struct mt76_vif {
+@@ -829,6 +829,7 @@ struct mt76_vif {
struct mt76_phy {
struct ieee80211_hw *hw;
struct mt76_dev *dev;
@@ -66,7 +66,7 @@
void *priv;
unsigned long state;
-@@ -1322,6 +1323,15 @@ mt76_phy_hw(struct mt76_dev *dev, u8 phy_idx)
+@@ -1308,6 +1309,15 @@ mt76_phy_hw(struct mt76_dev *dev, u8 phy_idx)
return mt76_dev_phy(dev, phy_idx)->hw;
}
@@ -83,10 +83,10 @@
mt76_get_txwi_ptr(struct mt76_dev *dev, struct mt76_txwi_cache *t)
{
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 31b9166..cd25ea6 100644
+index 6d0506fc..c0c0df2f 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -2383,7 +2383,10 @@ void mt7996_mac_work(struct work_struct *work)
+@@ -2382,7 +2382,10 @@ void mt7996_mac_work(struct work_struct *work)
mt76_tx_status_check(mdev, false);
@@ -98,7 +98,7 @@
MT7996_WATCHDOG_TIME);
}
-@@ -2802,7 +2805,7 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid,
+@@ -2801,7 +2804,7 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid,
skb_set_queue_mapping(skb, IEEE80211_AC_VO);
rcu_read_lock();
@@ -108,7 +108,7 @@
NULL)) {
rcu_read_unlock();
diff --git a/mt7996/main.c b/mt7996/main.c
-index 0245b6b..34ff96d 100644
+index 1ea81d62..331dd4d4 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -173,6 +173,7 @@ static void mt7996_stop(struct ieee80211_hw *hw)
@@ -119,7 +119,7 @@
mutex_unlock(&dev->mt76.mutex);
}
}
-@@ -541,9 +542,10 @@ out:
+@@ -545,9 +546,10 @@ out:
clear_bit(MT76_RESET, &phy->mt76->state);
mutex_unlock(&dev->mt76.mutex);
@@ -132,7 +132,7 @@
&phy->mt76->mac_work,
MT7996_WATCHDOG_TIME);
-@@ -554,11 +556,11 @@ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef
+@@ -558,11 +560,11 @@ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef
{
int ret;
@@ -146,7 +146,7 @@
return 0;
}
-@@ -731,6 +733,7 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
+@@ -735,6 +737,7 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
MT_WF_RFCR1_DROP_CFEND |
MT_WF_RFCR1_DROP_CFACK;
u32 flags = 0;
@@ -154,7 +154,7 @@
#define MT76_FILTER(_flag, _hw) do { \
flags |= *total_flags & FIF_##_flag; \
-@@ -764,12 +767,26 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
+@@ -768,12 +771,26 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
MT_WF_RFCR_DROP_NDPA);
*total_flags = flags;
@@ -186,7 +186,7 @@
mutex_unlock(&dev->mt76.mutex);
}
-@@ -2186,7 +2203,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2190,7 +2207,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
phy->scan_chan_idx = 0;
mutex_unlock(&phy->dev->mt76.mutex);
@@ -195,7 +195,7 @@
return 0;
}
-@@ -2203,7 +2220,8 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+@@ -2207,7 +2224,8 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
continue;
phy = mt7996_band_phy(hw, band);
@@ -205,7 +205,7 @@
continue;
cancel_delayed_work_sync(&phy->scan_work);
-@@ -2224,6 +2242,7 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+@@ -2228,6 +2246,7 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
wiphy_info(hw->wiphy, "%s: add %u\n", __func__, conf->def.chan->hw_value);
mutex_lock(&phy->dev->mt76.mutex);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0100-wifi-mt76-mt7996-handle-mapping-for-hw-and-vif.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0105-mtk-mt76-mt7996-handle-mapping-for-hw-and-vif.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0100-wifi-mt76-mt7996-handle-mapping-for-hw-and-vif.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0105-mtk-mt76-mt7996-handle-mapping-for-hw-and-vif.patch
index 6fa4af2..8848e51 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0100-wifi-mt76-mt7996-handle-mapping-for-hw-and-vif.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0105-mtk-mt76-mt7996-handle-mapping-for-hw-and-vif.patch
@@ -1,7 +1,7 @@
-From 556174db2cbb957fdc977ecfcef3b20a3dcd670b Mon Sep 17 00:00:00 2001
+From 1172c92c354a6816dc112dae33ec473682f627a6 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 8 Dec 2023 18:08:13 +0800
-Subject: [PATCH 100/116] wifi: mt76: mt7996: handle mapping for hw and vif
+Subject: [PATCH 105/199] mtk: mt76: mt7996: handle mapping for hw and vif
We have several temporal workarounds for ieee80211_hw and mt76_phy
mappings. For legacy MBSS cases, we also need a method to do the
@@ -24,7 +24,7 @@
9 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/dma.c b/dma.c
-index 38701c7..3f1fb6c 100644
+index 38701c71..3f1fb6c2 100644
--- a/dma.c
+++ b/dma.c
@@ -685,7 +685,7 @@ free:
@@ -37,10 +37,10 @@
ieee80211_tx_status_ext(hw, &status);
spin_unlock_bh(&dev->rx_lock);
diff --git a/mac80211.c b/mac80211.c
-index de2c00d..1dec143 100644
+index bf7ead01..5f0c310f 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -1520,7 +1520,7 @@ void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid)
+@@ -1509,7 +1509,7 @@ void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid)
spin_unlock_bh(&phy->tx_lock);
while ((skb = __skb_dequeue(&list)) != NULL) {
@@ -50,10 +50,10 @@
}
}
diff --git a/mt76.h b/mt76.h
-index ebfd379..1d57e21 100644
+index f037284a..c51df8e5 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -556,6 +556,9 @@ struct mt76_driver_ops {
+@@ -554,6 +554,9 @@ struct mt76_driver_ops {
void (*sta_remove)(struct mt76_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
@@ -63,7 +63,7 @@
};
struct mt76_channel_state {
-@@ -1601,14 +1604,21 @@ static inline void mt76_testmode_reset(struct mt76_phy *phy, bool disable)
+@@ -1588,14 +1591,21 @@ static inline void mt76_testmode_reset(struct mt76_phy *phy, bool disable)
/* internal */
static inline struct ieee80211_hw *
@@ -88,10 +88,10 @@
}
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index cd25ea6..6ca3e06 100644
+index c0c0df2f..5417e741 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -2846,13 +2846,23 @@ static void mt7996_scan_check_sta(void *data, struct ieee80211_sta *sta)
+@@ -2845,13 +2845,23 @@ static void mt7996_scan_check_sta(void *data, struct ieee80211_sta *sta)
void mt7996_scan_work(struct work_struct *work)
{
struct mt7996_phy *phy = container_of(work, struct mt7996_phy, scan_work.work);
@@ -116,7 +116,7 @@
if (phy->scan_chan_idx >= req->n_channels) {
mt7996_scan_complete(phy, false);
mutex_unlock(&phy->dev->mt76.mutex);
-@@ -2912,3 +2922,15 @@ void mt7996_scan_work(struct work_struct *work)
+@@ -2911,3 +2921,15 @@ void mt7996_scan_work(struct work_struct *work)
ieee80211_queue_delayed_work(hw, &phy->scan_work, duration);
}
@@ -133,7 +133,7 @@
+ }
+}
diff --git a/mt7996/main.c b/mt7996/main.c
-index 34ff96d..ddfde58 100644
+index 331dd4d4..1251213e 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -444,6 +444,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
@@ -145,10 +145,10 @@
ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index f3d162a..2a09ed1 100644
+index bf7231cd..8a04035e 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -2947,11 +2947,11 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
+@@ -2948,11 +2948,11 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
if (changed & BSS_CHANGED_FILS_DISCOVERY) {
interval = conf->fils_discovery.max_interval;
@@ -163,7 +163,7 @@
if (!skb) {
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
-index 6abbcb6..6bebdd8 100644
+index b94155c4..58db5204 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -658,6 +658,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
@@ -175,10 +175,10 @@
struct mt7996_dev *dev;
struct mt76_dev *mdev;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index c6ca00f..dc0a31d 100644
+index b7e623cb..3b24643a 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -353,6 +353,7 @@ struct mt7996_vif {
+@@ -354,6 +354,7 @@ struct mt7996_vif {
struct mt7996_sta sta;
struct mt7996_dev *dev;
@@ -186,7 +186,7 @@
u8 master_link_id;
u8 group_mld_id;
-@@ -897,6 +898,8 @@ int mt7996_init_tx_queues(struct mt7996_phy *phy, int idx,
+@@ -901,6 +902,8 @@ int mt7996_init_tx_queues(struct mt7996_phy *phy, int idx,
void mt7996_init_txpower(struct mt7996_phy *phy);
int mt7996_txbf_init(struct mt7996_dev *dev);
int mt7996_get_chip_sku(struct mt7996_dev *dev);
@@ -196,7 +196,7 @@
void mt7996_coredump(struct mt7996_dev *dev, u8 state);
int mt7996_run(struct ieee80211_hw *hw);
diff --git a/tx.c b/tx.c
-index e279506..6580833 100644
+index e2795067..6580833e 100644
--- a/tx.c
+++ b/tx.c
@@ -76,7 +76,7 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0105-wifi-mt76-mt7996-implement-ieee80211_ops-for-link-de.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0105-wifi-mt76-mt7996-implement-ieee80211_ops-for-link-de.patch
deleted file mode 100644
index 708a27e..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0105-wifi-mt76-mt7996-implement-ieee80211_ops-for-link-de.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-From 79961bfcb2ebe3368d6d1ddf8b09cbf370c855a8 Mon Sep 17 00:00:00 2001
-From: Shayne Chen <shayne.chen@mediatek.com>
-Date: Fri, 29 Dec 2023 18:37:41 +0800
-Subject: [PATCH 105/116] wifi: mt76: mt7996: implement ieee80211_ops for link
- debugfs
-
-Add .link_sta_add_debugfs and .link_add_debugfs.
-
-Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
----
- mt7996/debugfs.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
- mt7996/mac.c | 4 +--
- mt7996/main.c | 2 ++
- mt7996/mcu.c | 6 +++--
- mt7996/mt7996.h | 5 ++++
- 5 files changed, 78 insertions(+), 4 deletions(-)
-
-diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 56e2192..26927ed 100644
---- a/mt7996/debugfs.c
-+++ b/mt7996/debugfs.c
-@@ -1307,4 +1307,69 @@ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- debugfs_create_file("hw-queues", 0400, dir, sta, &mt7996_queues_fops);
- }
-
-+static int
-+mt7996_link_sta_info_show(struct seq_file *file, void *data)
-+{
-+ struct ieee80211_link_sta *link_sta = file->private;
-+ struct mt7996_sta *msta = (struct mt7996_sta *)link_sta->sta->drv_priv;
-+ struct mt7996_link_sta *mlink;
-+ struct mt7996_dev *dev = msta->vif->dev;
-+ struct rate_info *r;
-+
-+ mutex_lock(&dev->mt76.mutex);
-+
-+ mlink = mlink_dereference_protected(msta, link_sta->link_id);
-+ r = &mlink->wcid.rate;
-+ seq_printf(file, "tx rate: flags=0x%x,legacy=%u,mcs=%u,nss=%u,bw=%u,he_gi=%u,he_dcm=%u,he_ru_alloc=%u,eht_gi=%u,eht_ru_alloc=%u\n",
-+ r->flags, r->legacy, r->mcs, r->nss, r->bw, r->he_gi, r->he_dcm, r->he_ru_alloc, r->eht_gi, r->eht_ru_alloc);
-+ seq_printf(file, "tx_bytes=%llu\n", mlink->wcid.stats.tx_bytes);
-+ seq_printf(file, "rx_bytes=%llu\n", mlink->wcid.stats.rx_bytes);
-+ seq_printf(file, "tx_airtime=%llu\n", mlink->wcid.stats.tx_airtime);
-+ seq_printf(file, "rx_airtime=%llu\n", mlink->wcid.stats.rx_airtime);
-+
-+ mutex_unlock(&dev->mt76.mutex);
-+
-+ return 0;
-+}
-+DEFINE_SHOW_ATTRIBUTE(mt7996_link_sta_info);
-+
-+void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ieee80211_link_sta *link_sta,
-+ struct dentry *dir)
-+{
-+ debugfs_create_file("link_sta_info", 0600, dir, link_sta,
-+ &mt7996_link_sta_info_fops);
-+}
-+
-+static int
-+mt7996_link_info_show(struct seq_file *file, void *data)
-+{
-+ struct ieee80211_bss_conf *conf = file->private;
-+ struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv;
-+ struct mt7996_sta *msta = &mvif->sta;
-+ struct mt7996_bss_conf *mconf;
-+ struct mt7996_link_sta *mlink;
-+ struct mt7996_dev *dev = mvif->dev;
-+ struct rate_info *r;
-+
-+ mutex_lock(&dev->mt76.mutex);
-+
-+ mconf = mconf_dereference_protected(mvif, conf->link_id);
-+ mlink = mlink_dereference_protected(msta, conf->link_id);
-+ r = &mlink->wcid.rate;
-+ seq_printf(file, "band mapping=%u\n", mconf->phy->mt76->band_idx);
-+ seq_printf(file, "tx rate: flags=0x%x,legacy=%u,mcs=%u,nss=%u,bw=%u,he_gi=%u,he_dcm=%u,he_ru_alloc=%u,eht_gi=%u,eht_ru_alloc=%u\n",
-+ r->flags, r->legacy, r->mcs, r->nss, r->bw, r->he_gi, r->he_dcm, r->he_ru_alloc, r->eht_gi, r->eht_ru_alloc);
-+
-+ mutex_unlock(&dev->mt76.mutex);
-+
-+ return 0;
-+}
-+DEFINE_SHOW_ATTRIBUTE(mt7996_link_info);
-+
-+void mt7996_link_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ieee80211_bss_conf *link_conf, struct dentry *dir)
-+{
-+ debugfs_create_file("link_info", 0600, dir, link_conf, &mt7996_link_info_fops);
-+}
- #endif
-diff --git a/mt7996/mac.c b/mt7996/mac.c
-index e6db176..5967b6a 100644
---- a/mt7996/mac.c
-+++ b/mt7996/mac.c
-@@ -2379,10 +2379,10 @@ void mt7996_mac_work(struct work_struct *work)
- mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_RATE);
- mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_AIRTIME);
- mt7996_mcu_get_rssi(mdev);
-- if (mtk_wed_device_active(&mdev->mmio.wed)) {
-+ // if (mtk_wed_device_active(&mdev->mmio.wed)) {
- mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
- mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
-- }
-+ // }
-
- if (mt7996_mcu_wa_cmd(phy->dev, MCU_WA_PARAM_CMD(QUERY), MCU_WA_PARAM_BSS_ACQ_PKT_CNT,
- BSS_ACQ_PKT_CNT_BSS_BITMAP_ALL | BSS_ACQ_PKT_CNT_READ_CLR, 0))
-diff --git a/mt7996/main.c b/mt7996/main.c
-index b0ac649..3e70d86 100644
---- a/mt7996/main.c
-+++ b/mt7996/main.c
-@@ -2602,6 +2602,8 @@ const struct ieee80211_ops mt7996_ops = {
- CFG80211_TESTMODE_DUMP(mt76_testmode_dump)
- #ifdef CONFIG_MAC80211_DEBUGFS
- .sta_add_debugfs = mt7996_sta_add_debugfs,
-+ .link_sta_add_debugfs = mt7996_link_sta_add_debugfs,
-+ // .link_add_debugfs = mt7996_link_add_debugfs,
- #endif
- .set_radar_background = mt7996_set_radar_background,
- #ifdef CONFIG_NET_MEDIATEK_SOC_WED
-diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 025a00c..1387a52 100644
---- a/mt7996/mcu.c
-+++ b/mt7996/mcu.c
-@@ -616,8 +616,10 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
- wcid->stats.tx_packets += tx_packets;
- wcid->stats.rx_packets += rx_packets;
-
-- __mt7996_stat_to_netdev(mphy, wcid, 0, 0,
-- tx_packets, rx_packets);
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
-+ __mt7996_stat_to_netdev(mphy, wcid, 0, 0,
-+ tx_packets, rx_packets);
-+ }
- break;
- case UNI_ALL_STA_TXRX_AIRTIME:
- wlan_idx = le16_to_cpu(res->airtime[i].wlan_idx);
-diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 0444ae5..dc3cacc 100644
---- a/mt7996/mt7996.h
-+++ b/mt7996/mt7996.h
-@@ -1138,6 +1138,11 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
- #ifdef CONFIG_MAC80211_DEBUGFS
- void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, struct dentry *dir);
-+void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ieee80211_link_sta *link_sta,
-+ struct dentry *dir);
-+void mt7996_link_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ieee80211_bss_conf *link_conf, struct dentry *dir);
- #endif
- int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
- bool hif2, int *irq);
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0101-wifi-mt76-mt7996-rework-scanning-parts-for-MLD-STA-s.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0106-mtk-mt76-mt7996-rework-scanning-parts-for-MLD-STA-su.patch
similarity index 70%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0101-wifi-mt76-mt7996-rework-scanning-parts-for-MLD-STA-s.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0106-mtk-mt76-mt7996-rework-scanning-parts-for-MLD-STA-su.patch
index c79b078..99899b8 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0101-wifi-mt76-mt7996-rework-scanning-parts-for-MLD-STA-s.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0106-mtk-mt76-mt7996-rework-scanning-parts-for-MLD-STA-su.patch
@@ -1,7 +1,7 @@
-From 1cad504914e594c629dd2b5a5b67ff58afd307e6 Mon Sep 17 00:00:00 2001
+From b05defbe38b85f93a74c115830c06d975c8cb67e Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 13 Dec 2023 16:58:31 +0800
-Subject: [PATCH 101/116] wifi: mt76: mt7996: rework scanning parts for MLD STA
+Subject: [PATCH 106/199] mtk: mt76: mt7996: rework scanning parts for MLD STA
support
During the first scanning, the STA VIF is still a legacy interface,
@@ -11,15 +11,15 @@
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mt7996/mac.c | 34 +++++++++++++++++++++++++---------
- mt7996/main.c | 17 +++++++++++++++++
- 2 files changed, 42 insertions(+), 9 deletions(-)
+ mt7996/mac.c | 44 +++++++++++++++++++++++---------------------
+ mt7996/main.c | 35 ++++++++++++++++++++++++++++++++++-
+ 2 files changed, 57 insertions(+), 22 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 6ca3e06..d6d1c07 100644
+index 5417e741..36d2e0b3 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -2770,23 +2770,40 @@ static void
+@@ -2769,23 +2769,40 @@ static void
mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid,
const u8 *dst)
{
@@ -50,11 +50,11 @@
+ if (mlink->wcid.phy_idx != phy->mt76->band_idx)
+ continue;
+ }
-
-- skb = ieee80211_probereq_get(hw, vif->addr,
++
+ if (unlikely(!conf))
+ goto unlock;
-+
+
+- skb = ieee80211_probereq_get(hw, vif->addr,
+ skb = ieee80211_probereq_get(hw, conf->addr,
ssid->ssid, ssid->ssid_len, req->ie_len);
if (!skb)
@@ -63,7 +63,7 @@
if (is_unicast_ether_addr(dst)) {
struct ieee80211_hdr_3addr *hdr =
-@@ -2804,30 +2821,29 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid,
+@@ -2803,36 +2820,21 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid,
skb_set_queue_mapping(skb, IEEE80211_AC_VO);
@@ -87,23 +87,47 @@
rcu_read_unlock();
}
- void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted)
- {
-+ struct mt7996_vif *mvif = (struct mt7996_vif *)phy->scan_vif->drv_priv;
- struct cfg80211_scan_info info = {
- .aborted = aborted,
- };
-
+-void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted)
+-{
+- struct cfg80211_scan_info info = {
+- .aborted = aborted,
+- };
+-
- ieee80211_scan_completed(phy->mt76->hw, &info);
-+ ieee80211_scan_completed(mvif->hw, &info);
- phy->scan_chan = NULL;
- phy->scan_req = NULL;
- phy->scan_vif = NULL;
+- phy->scan_chan = NULL;
+- phy->scan_req = NULL;
+- phy->scan_vif = NULL;
+- clear_bit(MT76_SCANNING, &phy->mt76->state);
+-}
+-
+ static void mt7996_scan_check_sta(void *data, struct ieee80211_sta *sta)
+ {
+ bool *has_sta = data;
diff --git a/mt7996/main.c b/mt7996/main.c
-index ddfde58..ef08563 100644
+index 1251213e..9c5e31b7 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -2191,6 +2191,8 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2189,12 +2189,28 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+
+ #endif
+
++void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)phy->scan_vif->drv_priv;
++ struct cfg80211_scan_info info = {
++ .aborted = aborted,
++ };
++
++ ieee80211_scan_completed(mvif->hw, &info);
++ phy->scan_chan = NULL;
++ phy->scan_req = NULL;
++ phy->scan_vif = NULL;
++ clear_bit(MT76_SCANNING, &phy->mt76->state);
++}
++
+ static int
+ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_scan_request *hw_req)
{
struct cfg80211_scan_request *req = &hw_req->req;
struct mt7996_phy *phy = mt7996_band_phy(hw, req->channels[0]->band);
@@ -112,10 +136,15 @@
mutex_lock(&phy->dev->mt76.mutex);
if (WARN_ON(phy->scan_req || phy->scan_chan)) {
-@@ -2202,6 +2204,17 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2202,10 +2218,23 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ return -EBUSY;
+ }
+
+- set_bit(MT76_SCANNING, &phy->mt76->state);
phy->scan_req = req;
phy->scan_vif = vif;
phy->scan_chan_idx = 0;
++
+ if (vif->type == NL80211_IFTYPE_STATION && !ieee80211_vif_is_mld(vif) &&
+ (phy->mt76 != mvif->deflink.phy->mt76)) {
+ phy->mt76->main_phy = hw->priv;
@@ -127,10 +156,12 @@
+ return ret;
+ }
+ }
++
++ set_bit(MT76_SCANNING, &phy->mt76->state);
mutex_unlock(&phy->dev->mt76.mutex);
ieee80211_queue_delayed_work(mt76_main_hw(phy->mt76), &phy->scan_work, 0);
-@@ -2212,6 +2225,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2216,6 +2245,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static void
mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
@@ -138,7 +169,7 @@
int band;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
-@@ -2229,6 +2243,9 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+@@ -2233,6 +2263,9 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_lock(&phy->dev->mt76.mutex);
mt7996_scan_complete(phy, true);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0102-wifi-mt76-mt7996-implement-mld-address-translation.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0107-mtk-mt76-mt7996-implement-mld-address-translation.patch
similarity index 90%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0102-wifi-mt76-mt7996-implement-mld-address-translation.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0107-mtk-mt76-mt7996-implement-mld-address-translation.patch
index d4e5cae..0062ff5 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0102-wifi-mt76-mt7996-implement-mld-address-translation.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0107-mtk-mt76-mt7996-implement-mld-address-translation.patch
@@ -1,16 +1,16 @@
-From fe38a0bccd1cf3ddb1736d79048b6ae9b17b94d0 Mon Sep 17 00:00:00 2001
+From b864635477ddfa6095f9268c94e4ab9410c51f43 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 7 Dec 2023 16:31:56 +0800
-Subject: [PATCH 102/116] wifi: mt76: mt7996: implement mld address translation
+Subject: [PATCH 107/199] mtk: mt76: mt7996: implement mld address translation
Do the MLD to link address translation for EAPOL and management frames
in driver.
This is a preliminary patch to add MLO support for mt7996 chipsets.
-Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
-Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7996/mac.c | 20 ++++++++++++++++++++
@@ -18,10 +18,10 @@
2 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index d6d1c07..3141fe4 100644
+index 36d2e0b3..a306ad71 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -895,6 +895,26 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -898,6 +898,26 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, key,
pid, qid, 0);
@@ -49,10 +49,10 @@
for (i = 0; i < nbuf; i++) {
u16 len;
diff --git a/mt7996/main.c b/mt7996/main.c
-index ef08563..61c4d2d 100644
+index 9c5e31b7..d897a361 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -1308,14 +1308,56 @@ static void mt7996_tx(struct ieee80211_hw *hw,
+@@ -1312,14 +1312,56 @@ static void mt7996_tx(struct ieee80211_hw *hw,
rcu_read_lock();
if (mvif && msta) {
@@ -112,7 +112,7 @@
mconf = rcu_dereference(mvif->link[link_id]);
mlink = rcu_dereference(msta->link[link_id]);
-@@ -1333,6 +1375,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,
+@@ -1337,6 +1379,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,
}
mt76_tx(mphy, control->sta, wcid, skb);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0103-wifi-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0108-mtk-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower-.patch
similarity index 82%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0103-wifi-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0108-mtk-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower-.patch
index ab0aacb..624ea79 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0103-wifi-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0108-mtk-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower-.patch
@@ -1,7 +1,7 @@
-From dd18695ef0e8a86e7ab7560ef2c07faf2ef381d7 Mon Sep 17 00:00:00 2001
+From f0996fb23e5b67edf0e25d31c90f938b7c9759c6 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 27 Feb 2024 18:07:11 +0800
-Subject: [PATCH 103/116] wifi: mt76: mt7996: use BSS_CHANGED_TXPOWER for
+Subject: [PATCH 108/199] mtk: mt76: mt7996: use BSS_CHANGED_TXPOWER for
txpower setting
This is a preliminary patch to add MLO support for mt7996 chipsets.
@@ -15,10 +15,10 @@
4 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 61c4d2d..2d0dc16 100644
+index d897a361..fd0df974 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -661,14 +661,6 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
+@@ -665,14 +665,6 @@ static int mt7996_config(struct ieee80211_hw *hw, u32 changed)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
@@ -33,7 +33,7 @@
mutex_lock(&dev->mt76.mutex);
-@@ -968,6 +960,9 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
+@@ -972,6 +964,9 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_MU_GROUPS)
mt7996_update_mu_group(hw, info, mconf);
@@ -43,7 +43,7 @@
out:
mutex_unlock(&dev->mt76.mutex);
}
-@@ -1607,7 +1602,6 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+@@ -1611,7 +1606,6 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
mt76_set_stream_caps(phy->mt76, true);
mt7996_set_stream_vht_txbf_caps(phy);
mt7996_set_stream_he_eht_caps(phy);
@@ -52,10 +52,10 @@
mutex_unlock(&dev->mt76.mutex);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 2a09ed1..025a00c 100644
+index 8a04035e..bf128637 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -5325,7 +5325,8 @@ mt7996_update_max_txpower_cur(struct mt7996_phy *phy, int tx_power)
+@@ -5310,7 +5310,8 @@ mt7996_update_max_txpower_cur(struct mt7996_phy *phy, int tx_power)
mphy->txpower_cur = e2p_power_limit;
}
@@ -65,7 +65,7 @@
{
#define TX_POWER_LIMIT_TABLE_RATE 0
#define TX_POWER_LIMIT_TABLE_PATH 1
-@@ -5354,7 +5355,7 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
+@@ -5339,7 +5340,7 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
if (hw->conf.power_level == INT_MIN)
hw->conf.power_level = 127;
@@ -75,10 +75,10 @@
if (phy->sku_limit_en) {
txpower_limit = mt76_get_rate_power_limits(mphy, mphy->chandef.chan,
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index dc0a31d..39aa3ee 100644
+index 3b24643a..fbb85177 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -976,7 +976,8 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch);
+@@ -980,7 +980,8 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch);
int mt7996_mcu_get_temperature(struct mt7996_phy *phy);
int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state);
int mt7996_mcu_set_thermal_protect(struct mt7996_phy *phy, bool enable);
@@ -89,7 +89,7 @@
u8 rx_sel, u8 val);
int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev,
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
-index ba17f94..0565ebc 100644
+index ba17f947..0565ebc9 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -1830,7 +1830,7 @@ mt7996_tm_update_params(struct mt7996_phy *phy, u32 changed)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0108-wifi-mt76-mt7996-add-beacon-monitoring-in-driver-for.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0108-wifi-mt76-mt7996-add-beacon-monitoring-in-driver-for.patch
deleted file mode 100644
index cf2d487..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0108-wifi-mt76-mt7996-add-beacon-monitoring-in-driver-for.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-From e7f7d5d9d5d110e7550ee2cf6fb1e6bcf6455976 Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Tue, 20 Feb 2024 10:08:01 +0800
-Subject: [PATCH 108/116] wifi: mt76: mt7996: add beacon monitoring in driver
- for mlo
-
-Add beacon monitoring in driver since mac80211 does not
-support connect monitoring if WIPHY_FLAG_SUPPORTS_MLO is set.
-(IEEE80211_HW_CONNECTION_MONITOR should be set)
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- mt7996/mac.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
- mt7996/main.c | 50 +++++++++++++++++++++++++++++++++++++++++++
- mt7996/mt7996.h | 7 +++++++
- 3 files changed, 113 insertions(+)
-
-diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 5967b6a..2a45fc0 100644
---- a/mt7996/mac.c
-+++ b/mt7996/mac.c
-@@ -565,6 +565,21 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
- */
- if (ieee80211_has_a4(fc) && is_mesh && status->amsdu)
- *qos &= ~IEEE80211_QOS_CTL_A_MSDU_PRESENT;
-+ } else if (ieee80211_is_beacon(fc)) {
-+ struct ieee80211_hw *hw = phy->mt76->hw;
-+ struct ieee80211_sta *sta;
-+ struct mt7996_sta *msta;
-+ unsigned int link_id;
-+
-+ sta = ieee80211_find_sta_by_link_addrs(hw, hdr->addr2, NULL, &link_id);
-+ if (!sta)
-+ sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, NULL);
-+
-+ if (sta) {
-+ msta = (struct mt7996_sta *)sta->drv_priv;
-+ if (msta && msta->vif)
-+ msta->vif->beacon_received_time[band_idx] = jiffies;
-+ }
- }
- #ifdef CONFIG_MTK_VENDOR
- if (phy->amnt_ctrl.enable && !ieee80211_is_beacon(fc))
-@@ -2956,6 +2971,47 @@ void mt7996_scan_work(struct work_struct *work)
- ieee80211_queue_delayed_work(hw, &phy->scan_work, duration);
- }
-
-+void mt7996_beacon_mon_work(struct work_struct *work)
-+{
-+ struct mt7996_vif *mvif = container_of(work, struct mt7996_vif, beacon_mon_work.work);
-+ struct ieee80211_vif *vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv);
-+ struct ieee80211_hw *hw = mvif->hw;
-+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
-+ unsigned long next_time = ULONG_MAX, valid_links = vif->valid_links ?: BIT(0);
-+ unsigned int link_id;
-+
-+ mutex_lock(&dev->mt76.mutex);
-+
-+ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
-+ struct ieee80211_bss_conf *conf;
-+ struct mt7996_bss_conf *mconf;
-+ struct mt7996_phy *phy;
-+ unsigned long timeout, loss_duration;
-+
-+ conf = link_conf_dereference_protected(vif, link_id);
-+ mconf = mconf_dereference_protected(mvif, link_id);
-+ if (!conf || !mconf)
-+ continue;
-+
-+ phy = mconf->phy;
-+ loss_duration = msecs_to_jiffies(MT7996_MAX_BEACON_LOSS * conf->beacon_int);
-+ timeout = mvif->beacon_received_time[phy->mt76->band_idx] + loss_duration;
-+ if (time_after_eq(jiffies, timeout)) {
-+ mutex_unlock(&dev->mt76.mutex);
-+ wiphy_info(hw->wiphy,
-+ "link %d: detected beacon loss, start disconnecting\n",
-+ link_id);
-+ /* TODO: disconnect single link & handle link reconfiguration for MLD */
-+ ieee80211_connection_loss(vif);
-+ return;
-+ }
-+ next_time = min(next_time, timeout - jiffies);
-+ }
-+ mutex_unlock(&dev->mt76.mutex);
-+
-+ ieee80211_queue_delayed_work(hw, &mvif->beacon_mon_work, next_time);
-+}
-+
- void mt7996_get_hw(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 phy_idx,
- struct ieee80211_hw **hw)
- {
-diff --git a/mt7996/main.c b/mt7996/main.c
-index 233bf2a..d1f2c25 100644
---- a/mt7996/main.c
-+++ b/mt7996/main.c
-@@ -450,6 +450,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
- is_zero_ether_addr(vif->addr))
- phy->monitor_vif = vif;
-
-+ INIT_DELAYED_WORK(&mvif->beacon_mon_work, mt7996_beacon_mon_work);
- mvif->dev = dev;
- mvif->hw = hw;
- mvif->sta.vif = mvif;
-@@ -2565,6 +2566,54 @@ out:
- return ret;
- }
-
-+static void
-+mt7996_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ const struct ieee80211_event *event)
-+{
-+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
-+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
-+
-+ mutex_lock(&dev->mt76.mutex);
-+
-+ switch (event->type) {
-+ case MLME_EVENT:
-+ if (event->u.mlme.data == ASSOC_EVENT &&
-+ event->u.mlme.status == MLME_SUCCESS) {
-+ struct ieee80211_bss_conf *conf;
-+ struct mt7996_bss_conf *mconf;
-+ struct mt7996_phy *phy;
-+ unsigned long cur, valid_links = vif->valid_links ?: BIT(0);
-+ unsigned int link_id;
-+ int next_time = INT_MAX;
-+
-+ cur = jiffies;
-+ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
-+ conf = link_conf_dereference_protected(vif, link_id);
-+ mconf = mconf_dereference_protected(mvif, link_id);
-+ if (conf && mconf) {
-+ phy = mconf->phy;
-+ mvif->beacon_received_time[phy->mt76->band_idx] = cur;
-+ next_time = min(next_time,
-+ MT7996_MAX_BEACON_LOSS *
-+ conf->beacon_int);
-+ }
-+ }
-+
-+ ieee80211_queue_delayed_work(hw, &mvif->beacon_mon_work,
-+ msecs_to_jiffies(next_time));
-+ break;
-+ }
-+
-+ cancel_delayed_work_sync(&mvif->beacon_mon_work);
-+ break;
-+ default:
-+ break;
-+ }
-+
-+ mutex_unlock(&dev->mt76.mutex);
-+ return;
-+}
-+
- const struct ieee80211_ops mt7996_ops = {
- .tx = mt7996_tx,
- .start = mt7996_start,
-@@ -2617,6 +2666,7 @@ const struct ieee80211_ops mt7996_ops = {
- .net_fill_forward_path = mt7996_net_fill_forward_path,
- .net_setup_tc = mt76_wed_net_setup_tc,
- #endif
-+ .event_callback = mt7996_event_callback,
- .add_chanctx = mt7996_add_chanctx,
- .remove_chanctx = mt7996_remove_chanctx,
- .change_chanctx = mt7996_change_chanctx,
-diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index dc3cacc..0412d73 100644
---- a/mt7996/mt7996.h
-+++ b/mt7996/mt7996.h
-@@ -128,6 +128,8 @@
-
- #define to_rssi(field, rcpi) ((FIELD_GET(field, rcpi) - 220) / 2)
-
-+#define MT7996_MAX_BEACON_LOSS 50
-+
- struct mt7996_vif;
- struct mt7996_sta;
- struct mt7996_dfs_pulse;
-@@ -360,6 +362,10 @@ struct mt7996_vif {
- u8 mld_remap_id;
-
- u8 band_to_link[__MT_MAX_BAND];
-+
-+ /* for beacon monitoring */
-+ struct delayed_work beacon_mon_work;
-+ unsigned long beacon_received_time[__MT_MAX_BAND];
- };
-
- /* crash-dump */
-@@ -1113,6 +1119,7 @@ bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len);
- void mt7996_stats_work(struct work_struct *work);
- void mt7996_scan_work(struct work_struct *work);
- void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted);
-+void mt7996_beacon_mon_work(struct work_struct *work);
- int mt76_dfs_start_rdd(struct mt7996_dev *dev, bool force);
- int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy);
- void mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy);
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0104-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0109-mtk-mt76-mt7996-temp-support-for-single-wiphy.patch
similarity index 78%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0104-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0109-mtk-mt76-mt7996-temp-support-for-single-wiphy.patch
index 9f92af3..1f5c5df 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0104-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0109-mtk-mt76-mt7996-temp-support-for-single-wiphy.patch
@@ -1,27 +1,27 @@
-From b8584db9dd73a4686872e75f5919184e4cb109d0 Mon Sep 17 00:00:00 2001
+From dd73bdd0c88aa8f1fcf133d903d257286911047c Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 28 Mar 2024 18:50:04 +0800
-Subject: [PATCH 104/116] wifi: mt76: mt7996: temp support for single wiphy
+Subject: [PATCH 109/199] mtk: mt76: mt7996: temp support for single wiphy
Add temporal single wiphy for simultaneously supporting MLD and legacy
interfaces.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- mac80211.c | 11 +------
- mt76.h | 11 +------
+ mac80211.c | 9 -----
+ mt76.h | 11 +-----
mt7996/eeprom.c | 6 ----
- mt7996/init.c | 23 ++++++++++---
+ mt7996/init.c | 25 +++++++++----
mt7996/mac.c | 5 +--
- mt7996/main.c | 88 ++++++++++++++++++++++++++++++-------------------
+ mt7996/main.c | 96 ++++++++++++++++++++++++++++++-------------------
mt7996/mt7996.h | 14 ++++----
- 7 files changed, 81 insertions(+), 77 deletions(-)
+ 7 files changed, 86 insertions(+), 80 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index 1dec143..8b9f3fd 100644
+index 5f0c310f..bc463437 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -824,13 +824,9 @@ EXPORT_SYMBOL_GPL(mt76_has_tx_pending);
+@@ -823,13 +823,9 @@ EXPORT_SYMBOL_GPL(mt76_has_tx_pending);
struct mt76_channel_state *
mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
{
@@ -35,7 +35,7 @@
if (c->band == NL80211_BAND_2GHZ)
msband = &phy->sband_2g;
else if (c->band == NL80211_BAND_6GHZ)
-@@ -839,11 +835,6 @@ begin:
+@@ -838,11 +834,6 @@ begin:
msband = &phy->sband_5g;
idx = c - &msband->sband.channels[0];
@@ -47,20 +47,11 @@
return &msband->chan[idx];
}
EXPORT_SYMBOL_GPL(mt76_channel_state);
-@@ -1082,7 +1073,7 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
- }
-
- *sta = wcid_to_sta(mstat.wcid);
-- *hw = mt76_main_hw(dev->phys[mstat.phy_idx]);
-+ *hw = mt76_phy_hw(dev, mstat.phy_idx);
-
- if ((mstat.flag & RX_FLAG_8023) || ieee80211_is_data_qos(hdr->frame_control)) {
- struct mt76_phy *phy = mt76_dev_phy(dev, mstat.phy_idx);
diff --git a/mt76.h b/mt76.h
-index 1d57e21..0452e5d 100644
+index c51df8e5..b1f22e6a 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -833,8 +833,8 @@ struct mt76_vif {
+@@ -831,8 +831,8 @@ struct mt76_vif {
struct mt76_phy {
struct ieee80211_hw *hw;
@@ -70,7 +61,7 @@
void *priv;
unsigned long state;
-@@ -1326,15 +1326,6 @@ mt76_phy_hw(struct mt76_dev *dev, u8 phy_idx)
+@@ -1312,15 +1312,6 @@ mt76_phy_hw(struct mt76_dev *dev, u8 phy_idx)
return mt76_dev_phy(dev, phy_idx)->hw;
}
@@ -87,10 +78,10 @@
mt76_get_txwi_ptr(struct mt76_dev *dev, struct mt76_txwi_cache *t)
{
diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
-index 0393e93..51455d8 100644
+index cd93a3c2..c4714982 100644
--- a/mt7996/eeprom.c
+++ b/mt7996/eeprom.c
-@@ -387,12 +387,6 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
+@@ -390,12 +390,6 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
break;
}
@@ -104,10 +95,10 @@
}
diff --git a/mt7996/init.c b/mt7996/init.c
-index c6eb6a5..f374119 100644
+index 2fe869c9..f75aa568 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -18,13 +18,13 @@ static const struct ieee80211_iface_limit if_limits[] = {
+@@ -19,13 +19,13 @@ static const struct ieee80211_iface_limit if_limits[] = {
.max = 1,
.types = BIT(NL80211_IFTYPE_ADHOC)
}, {
@@ -123,7 +114,7 @@
.types = BIT(NL80211_IFTYPE_STATION)
}
};
-@@ -33,7 +33,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
+@@ -34,7 +34,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
{
.limits = if_limits,
.n_limits = ARRAY_SIZE(if_limits),
@@ -131,7 +122,16 @@
+ .max_interfaces = MT7996_MAX_INTERFACES * 3,
.num_different_channels = 3,
.beacon_int_infra_match = true,
- /*
+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
+@@ -417,7 +417,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
+ wiphy->reg_notifier = mt7996_regd_notifier;
+ wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
+- wiphy->mbssid_max_interfaces = 16;
++ wiphy->mbssid_max_interfaces = 16 * 3;
+
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BSS_COLOR);
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
@@ -795,6 +795,10 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
mtk_wed_device_start(&dev->mt76.mmio.wed_hif2, MT_INT_TX_RX_DONE_EXT);
}
@@ -153,7 +153,7 @@
mt7996_unregister_thermal(phy);
mphy = phy->dev->mt76.phys[band];
-@@ -1679,6 +1686,12 @@ int mt7996_register_device(struct mt7996_dev *dev)
+@@ -1677,6 +1684,12 @@ int mt7996_register_device(struct mt7996_dev *dev)
if (ret)
return ret;
@@ -166,7 +166,7 @@
ieee80211_queue_work(mt76_hw(dev), &dev->init_work);
dev->recovery.hw_init_done = true;
-@@ -1708,11 +1721,11 @@ error:
+@@ -1706,11 +1719,11 @@ error:
void mt7996_unregister_device(struct mt7996_dev *dev)
{
cancel_work_sync(&dev->wed_rro.work);
@@ -181,10 +181,10 @@
mt7996_mcu_exit(dev);
mt7996_tx_token_put(dev);
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 3141fe4..e6db176 100644
+index a306ad71..24df5bb5 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
-@@ -2403,10 +2403,7 @@ void mt7996_mac_work(struct work_struct *work)
+@@ -2402,10 +2402,7 @@ void mt7996_mac_work(struct work_struct *work)
mt76_tx_status_check(mdev, false);
@@ -197,7 +197,7 @@
}
diff --git a/mt7996/main.c b/mt7996/main.c
-index 2d0dc16..b0ac649 100644
+index fd0df974..7424bebf 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -140,6 +140,10 @@ static int mt7996_start(struct ieee80211_hw *hw)
@@ -230,7 +230,29 @@
mutex_unlock(&dev->mt76.mutex);
}
}
-@@ -446,8 +453,11 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
+@@ -280,16 +287,18 @@ static void mt7996_remove_bss_conf(struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf)
+ {
+- struct mt7996_phy *phy = mconf->phy;
+- struct mt7996_dev *dev = phy->dev;
++ struct mt7996_phy *phy;
++ struct mt7996_dev *dev;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ u8 link_id = conf->link_id;
+ struct mt7996_link_sta *mlink =
+ mlink_dereference_protected(&mvif->sta, link_id);
+
+- if (!mlink)
++ if (!mlink || !mconf)
+ return;
+
++ phy = mconf->phy;
++ dev = phy->dev;
+ mt7996_mcu_add_sta(dev, conf, mconf, NULL, mlink, false, false);
+ mt7996_mcu_add_bss_info(phy, conf, mconf, mlink, false);
+ mt7996_mcu_add_dev_info(phy, conf, mconf, false);
+@@ -446,8 +455,11 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
mvif->dev = dev;
mvif->hw = hw;
mvif->sta.vif = mvif;
@@ -243,7 +265,7 @@
mutex_unlock(&dev->mt76.mutex);
return ret;
-@@ -543,10 +553,9 @@ out:
+@@ -547,10 +559,9 @@ out:
clear_bit(MT76_RESET, &phy->mt76->state);
mutex_unlock(&dev->mt76.mutex);
@@ -256,7 +278,7 @@
&phy->mt76->mac_work,
MT7996_WATCHDOG_TIME);
-@@ -557,11 +566,11 @@ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef
+@@ -561,11 +572,11 @@ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef
{
int ret;
@@ -270,7 +292,7 @@
return 0;
}
-@@ -769,9 +778,6 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
+@@ -773,9 +784,6 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
continue;
tmp = dev->mt76.phys[band]->priv;
@@ -280,7 +302,7 @@
tmp->rxfilter = phy->rxfilter;
mt76_wr(dev, MT_WF_RFCR(tmp->mt76->band_idx), phy->rxfilter);
-@@ -1576,9 +1582,11 @@ static int
+@@ -1580,9 +1588,11 @@ static int
mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
@@ -295,7 +317,7 @@
if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
return -EINVAL;
-@@ -1588,20 +1596,34 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+@@ -1592,20 +1602,34 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
mutex_lock(&dev->mt76.mutex);
@@ -303,9 +325,6 @@
+ for (band = 0; band < NUM_NL80211_BANDS; band++) {
+ struct mt7996_phy *phy;
+ u8 band_idx, shift;
-+
-+ if (!hw->wiphy->bands[band])
-+ continue;
- /* restore to the origin chainmask which might have auxiliary path */
- if (hweight8(tx_ant) == max_nss && band_idx < MT_BAND2)
@@ -315,13 +334,13 @@
- phy->mt76->chainmask = (dev->chainmask >> shift) << shift;
- else
- phy->mt76->chainmask = tx_ant << shift;
++ if (!hw->wiphy->bands[band])
++ continue;
++
+ phy = mt7996_band_phy(hw, band);
+ if (!phy)
+ continue;
-
-- mt76_set_stream_caps(phy->mt76, true);
-- mt7996_set_stream_vht_txbf_caps(phy);
-- mt7996_set_stream_he_eht_caps(phy);
++
+ phy->mt76->antenna_mask = tx_ant;
+ band_idx = phy->mt76->band_idx;
+ shift = dev->chainshift[band_idx];
@@ -334,7 +353,10 @@
+ phy->mt76->chainmask = (dev->chainmask >> shift) << shift;
+ else
+ phy->mt76->chainmask = tx_ant << shift;
-+
+
+- mt76_set_stream_caps(phy->mt76, true);
+- mt7996_set_stream_vht_txbf_caps(phy);
+- mt7996_set_stream_he_eht_caps(phy);
+ mt76_set_stream_caps(phy->mt76, true);
+ mt7996_set_stream_vht_txbf_caps(phy);
+ mt7996_set_stream_he_eht_caps(phy);
@@ -342,8 +364,8 @@
mutex_unlock(&dev->mt76.mutex);
-@@ -2243,7 +2265,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- phy->scan_chan_idx = 0;
+@@ -2261,7 +2285,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+
if (vif->type == NL80211_IFTYPE_STATION && !ieee80211_vif_is_mld(vif) &&
(phy->mt76 != mvif->deflink.phy->mt76)) {
- phy->mt76->main_phy = hw->priv;
@@ -351,8 +373,8 @@
mt7996_remove_bss_conf(vif, &vif->bss_conf, &mvif->deflink);
ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
-@@ -2254,7 +2276,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- }
+@@ -2274,7 +2298,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ set_bit(MT76_SCANNING, &phy->mt76->state);
mutex_unlock(&phy->dev->mt76.mutex);
- ieee80211_queue_delayed_work(mt76_main_hw(phy->mt76), &phy->scan_work, 0);
@@ -360,7 +382,7 @@
return 0;
}
-@@ -2262,7 +2284,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2282,7 +2306,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static void
mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
@@ -369,7 +391,7 @@
int band;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
-@@ -2272,17 +2294,16 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+@@ -2292,17 +2316,16 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
continue;
phy = mt7996_band_phy(hw, band);
@@ -391,7 +413,7 @@
mutex_unlock(&phy->dev->mt76.mutex);
}
}
-@@ -2297,7 +2318,6 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+@@ -2317,7 +2340,6 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
wiphy_info(hw->wiphy, "%s: add %u\n", __func__, conf->def.chan->hw_value);
mutex_lock(&phy->dev->mt76.mutex);
@@ -400,10 +422,10 @@
mutex_unlock(&phy->dev->mt76.mutex);
return -ENOSPC;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 39aa3ee..0444ae5 100644
+index fbb85177..9a47ad04 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -794,21 +794,19 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
+@@ -795,21 +795,19 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
static inline struct mt7996_phy *
mt7996_band_phy(struct ieee80211_hw *hw, enum nl80211_band band)
{
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0110-mtk-mt76-mt7996-implement-ieee80211_ops-for-link-deb.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0110-mtk-mt76-mt7996-implement-ieee80211_ops-for-link-deb.patch
new file mode 100644
index 0000000..718b6e8
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0110-mtk-mt76-mt7996-implement-ieee80211_ops-for-link-deb.patch
@@ -0,0 +1,295 @@
+From 4ac5eeaefbbc6353b211d703e83ebfdc98c9bc9b Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Fri, 29 Dec 2023 18:37:41 +0800
+Subject: [PATCH 110/199] mtk: mt76: mt7996: implement ieee80211_ops for link
+ debugfs
+
+Add .link_sta_add_debugfs and .link_add_debugfs for per-link STA and BSS
+info.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/debugfs.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mac.c | 4 +-
+ mt7996/main.c | 2 +
+ mt7996/mcu.c | 6 +-
+ mt7996/mt7996.h | 5 ++
+ 5 files changed, 214 insertions(+), 4 deletions(-)
+
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 62658dbc..fe8fea5d 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1294,4 +1294,205 @@ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ debugfs_create_file("hw-queues", 0400, dir, sta, &mt7996_queues_fops);
+ }
+
++static void
++mt7996_parse_rate(struct rate_info *rate, char *buf, size_t size)
++{
++ u32 bitrate = cfg80211_calculate_bitrate(rate);
++ bool legacy = false;
++ char *pos = buf;
++ enum {
++ GI_0_4,
++ GI_0_8,
++ GI_1_6,
++ GI_3_2
++ } gi = GI_0_8;
++
++ pos += snprintf(pos, size - (pos - buf), "%u.%u Mbit/s",
++ bitrate / 10, bitrate % 10);
++
++ if (rate->flags & RATE_INFO_FLAGS_MCS) {
++ pos += snprintf(pos, size - (pos - buf), " HT");
++
++ if (rate->flags & RATE_INFO_FLAGS_SHORT_GI)
++ gi = GI_0_4;
++ } else if (rate->flags & RATE_INFO_FLAGS_VHT_MCS) {
++ pos += snprintf(pos, size - (pos - buf), " VHT");
++
++ if (rate->flags & RATE_INFO_FLAGS_SHORT_GI)
++ gi = GI_0_4;
++ } else if (rate->flags & RATE_INFO_FLAGS_HE_MCS) {
++ pos += snprintf(pos, size - (pos - buf), " HE");
++
++ if (rate->he_gi == NL80211_RATE_INFO_HE_GI_1_6)
++ gi = GI_1_6;
++ else if (rate->he_gi == NL80211_RATE_INFO_HE_GI_3_2)
++ gi = GI_3_2;
++ } else if (rate->flags & RATE_INFO_FLAGS_EHT_MCS) {
++ pos += snprintf(pos, size - (pos - buf), " EHT");
++
++ if (rate->eht_gi == NL80211_RATE_INFO_EHT_GI_1_6)
++ gi = GI_1_6;
++ else if (rate->eht_gi == NL80211_RATE_INFO_EHT_GI_3_2)
++ gi = GI_3_2;
++ } else {
++ pos += snprintf(pos, size - (pos - buf), " Legacy");
++ legacy = true;
++ }
++
++ switch (rate->bw) {
++ case RATE_INFO_BW_20:
++ pos += snprintf(pos, size - (pos - buf), " 20MHz");
++ break;
++ case RATE_INFO_BW_40:
++ pos += snprintf(pos, size - (pos - buf), " 40MHz");
++ break;
++ case RATE_INFO_BW_80:
++ pos += snprintf(pos, size - (pos - buf), " 80MHz");
++ break;
++ case RATE_INFO_BW_160:
++ pos += snprintf(pos, size - (pos - buf), " 160MHz");
++ break;
++ case RATE_INFO_BW_320:
++ pos += snprintf(pos, size - (pos - buf), " 320MHz");
++ break;
++ case RATE_INFO_BW_HE_RU:
++ if (rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_106) {
++ pos += snprintf(pos, size - (pos - buf), " 106-tone RU");
++ break;
++ }
++ fallthrough;
++ default:
++ pos += snprintf(pos, size - (pos - buf), " (Unknown BW)");
++ }
++
++ if (!legacy) {
++ pos += snprintf(pos, size - (pos - buf), " MCS %hhu", rate->mcs);
++ pos += snprintf(pos, size - (pos - buf), " NSS %hhu", rate->nss);
++ }
++
++ switch (gi) {
++ case GI_0_4:
++ pos += snprintf(pos, size - (pos - buf), " GI 0.4us");
++ break;
++ case GI_0_8:
++ pos += snprintf(pos, size - (pos - buf), " GI 0.8us");
++ break;
++ case GI_1_6:
++ pos += snprintf(pos, size - (pos - buf), " GI 1.6us");
++ break;
++ default:
++ pos += snprintf(pos, size - (pos - buf), " GI 3.2us");
++ break;
++ }
++}
++
++static int
++mt7996_link_sta_info_show(struct seq_file *file, void *data)
++{
++ struct ieee80211_link_sta *link_sta = file->private;
++ struct mt7996_sta *msta = (struct mt7996_sta *)link_sta->sta->drv_priv;
++ struct mt7996_link_sta *mlink;
++ struct mt76_sta_stats *stats;
++ struct mt76_wcid *wcid;
++ char buf[100];
++
++ mutex_lock(&msta->vif->dev->mt76.mutex);
++
++ mlink = mlink_dereference_protected(msta, link_sta->link_id);
++ if (!mlink) {
++ mutex_unlock(&msta->vif->dev->mt76.mutex);
++ return -EINVAL;
++ }
++ wcid = &mlink->wcid;
++ stats = &wcid->stats;
++
++ seq_printf(file, "WCID: %hu\n", wcid->idx);
++ seq_printf(file, "Link ID: %hhu\n", link_sta->link_id);
++ seq_printf(file, "Link Address: %pM\n", link_sta->addr);
++ seq_printf(file, "Status:\n");
++ seq_printf(file, "\tRSSI: %d [%hhd, %hhd, %hhd, %hhd] dBm\n",
++ mlink->signal, mlink->chain_signal[0], mlink->chain_signal[1],
++ mlink->chain_signal[2], mlink->chain_signal[3]);
++ seq_printf(file, "\tACK RSSI: %d [%hhd, %hhd, %hhd, %hhd] dBm\n",
++ mlink->ack_signal, mlink->chain_ack_signal[0],
++ mlink->chain_ack_signal[1], mlink->chain_ack_signal[2],
++ mlink->chain_ack_signal[3]);
++ seq_printf(file, "\tACK SNR: [%hhd, %hhd, %hhd, %hhd] dBm\n",
++ mlink->chain_ack_snr[0], mlink->chain_ack_snr[1],
++ mlink->chain_ack_snr[2], mlink->chain_ack_snr[3]);
++ seq_printf(file, "Rate:\n");
++
++ mt7996_parse_rate(&wcid->rate, buf, sizeof(buf));
++ seq_printf(file, "\tTX: %s\n", buf);
++ mt7996_parse_rate(&wcid->rx_rate, buf, sizeof(buf));
++ seq_printf(file, "\tRX: %s\n", buf);
++
++ seq_printf(file, "Statistics:\n");
++ seq_printf(file, "\tTX:\n");
++ seq_printf(file, "\t\tBytes: %llu\n", stats->tx_bytes);
++ seq_printf(file, "\t\tMSDU Count: %u\n", stats->tx_packets);
++ seq_printf(file, "\t\tMPDU Count: %u\n", stats->tx_mpdus);
++ seq_printf(file, "\t\tMPDU Fails: %u (PER: %u.%u%%)\n", stats->tx_failed,
++ stats->tx_mpdus ? stats->tx_failed * 1000 / stats->tx_mpdus / 10 : 0,
++ stats->tx_mpdus ? stats->tx_failed * 1000 / stats->tx_mpdus % 10 : 0);
++ seq_printf(file, "\t\tMPDU Retries: %u\n", stats->tx_retries);
++ seq_printf(file, "\t\tAirtime: %llu (unit: 1.024 us)\n", stats->tx_airtime);
++ seq_printf(file, "\tRX:\n");
++ seq_printf(file, "\t\tBytes: %llu\n", stats->rx_bytes);
++ seq_printf(file, "\t\tMPDU Count: %u\n", stats->rx_mpdus);
++ seq_printf(file, "\t\tMPDU FCS Errors: %u (PER: %u.%u%%)\n", stats->rx_fcs_err,
++ stats->rx_mpdus ? stats->rx_fcs_err * 1000 / stats->rx_mpdus / 10 : 0,
++ stats->rx_mpdus ? stats->rx_fcs_err * 1000 / stats->rx_mpdus % 10 : 0);
++ seq_printf(file, "\t\tAirtime: %llu (unit: 1.024 us)\n", stats->rx_airtime);
++
++ mutex_unlock(&msta->vif->dev->mt76.mutex);
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_link_sta_info);
++
++void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_link_sta *link_sta,
++ struct dentry *dir)
++{
++ debugfs_create_file("link_sta_info", 0400, dir, link_sta,
++ &mt7996_link_sta_info_fops);
++}
++
++static int
++mt7996_link_info_show(struct seq_file *file, void *data)
++{
++ struct ieee80211_bss_conf *conf = file->private;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv;
++ struct mt7996_sta *msta = &mvif->sta;
++ struct mt7996_bss_conf *mconf;
++ struct mt7996_link_sta *mlink;
++ struct mt7996_dev *dev = mvif->dev;
++ struct rate_info *r;
++
++ mutex_lock(&dev->mt76.mutex);
++
++ mconf = mconf_dereference_protected(mvif, conf->link_id);
++ mlink = mlink_dereference_protected(msta, conf->link_id);
++ if (!mconf || !mlink) {
++ mutex_unlock(&dev->mt76.mutex);
++ return -EINVAL;
++ }
++
++ r = &mlink->wcid.rate;
++ seq_printf(file, "band mapping=%u\n", mconf->phy->mt76->band_idx);
++ seq_printf(file, "tx rate: flags=0x%x,legacy=%u,mcs=%u,nss=%u,bw=%u,he_gi=%u,he_dcm=%u,he_ru_alloc=%u,eht_gi=%u,eht_ru_alloc=%u\n",
++ r->flags, r->legacy, r->mcs, r->nss, r->bw, r->he_gi, r->he_dcm, r->he_ru_alloc, r->eht_gi, r->eht_ru_alloc);
++
++ mutex_unlock(&dev->mt76.mutex);
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_link_info);
++
++void mt7996_link_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_bss_conf *link_conf, struct dentry *dir)
++{
++ debugfs_create_file("link_info", 0600, dir, link_conf, &mt7996_link_info_fops);
++}
+ #endif
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 24df5bb5..3b3aa01b 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2378,10 +2378,10 @@ void mt7996_mac_work(struct work_struct *work)
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_RATE);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_AIRTIME);
+ mt7996_mcu_get_rssi(mdev);
+- if (mtk_wed_device_active(&mdev->mmio.wed)) {
++ // if (mtk_wed_device_active(&mdev->mmio.wed)) {
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
+- }
++ // }
+
+ if (mt7996_mcu_wa_cmd(phy->dev, MCU_WA_PARAM_CMD(QUERY), MCU_WA_PARAM_BSS_ACQ_PKT_CNT,
+ BSS_ACQ_PKT_CNT_BSS_BITMAP_ALL | BSS_ACQ_PKT_CNT_READ_CLR, 0))
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 7424bebf..17f4901f 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2625,6 +2625,8 @@ const struct ieee80211_ops mt7996_ops = {
+ CFG80211_TESTMODE_DUMP(mt76_testmode_dump)
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ .sta_add_debugfs = mt7996_sta_add_debugfs,
++ .link_sta_add_debugfs = mt7996_link_sta_add_debugfs,
++ // .link_add_debugfs = mt7996_link_add_debugfs,
+ #endif
+ .set_radar_background = mt7996_set_radar_background,
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index bf128637..2884af9d 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -616,8 +616,10 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ wcid->stats.tx_packets += tx_packets;
+ wcid->stats.rx_packets += rx_packets;
+
+- __mt7996_stat_to_netdev(mphy, wcid, 0, 0,
+- tx_packets, rx_packets);
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ __mt7996_stat_to_netdev(mphy, wcid, 0, 0,
++ tx_packets, rx_packets);
++ }
+ break;
+ case UNI_ALL_STA_TXRX_AIRTIME:
+ wlan_idx = le16_to_cpu(res->airtime[i].wlan_idx);
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 9a47ad04..294c46f6 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1142,6 +1142,11 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, struct dentry *dir);
++void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_link_sta *link_sta,
++ struct dentry *dir);
++void mt7996_link_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_bss_conf *link_conf, struct dentry *dir);
+ #endif
+ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
+ bool hif2, int *irq);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0106-mtk-wifi-mt76-mt7996-support-multi-link-channel-swit.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0111-mtk-mt76-mt7996-support-multi-link-channel-switch.patch
similarity index 73%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0106-mtk-wifi-mt76-mt7996-support-multi-link-channel-swit.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0111-mtk-mt76-mt7996-support-multi-link-channel-switch.patch
index c57d3c8..3f696d9 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0106-mtk-wifi-mt76-mt7996-support-multi-link-channel-swit.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0111-mtk-mt76-mt7996-support-multi-link-channel-switch.patch
@@ -1,17 +1,12 @@
-From 4969672ddd07d512af13af7622a8c941ddc21d53 Mon Sep 17 00:00:00 2001
+From 56f1336c11dd0627e8e79951c16713cc35463733 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 19 Jan 2024 14:04:03 +0800
-Subject: [PATCH 106/116] mtk: wifi: mt76: mt7996: support multi-link channel
- switch
+Subject: [PATCH 111/199] mtk: mt76: mt7996: support multi-link channel switch
mtk: wifi: mt76: mt7996: remove the limitation of radar detect width for mlo
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: mt7996: start and finalize channel switch on link basis
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: mt7996: fix DFS RDD init issue
1. Add radar enabled flag in mt76_phy since hw->conf.radar_enabled
@@ -19,8 +14,6 @@
2. Add IEEE80211_CHANCTX_CHANGE_RADAR flag in change_chanctx for RDD
DFS state update.
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-
mtk: wifi: mt76: mt7996: fix background radar using wrong phy for mld ap
mt7996_hw_phy will be phy0 for 3 link mld ap
@@ -29,16 +22,15 @@
---
mac80211.c | 2 +-
mt76.h | 1 +
- mt7996/init.c | 2 --
mt7996/main.c | 12 +++++++++---
mt7996/mcu.c | 14 +++++++++++---
- 5 files changed, 22 insertions(+), 9 deletions(-)
+ 4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index 8b9f3fd..c2b82fb 100644
+index bc463437..5e4935f2 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -1798,7 +1798,7 @@ enum mt76_dfs_state mt76_phy_dfs_state(struct mt76_phy *phy)
+@@ -1787,7 +1787,7 @@ enum mt76_dfs_state mt76_phy_dfs_state(struct mt76_phy *phy)
test_bit(MT76_SCANNING, &phy->state))
return MT_DFS_STATE_DISABLED;
@@ -48,10 +40,10 @@
(phy->chandef.chan->flags & IEEE80211_CHAN_RADAR))
return MT_DFS_STATE_ACTIVE;
diff --git a/mt76.h b/mt76.h
-index 0452e5d..d88d552 100644
+index b1f22e6a..c6dda4a8 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -849,6 +849,7 @@ struct mt76_phy {
+@@ -847,6 +847,7 @@ struct mt76_phy {
struct mt76_channel_state *chan_state;
enum mt76_dfs_state dfs_state;
@@ -59,29 +51,11 @@
ktime_t survey_time;
u32 aggr_stats[32];
-diff --git a/mt7996/init.c b/mt7996/init.c
-index f374119..0dee659 100644
---- a/mt7996/init.c
-+++ b/mt7996/init.c
-@@ -36,13 +36,11 @@ static const struct ieee80211_iface_combination if_comb[] = {
- .max_interfaces = MT7996_MAX_INTERFACES * 3,
- .num_different_channels = 3,
- .beacon_int_infra_match = true,
-- /*
- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
- BIT(NL80211_CHAN_WIDTH_20) |
- BIT(NL80211_CHAN_WIDTH_40) |
- BIT(NL80211_CHAN_WIDTH_80) |
- BIT(NL80211_CHAN_WIDTH_160),
-- */
- }
- };
-
diff --git a/mt7996/main.c b/mt7996/main.c
-index 3e70d86..8e44da7 100644
+index 17f4901f..7012aa96 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -2133,7 +2133,7 @@ static int
+@@ -2139,7 +2139,7 @@ static int
mt7996_set_radar_background(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef)
{
@@ -90,7 +64,7 @@
struct mt7996_dev *dev = phy->dev;
int ret = -EINVAL;
bool running;
-@@ -2332,6 +2332,7 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+@@ -2354,6 +2354,7 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
}
phy->chanctx = ctx;
@@ -98,7 +72,7 @@
mutex_unlock(&phy->dev->mt76.mutex);
if (!mt76_testmode_enabled(phy->mt76) && !phy->mt76->test.bf_en) {
-@@ -2359,8 +2360,10 @@ mt7996_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+@@ -2381,8 +2382,10 @@ mt7996_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
mutex_lock(&phy->dev->mt76.mutex);
ctx->assigned = false;
@@ -110,7 +84,7 @@
mutex_unlock(&phy->dev->mt76.mutex);
}
-@@ -2372,8 +2375,10 @@ mt7996_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+@@ -2394,8 +2397,10 @@ mt7996_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
struct mt7996_phy *phy = ctx->phy;
wiphy_info(hw->wiphy, "%s: change %u, 0x%x\n", __func__, conf->def.chan->hw_value, changed);
@@ -122,7 +96,7 @@
mt7996_set_channel(phy, &ctx->chandef);
}
-@@ -2471,6 +2476,7 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+@@ -2493,6 +2498,7 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
mutex_lock(&phy->dev->mt76.mutex);
phy->chanctx = new_ctx;
@@ -131,7 +105,7 @@
new_ctx->chandef = vifs->new_ctx->def;
new_ctx->phy = phy;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 1387a52..e18a553 100644
+index 2884af9d..7b0d631e 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -357,10 +357,18 @@ int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0107-mtk-mt76-mt7996-hw_scan-ACS-channel-time-too-long-on.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0112-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch
similarity index 76%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0107-mtk-mt76-mt7996-hw_scan-ACS-channel-time-too-long-on.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0112-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch
index 54f4647..a9b41f9 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0107-mtk-mt76-mt7996-hw_scan-ACS-channel-time-too-long-on.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0112-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch
@@ -1,8 +1,8 @@
-From 919a124e164b3c1ba5fe4fde2ad48e0ef3961d17 Mon Sep 17 00:00:00 2001
+From 43de0e905d116dc16cf7cacadeddcc352695913d Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Thu, 22 Feb 2024 11:09:10 +0800
-Subject: [PATCH 107/116] mtk: mt76: mt7996: hw_scan: ACS channel time too long
- on duty channel
+Subject: [PATCH 112/199] mtk: mt76: mt7996: ACS channel time too long on duty
+ channel
This problem happens in SW scan and was already fixed.
(https://gerrit.mediatek.inc/c/gateway/WiFi7/mac80211/mt76/+/8312969)
@@ -15,10 +15,10 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index 8e44da7..233bf2a 100644
+index 7012aa96..c4eba315 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -497,6 +497,7 @@ static void ___mt7996_set_channel(struct mt7996_phy *phy,
+@@ -499,6 +499,7 @@ static void ___mt7996_set_channel(struct mt7996_phy *phy,
struct mt76_phy *mphy = phy->mt76;
bool offchannel = phy->scan_chan != NULL;
int timeout = HZ / 5;
@@ -26,7 +26,7 @@
wait_event_timeout(mdev->tx_wait, !mt76_has_tx_pending(mphy), timeout);
mt76_update_survey(mphy);
-@@ -511,7 +512,7 @@ static void ___mt7996_set_channel(struct mt7996_phy *phy,
+@@ -513,7 +514,7 @@ static void ___mt7996_set_channel(struct mt7996_phy *phy,
if (!offchannel)
mphy->main_chan = chandef->chan;
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0113-mtk-mt76-mt7996-add-beacon-monitoring-in-driver-for-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0113-mtk-mt76-mt7996-add-beacon-monitoring-in-driver-for-.patch
new file mode 100644
index 0000000..3989bb4
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0113-mtk-mt76-mt7996-add-beacon-monitoring-in-driver-for-.patch
@@ -0,0 +1,433 @@
+From c3e35c17c5b42dd2332864d6bed15398f47d76eb Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Tue, 20 Feb 2024 10:08:01 +0800
+Subject: [PATCH 113/199] mtk: mt76: mt7996: add beacon monitoring in driver
+ for mlo
+
+Add beacon monitoring in driver since mac80211 does not
+support connect monitoring if WIPHY_FLAG_SUPPORTS_MLO is set.
+(IEEE80211_HW_CONNECTION_MONITOR should be set)
+
+Add probing mechanism (send nullfunc) when beacon loss is detected.
+Note that probe request is not implemented yet.
+Fix beacon monitor deadlock issue between the mutex lock of
+mt7996_event_callback & mt7996_beacon_mon_work
+
+fix call trace during STA wifi down/up
+remove chanctx will be called before canceling beacon mon work
+Therefore, check phy->chanctx exist or not
+
+1. Refactor beacon monitor to mld level.
+2. Trigger disconnection only when all valid links are lost.
+3. Add temporary resume link monitor mechanism by simply receiving beacon
+from the lost link.
+4. Change from cancel_delayed_work_sync to cancel_delayed_work.
+The beacon work will canceled only when sta is disconnected or disabled,
+so it is unnecessary to finish the work.
+5. Add address sanity check before sending nullfunc.
+6. Add cancel_delayed_work in more place.
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7996/mac.c | 217 +++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/main.c | 61 ++++++++++++++
+ mt7996/mt7996.h | 13 +++
+ 3 files changed, 290 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 3b3aa01b..803f7ce3 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -559,6 +559,32 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ */
+ if (ieee80211_has_a4(fc) && is_mesh && status->amsdu)
+ *qos &= ~IEEE80211_QOS_CTL_A_MSDU_PRESENT;
++ } else if (ieee80211_is_beacon(fc)) {
++ struct ieee80211_hw *hw = phy->mt76->hw;
++ struct ieee80211_sta *sta;
++ struct mt7996_sta *msta;
++ unsigned int link_id = 0;
++
++ sta = ieee80211_find_sta_by_link_addrs(hw, hdr->addr2, NULL, &link_id);
++ if (!sta)
++ sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, NULL);
++
++ if (sta) {
++ msta = (struct mt7996_sta *)sta->drv_priv;
++ if (msta && msta->vif) {
++ msta->vif->beacon_received_time[band_idx] = jiffies;
++ /* FIXME: This is a temporary workaround.
++ * Lost links should be resumed via TTLM or
++ * link reconfig.
++ */
++ if (msta->vif->lost_links & BIT(link_id)) {
++ msta->vif->lost_links &= ~BIT(link_id);
++ wiphy_info(hw->wiphy,
++ "link %d: resume beacon monitoring\n",
++ link_id);
++ }
++ }
++ }
+ }
+ #ifdef CONFIG_MTK_VENDOR
+ if (phy->amnt_ctrl.enable && !ieee80211_is_beacon(fc))
+@@ -709,7 +735,8 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ }
+
+ if (ieee80211_vif_is_mld(info->control.vif) &&
+- (multicast || unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE))))
++ (multicast || unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)) ||
++ info->flags & IEEE80211_TX_CTL_INJECTED))
+ txwi[5] |= cpu_to_le32(MT_TXD5_FL);
+ }
+
+@@ -1194,6 +1221,10 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+ if (le32_get_bits(txs_data[0], MT_TXS0_TXS_FORMAT) == 0) {
+ skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
+ if (skb) {
++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
++ struct mt7996_link_sta *mlink = wcid_to_mlink(wcid);
++ struct mt7996_vif *mvif;
++
+ info = IEEE80211_SKB_CB(skb);
+ if (!(txs & MT_TXS0_ACK_ERROR_MASK))
+ info->flags |= IEEE80211_TX_STAT_ACK;
+@@ -1203,6 +1234,18 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+ !!(info->flags & IEEE80211_TX_STAT_ACK);
+
+ info->status.rates[0].idx = -1;
++
++ /* connection monitoring */
++ if (mlink && mlink->sta)
++ mvif = mlink->sta->vif;
++ if (ieee80211_is_nullfunc(hdr->frame_control) && mvif &&
++ mvif->probe[wcid->phy_idx] == (void *)skb &&
++ info->flags & IEEE80211_TX_STAT_ACK) {
++ /* reset beacon monitoring */
++ mvif->probe[wcid->phy_idx] = NULL;
++ mvif->beacon_received_time[wcid->phy_idx] = jiffies;
++ mvif->probe_send_count[wcid->phy_idx] = 0;
++ }
+ }
+ }
+
+@@ -2941,6 +2984,178 @@ void mt7996_scan_work(struct work_struct *work)
+ ieee80211_queue_delayed_work(hw, &phy->scan_work, duration);
+ }
+
++static int
++mt7996_beacon_mon_send_probe(struct mt7996_phy *phy, struct mt7996_vif *mvif,
++ struct ieee80211_bss_conf *conf, unsigned int link_id)
++{
++ struct ieee80211_vif *vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv);
++ struct ieee80211_hw *hw = mvif->hw;
++ struct mt7996_link_sta *mlink;
++ struct ieee80211_tx_info *info;
++ struct sk_buff *skb;
++ int ret = 0, band_idx = phy->mt76->band_idx;
++ int band;
++
++ rcu_read_lock();
++
++ mlink = rcu_dereference(mvif->sta.link[link_id]);
++ if (!mlink || mlink->wcid.phy_idx != band_idx) {
++ ret = -EINVAL;
++ goto unlock;
++ }
++
++ if (!ieee80211_hw_check(hw, REPORTS_TX_ACK_STATUS)) {
++ /* probe request is not supported yet */
++ ret = -EOPNOTSUPP;
++ goto unlock;
++ }
++
++ /* FIXME: bss conf should not be all-zero before beacon mon work is canecled */
++ if (!is_valid_ether_addr(conf->bssid) ||
++ !is_valid_ether_addr(conf->addr)) {
++ /* invalid address */
++ ret = -EINVAL;
++ goto unlock;
++ }
++
++ skb = ieee80211_nullfunc_get(hw, vif, link_id, false);
++ if (!skb) {
++ ret = -ENOMEM;
++ goto unlock;
++ }
++
++ info = IEEE80211_SKB_CB(skb);
++ /* frame injected by driver */
++ info->flags |= (IEEE80211_TX_CTL_REQ_TX_STATUS |
++ IEEE80211_TX_CTL_INJECTED |
++ IEEE80211_TX_CTL_NO_PS_BUFFER);
++ if (ieee80211_vif_is_mld(vif))
++ info->control.flags |= u32_encode_bits(link_id, IEEE80211_TX_CTRL_MLO_LINK);
++
++ if (phy->chanctx)
++ band = phy->chanctx->chandef.chan->band;
++ else
++ band = phy->mt76->chandef.chan->band;
++
++ skb_set_queue_mapping(skb, IEEE80211_AC_VO);
++ if (!ieee80211_tx_prepare_skb(hw, vif, skb, band, NULL)) {
++ rcu_read_unlock();
++ ieee80211_free_txskb(hw, skb);
++ return -EINVAL;
++ }
++
++ local_bh_disable();
++ mt76_tx(phy->mt76, NULL, &mlink->wcid, skb);
++ local_bh_enable();
++
++ mvif->probe[band_idx] = (void *)skb;
++ mvif->probe_send_count[band_idx]++;
++ mvif->probe_send_time[band_idx] = jiffies;
++
++unlock:
++ rcu_read_unlock();
++ return ret;
++}
++
++void mt7996_beacon_mon_work(struct work_struct *work)
++{
++ struct mt7996_vif *mvif = container_of(work, struct mt7996_vif, beacon_mon_work.work);
++ struct ieee80211_vif *vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv);
++ struct ieee80211_hw *hw = mvif->hw;
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ unsigned long next_time = ULONG_MAX, valid_links = vif->valid_links ?: BIT(0);
++ unsigned int link_id;
++ enum monitor_state {
++ MON_STATE_BEACON_MON,
++ MON_STATE_SEND_PROBE,
++ MON_STATE_LINK_LOST,
++ MON_STATE_DISCONN,
++ };
++
++ mutex_lock(&dev->mt76.mutex);
++
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct ieee80211_bss_conf *conf;
++ struct mt7996_bss_conf *mconf;
++ struct mt7996_phy *phy;
++ unsigned long timeout, loss_duration;
++ int band_idx;
++ enum monitor_state state = MON_STATE_BEACON_MON;
++
++ conf = link_conf_dereference_protected(vif, link_id);
++ mconf = mconf_dereference_protected(mvif, link_id);
++ if (!conf || !mconf)
++ continue;
++
++ /* skip lost links */
++ if (mvif->lost_links & BIT(link_id))
++ continue;
++
++ phy = mconf->phy;
++ band_idx = phy->mt76->band_idx;
++ if (mvif->probe[band_idx]) {
++ loss_duration = msecs_to_jiffies(MT7996_MAX_PROBE_TIMEOUT);
++ timeout = mvif->probe_send_time[band_idx] + loss_duration;
++ if (time_after_eq(jiffies, timeout)) {
++ if (mvif->probe_send_count[band_idx] == MT7996_MAX_PROBE_TRIES)
++ state = MON_STATE_LINK_LOST;
++ else
++ state = MON_STATE_SEND_PROBE;
++ }
++ } else {
++ loss_duration = msecs_to_jiffies(MT7996_MAX_BEACON_LOSS *
++ conf->beacon_int);
++ timeout = mvif->beacon_received_time[band_idx] + loss_duration;
++ if (time_after_eq(jiffies, timeout)) {
++ wiphy_info(hw->wiphy, "link %d: detect %d beacon loss\n",
++ link_id, MT7996_MAX_BEACON_LOSS);
++ state = MON_STATE_SEND_PROBE;
++ }
++ }
++
++ switch (state) {
++ case MON_STATE_BEACON_MON:
++ break;
++ case MON_STATE_SEND_PROBE:
++ if (!mt7996_beacon_mon_send_probe(phy, mvif, conf, link_id)) {
++ timeout = MT7996_MAX_PROBE_TIMEOUT +
++ mvif->probe_send_time[band_idx];
++ wiphy_info(hw->wiphy,
++ "link %d: send nullfunc to AP %pM, try %d/%d\n",
++ link_id, conf->bssid,
++ mvif->probe_send_count[band_idx],
++ MT7996_MAX_PROBE_TRIES);
++ break;
++ }
++ fallthrough;
++ case MON_STATE_LINK_LOST:
++ mvif->lost_links |= BIT(link_id);
++ wiphy_info(hw->wiphy,
++ "link %d: %s to AP %pM, stop monitoring the lost link\n",
++ link_id,
++ state == MON_STATE_LINK_LOST ? "No ack for nullfunc frame" :
++ "Failed to send nullfunc frame",
++ conf->bssid);
++ mvif->probe[band_idx] = NULL;
++ mvif->probe_send_count[band_idx] = 0;
++ /* TODO: disable single link TX via TTLM/link reconfig for MLD */
++ if (mvif->lost_links != valid_links)
++ break;
++ fallthrough;
++ case MON_STATE_DISCONN:
++ default:
++ mutex_unlock(&dev->mt76.mutex);
++ wiphy_info(hw->wiphy, "all links are lost, disconnecting\n");
++ ieee80211_connection_loss(vif);
++ return;
++ }
++ next_time = min(next_time, timeout - jiffies);
++ }
++ mutex_unlock(&dev->mt76.mutex);
++
++ ieee80211_queue_delayed_work(hw, &mvif->beacon_mon_work, next_time);
++}
++
+ void mt7996_get_hw(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 phy_idx,
+ struct ieee80211_hw **hw)
+ {
+diff --git a/mt7996/main.c b/mt7996/main.c
+index c4eba315..155318b3 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -452,6 +452,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
+ is_zero_ether_addr(vif->addr))
+ phy->monitor_vif = vif;
+
++ INIT_DELAYED_WORK(&mvif->beacon_mon_work, mt7996_beacon_mon_work);
+ mvif->dev = dev;
+ mvif->hw = hw;
+ mvif->sta.vif = mvif;
+@@ -475,6 +476,7 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+
+ cancel_delayed_work_sync(&phy->scan_work);
++ cancel_delayed_work(&mvif->beacon_mon_work);
+
+ mutex_lock(&dev->mt76.mutex);
+
+@@ -1146,6 +1148,9 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ unsigned int link_id;
+
++ if (!ieee80211_vif_is_mld(vif) || rem == sta->valid_links)
++ cancel_delayed_work(&mvif->beacon_mon_work);
++
+ for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct mt7996_bss_conf *mconf =
+ mconf_dereference_protected(mvif, link_id);
+@@ -2584,6 +2589,61 @@ out:
+ return ret;
+ }
+
++static void
++mt7996_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ const struct ieee80211_event *event)
++{
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ int i;
++
++ switch (event->type) {
++ case MLME_EVENT:
++ if (event->u.mlme.data == ASSOC_EVENT &&
++ event->u.mlme.status == MLME_SUCCESS) {
++ struct ieee80211_bss_conf *conf;
++ struct mt7996_bss_conf *mconf;
++ struct mt7996_phy *phy;
++ unsigned long cur, valid_links = vif->valid_links ?: BIT(0);
++ unsigned int link_id;
++ int next_time = INT_MAX;
++
++ mutex_lock(&dev->mt76.mutex);
++ cur = jiffies;
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ conf = link_conf_dereference_protected(vif, link_id);
++ mconf = mconf_dereference_protected(mvif, link_id);
++
++ if (!conf || !mconf)
++ continue;
++
++ phy = mconf->phy;
++ mvif->beacon_received_time[phy->mt76->band_idx] = cur;
++ next_time = min(next_time,
++ MT7996_MAX_BEACON_LOSS *
++ conf->beacon_int);
++ }
++
++ ieee80211_queue_delayed_work(hw, &mvif->beacon_mon_work,
++ msecs_to_jiffies(next_time));
++ mutex_unlock(&dev->mt76.mutex);
++ break;
++ }
++
++ mutex_lock(&dev->mt76.mutex);
++ memset(mvif->probe_send_count, 0, sizeof(mvif->probe_send_count));
++ for (i = 0; i < __MT_MAX_BAND; i++)
++ mvif->probe[i] = NULL;
++ mvif->lost_links = 0;
++ mutex_unlock(&dev->mt76.mutex);
++
++ cancel_delayed_work(&mvif->beacon_mon_work);
++ break;
++ default:
++ break;
++ }
++}
++
+ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -2640,6 +2700,7 @@ const struct ieee80211_ops mt7996_ops = {
+ .net_fill_forward_path = mt7996_net_fill_forward_path,
+ .net_setup_tc = mt76_wed_net_setup_tc,
+ #endif
++ .event_callback = mt7996_event_callback,
+ .add_chanctx = mt7996_add_chanctx,
+ .remove_chanctx = mt7996_remove_chanctx,
+ .change_chanctx = mt7996_change_chanctx,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 294c46f6..40ee8949 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -129,6 +129,10 @@
+
+ #define to_rssi(field, rcpi) ((FIELD_GET(field, rcpi) - 220) / 2)
+
++#define MT7996_MAX_BEACON_LOSS 20
++#define MT7996_MAX_PROBE_TIMEOUT 500
++#define MT7996_MAX_PROBE_TRIES 2
++
+ struct mt7996_vif;
+ struct mt7996_sta;
+ struct mt7996_dfs_pulse;
+@@ -361,6 +365,14 @@ struct mt7996_vif {
+ u8 mld_remap_id;
+
+ u8 band_to_link[__MT_MAX_BAND];
++
++ /* for beacon monitoring */
++ struct delayed_work beacon_mon_work;
++ unsigned long beacon_received_time[__MT_MAX_BAND];
++ u16 lost_links;
++ void *probe[__MT_MAX_BAND];
++ unsigned long probe_send_time[__MT_MAX_BAND];
++ int probe_send_count[__MT_MAX_BAND];
+ };
+
+ /* crash-dump */
+@@ -1117,6 +1129,7 @@ bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len);
+ void mt7996_stats_work(struct work_struct *work);
+ void mt7996_scan_work(struct work_struct *work);
+ void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted);
++void mt7996_beacon_mon_work(struct work_struct *work);
+ int mt76_dfs_start_rdd(struct mt7996_dev *dev, bool force);
+ int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy);
+ void mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0109-mtk-wifi-mt76-mt7996-support-band_idx-option-for-set.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0114-mtk-mt76-mt7996-support-band_idx-option-for-set_mu-g.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0109-mtk-wifi-mt76-mt7996-support-band_idx-option-for-set.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0114-mtk-mt76-mt7996-support-band_idx-option-for-set_mu-g.patch
index 18dc66b..014431b 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0109-mtk-wifi-mt76-mt7996-support-band_idx-option-for-set.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0114-mtk-mt76-mt7996-support-band_idx-option-for-set_mu-g.patch
@@ -1,7 +1,7 @@
-From ef9c473ce6e0e65c915225af9d8400dbebb7ae67 Mon Sep 17 00:00:00 2001
+From efb6ebd878b7926828f0315622fcbdf98abe6b6b Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 4 Mar 2024 16:21:16 +0800
-Subject: [PATCH 109/116] mtk: wifi: mt76: mt7996: support band_idx option for
+Subject: [PATCH 114/199] mtk: mt76: mt7996: support band_idx option for
set_mu/get_mu vendor command
The vendor command set_mu and get_mu should be executed with band_idx.
@@ -16,10 +16,10 @@
4 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index e18a553..a71d92f 100644
+index 7b0d631e..598f32ba 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
-@@ -5853,12 +5853,23 @@ int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy)
+@@ -5838,12 +5838,23 @@ int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy)
#ifdef CONFIG_MTK_VENDOR
void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
{
@@ -45,8 +45,8 @@
switch (mode) {
case RATE_PARAM_FIXED_OFDMA:
-@@ -5874,13 +5885,14 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
- phy->muru_onoff = MUMIMO_UL;
+@@ -5859,13 +5870,14 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+ phy->muru_onoff |= MUMIMO_UL;
break;
case RATE_PARAM_AUTO_MU:
- if (val < 0 || val > 15) {
@@ -66,10 +66,10 @@
void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index ee36cf5..3d5a0c3 100644
+index 23d44cd3..9903d88e 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -888,6 +888,7 @@ enum {
+@@ -882,6 +882,7 @@ enum {
#endif
};
@@ -78,7 +78,7 @@
#define RATE_CFG_VAL GENMASK(7, 0)
diff --git a/mt7996/vendor.c b/mt7996/vendor.c
-index 31688c3..64ef551 100644
+index 31688c37..64ef5515 100644
--- a/mt7996/vendor.c
+++ b/mt7996/vendor.c
@@ -16,6 +16,7 @@ mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
@@ -162,7 +162,7 @@
void mt7996_set_wireless_rts_sigta(struct ieee80211_hw *hw, u8 value) {
diff --git a/mt7996/vendor.h b/mt7996/vendor.h
-index 0d1ef32..3234677 100644
+index 0d1ef322..32346775 100644
--- a/mt7996/vendor.h
+++ b/mt7996/vendor.h
@@ -68,6 +68,7 @@ enum mtk_vendor_attr_mu_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0110-mtk-wifi-mt76-mt7996-tmp-disable-VOW.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0115-mtk-mt76-mt7996-tmp-disable-VOW.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0110-mtk-wifi-mt76-mt7996-tmp-disable-VOW.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0115-mtk-mt76-mt7996-tmp-disable-VOW.patch
index 7d6fb6f..dfb76e0 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0110-mtk-wifi-mt76-mt7996-tmp-disable-VOW.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0115-mtk-mt76-mt7996-tmp-disable-VOW.patch
@@ -1,7 +1,7 @@
-From 2611bc7e80596500702dd3eef9d34014d00869b3 Mon Sep 17 00:00:00 2001
+From 3ba122ebb3462395d26d4f8f55dab510a49f5b5e Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 20 Mar 2024 22:56:44 +0800
-Subject: [PATCH 110/116] mtk: wifi: mt76: mt7996: tmp disable VOW
+Subject: [PATCH 115/199] mtk: mt76: mt7996: tmp disable VOW
FW will return failed when legacy 5G station connects after legacy 2G
station, need to check.
@@ -12,7 +12,7 @@
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index a71d92f..895ec3e 100644
+index 598f32ba..340b6637 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -2369,6 +2369,7 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
@@ -40,7 +40,7 @@
skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
&mlink->wcid,
-@@ -2455,11 +2457,13 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+@@ -2456,11 +2458,13 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
mt7996_mcu_sta_bfee_tlv(dev, skb, conf, mconf, link_sta);
}
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0111-mtk-wifi-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0116-mtk-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-bound.patch
similarity index 93%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0111-mtk-wifi-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0116-mtk-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-bound.patch
index 4c4f50d..ea0d36e 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0111-mtk-wifi-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0116-mtk-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-bound.patch
@@ -1,8 +1,8 @@
-From 20695a924111dee64fb9fa5d8c4996f2333b4aee Mon Sep 17 00:00:00 2001
+From af0b14e475466b4f353c20af228c381c695ec3f9 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 1 Apr 2024 17:00:21 +0800
-Subject: [PATCH 111/116] mtk: wifi: mt76: mt7996: enable ampdu limit to avoid
- BA bound issue
+Subject: [PATCH 116/199] mtk: mt76: mt7996: enable ampdu limit to avoid BA
+ bound issue
[Description]
When the station is MTK device and the peak is higher than 15G, the PPS
@@ -33,10 +33,10 @@
3 files changed, 95 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 4d0fd4b..1c8e503 100644
+index f6a0d328..6e3324f5 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -821,6 +821,7 @@ enum {
+@@ -829,6 +829,7 @@ enum {
STA_REC_KEY_V3 = 0x27,
STA_REC_HDRT = 0x28,
STA_REC_HDR_TRANS = 0x2B,
@@ -45,7 +45,7 @@
};
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 895ec3e..3f51c28 100644
+index 340b6637..f97acfb2 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -1344,6 +1344,85 @@ mt7996_mcu_sta_ba(struct mt7996_dev *dev, struct mt76_vif *mvif,
@@ -156,10 +156,10 @@
return 0;
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index 3d5a0c3..a1ac18f 100644
+index 9903d88e..f9f04680 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -579,6 +579,13 @@ struct sta_rec_ba_uni {
+@@ -573,6 +573,13 @@ struct sta_rec_ba_uni {
u8 __rsv[3];
} __packed;
@@ -173,7 +173,7 @@
struct sta_rec_eht {
__le16 tag;
__le16 len;
-@@ -945,6 +952,7 @@ enum {
+@@ -939,6 +946,7 @@ enum {
sizeof(struct sta_rec_eht) + \
sizeof(struct sta_rec_hdrt) + \
sizeof(struct sta_rec_hdr_trans) + \
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0112-wifi-mt76-mt7996-Fix-get_txpower-wrong-result-in-sin.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0117-mtk-mt76-mt7996-Fix-get_txpower-wrong-result-in-sing.patch
similarity index 85%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0112-wifi-mt76-mt7996-Fix-get_txpower-wrong-result-in-sin.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0117-mtk-mt76-mt7996-Fix-get_txpower-wrong-result-in-sing.patch
index 5471917..082b6a7 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0112-wifi-mt76-mt7996-Fix-get_txpower-wrong-result-in-sin.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0117-mtk-mt76-mt7996-Fix-get_txpower-wrong-result-in-sing.patch
@@ -1,22 +1,23 @@
-From e993c3e5aecb0d86609ebda85608bf84547b7ca7 Mon Sep 17 00:00:00 2001
+From cae948de0db9841b932562c2283331155ff182f0 Mon Sep 17 00:00:00 2001
From: Allen Ye <allen.ye@mediatek.com>
Date: Mon, 8 Apr 2024 16:56:09 +0800
-Subject: [PATCH 112/116] wifi: mt76: mt7996: Fix get_txpower wrong result in
+Subject: [PATCH 117/199] mtk: mt76: mt7996: Fix get_txpower wrong result in
single wiphy and legacy mode
Fix get_txpower wrong result in single wiphy and legacy mode.
ieee80211_hw is get from wiphy0, so we need to get correct phy from vif.
Temporarily use link 0 bss due to mac80211 didn't pass link id here.
+
---
mt7996/main.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/mt7996/main.c b/mt7996/main.c
-index d1f2c25..dcb0b07 100644
+index 155318b3..7e56f4b0 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -975,6 +975,32 @@ out:
+@@ -982,6 +982,32 @@ out:
mutex_unlock(&dev->mt76.mutex);
}
@@ -49,7 +50,7 @@
static void
mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
-@@ -2635,7 +2661,7 @@ const struct ieee80211_ops mt7996_ops = {
+@@ -2669,7 +2695,7 @@ const struct ieee80211_ops mt7996_ops = {
.hw_scan = mt7996_hw_scan,
.cancel_hw_scan = mt7996_cancel_hw_scan,
.release_buffered_frames = mt76_release_buffered_frames,
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0114-mtk-wifi-mt76-mt7996-Add-connac3-csi-feature.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0118-mtk-mt76-mt7996-Add-connac3-csi-feature.patch
similarity index 91%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0114-mtk-wifi-mt76-mt7996-Add-connac3-csi-feature.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0118-mtk-mt76-mt7996-Add-connac3-csi-feature.patch
index 15ec86c..27c74b7 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0114-mtk-wifi-mt76-mt7996-Add-connac3-csi-feature.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0118-mtk-mt76-mt7996-Add-connac3-csi-feature.patch
@@ -1,12 +1,14 @@
-From e8ef34a080c0c243559a63d029376436ddf11ac8 Mon Sep 17 00:00:00 2001
+From 3b007db9f040c663de6308f0cb1b9b603f1811c5 Mon Sep 17 00:00:00 2001
From: mtk20656 <chank.chen@mediatek.com>
Date: Sat, 20 Jan 2024 12:03:24 +0800
-Subject: [PATCH 114/116] mtk: wifi: mt76: mt7996: Add connac3 csi feature.
+Subject: [PATCH 118/199] mtk: mt76: mt7996: Add connac3 csi feature.
1. format align to wifi6.
2. add bw320 support.
3. add active mode.
+Fix csi bug with single wiphy design.
+
Signed-off-by: mtk20656 <chank.chen@mediatek.com>
---
mt76_connac_mcu.h | 2 +
@@ -15,15 +17,15 @@
mt7996/mcu.c | 465 ++++++++++++++++++++++++++++++++++++++++++++++
mt7996/mcu.h | 105 +++++++++++
mt7996/mt7996.h | 55 ++++++
- mt7996/vendor.c | 208 +++++++++++++++++++++
- mt7996/vendor.h | 50 +++++
- 8 files changed, 910 insertions(+)
+ mt7996/vendor.c | 247 ++++++++++++++++++++++++
+ mt7996/vendor.h | 52 ++++++
+ 8 files changed, 951 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 1c8e503..daaf87f 100644
+index 6e3324f5..1852e512 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1053,6 +1053,7 @@ enum {
+@@ -1061,6 +1061,7 @@ enum {
MCU_UNI_EVENT_THERMAL = 0x35,
MCU_UNI_EVENT_NIC_CAPAB = 0x43,
MCU_UNI_EVENT_TESTMODE_CTRL = 0x46,
@@ -31,7 +33,7 @@
MCU_UNI_EVENT_WED_RRO = 0x57,
MCU_UNI_EVENT_PER_STA_INFO = 0x6d,
MCU_UNI_EVENT_ALL_STA_INFO = 0x6e,
-@@ -1290,6 +1291,7 @@ enum {
+@@ -1298,6 +1299,7 @@ enum {
MCU_UNI_CMD_TESTMODE_TRX_PARAM = 0x42,
MCU_UNI_CMD_TESTMODE_CTRL = 0x46,
MCU_UNI_CMD_PRECAL_RESULT = 0x47,
@@ -40,10 +42,10 @@
MCU_UNI_CMD_RRO = 0x57,
MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
diff --git a/mt7996/init.c b/mt7996/init.c
-index 3af9d02..ff72aab 100644
+index f75aa568..a1941869 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -806,6 +806,24 @@ error:
+@@ -807,6 +807,24 @@ error:
return ret;
}
@@ -68,7 +70,7 @@
static void
mt7996_unregister_phy(struct mt7996_phy *phy, enum mt76_band_id band)
{
-@@ -817,6 +835,10 @@ mt7996_unregister_phy(struct mt7996_phy *phy, enum mt76_band_id band)
+@@ -818,6 +836,10 @@ mt7996_unregister_phy(struct mt7996_phy *phy, enum mt76_band_id band)
/* TODO: FIXME: temp for single wiphy support */
phy->mt76->hw = phy->mt76->ori_hw;
@@ -80,10 +82,10 @@
mphy = phy->dev->mt76.phys[band];
diff --git a/mt7996/main.c b/mt7996/main.c
-index dcb0b07..35f2495 100644
+index 7e56f4b0..b94af2f6 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -1292,6 +1292,9 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -1302,6 +1302,9 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
unsigned long rem = sta->valid_links ?: BIT(0);
@@ -94,7 +96,7 @@
}
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 3f51c28..6c9ec31 100644
+index f97acfb2..c59dbbea 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -653,6 +653,263 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
@@ -373,7 +375,7 @@
#endif
default:
break;
-@@ -5995,4 +6257,207 @@ void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+@@ -5980,4 +6242,207 @@ void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
mt7996_mcu_add_beacon(hw, &vif->bss_conf, &mvif->deflink, val);
}
@@ -582,10 +584,10 @@
+}
#endif
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index a1ac18f..dc93fab 100644
+index f9f04680..42e9f525 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -1159,4 +1159,109 @@ struct fixed_rate_table_ctrl {
+@@ -1153,4 +1153,109 @@ struct fixed_rate_table_ctrl {
u8 _rsv2;
} __packed;
@@ -696,10 +698,10 @@
+
#endif
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 0412d73..0d537fb 100644
+index 40ee8949..f0492078 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -438,6 +438,47 @@ struct mt7996_air_monitor_ctrl {
+@@ -445,6 +445,47 @@ struct mt7996_air_monitor_ctrl {
struct mt7996_air_monitor_group group[MT7996_AIR_MONITOR_MAX_GROUP];
struct mt7996_air_monitor_entry entry[MT7996_AIR_MONITOR_MAX_ENTRY];
};
@@ -747,7 +749,7 @@
#endif
struct mt7996_rro_ba_session {
-@@ -534,6 +575,18 @@ struct mt7996_phy {
+@@ -541,6 +582,18 @@ struct mt7996_phy {
u8 rts_bw_sig;
spinlock_t amnt_lock;
struct mt7996_air_monitor_ctrl amnt_ctrl;
@@ -766,7 +768,7 @@
#endif
#ifdef CONFIG_MTK_DEBUG
bool sr_enable:1;
-@@ -1166,6 +1219,8 @@ void mt7996_mcu_set_mimo(struct mt7996_phy *phy);
+@@ -1176,6 +1229,8 @@ void mt7996_mcu_set_mimo(struct mt7996_phy *phy);
int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val);
int mt7996_mcu_set_muru_cfg(struct mt7996_phy *phy, void *data);
void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif);
@@ -776,15 +778,16 @@
int mt7996_mcu_edcca_enable(struct mt7996_phy *phy, bool enable);
diff --git a/mt7996/vendor.c b/mt7996/vendor.c
-index 64ef551..07c0c36 100644
+index 64ef5515..84b50ab2 100644
--- a/mt7996/vendor.c
+++ b/mt7996/vendor.c
-@@ -119,6 +119,18 @@ beacon_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BEACON_CTRL] = {
+@@ -119,6 +119,19 @@ beacon_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BEACON_CTRL] = {
[MTK_VENDOR_ATTR_BEACON_CTRL_MODE] = { .type = NLA_U8 },
};
+static const struct nla_policy
+csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
++ [MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_CSI_CTRL_CFG] = {.type = NLA_NESTED },
+ [MTK_VENDOR_ATTR_CSI_CTRL_CFG_MODE] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_CSI_CTRL_CFG_TYPE] = { .type = NLA_U8 },
@@ -798,7 +801,7 @@
struct mt7996_amnt_data {
u8 idx;
u8 addr[ETH_ALEN];
-@@ -1000,7 +1012,188 @@ static int mt7996_vendor_beacon_ctrl(struct wiphy *wiphy,
+@@ -1000,7 +1013,226 @@ static int mt7996_vendor_beacon_ctrl(struct wiphy *wiphy,
return 0;
}
@@ -808,8 +811,11 @@
+ int data_len)
+{
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
-+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct mt7996_phy *phy;
++ struct mt76_phy *mphy;
+ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_CSI_CTRL];
++ u8 band_idx = 0;
+ int err;
+
+ err = nla_parse(tb, MTK_VENDOR_ATTR_CSI_CTRL_MAX, data, data_len,
@@ -817,6 +823,20 @@
+ if (err)
+ return err;
+
++ if (tb[MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX])
++ band_idx = nla_get_u8(tb[MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX]);
++
++ if (!mt7996_band_valid(dev, band_idx))
++ goto error;
++
++ mphy = dev->mt76.phys[band_idx];
++ if (!mphy)
++ goto error;
++
++ phy = (struct mt7996_phy *)mphy->priv;
++ if (!phy)
++ goto error;
++
+ if (tb[MTK_VENDOR_ATTR_CSI_CTRL_CFG]) {
+ u8 mode = 0, type = 0, v1 = 0;
+ u32 v2 = 0;
@@ -856,7 +876,7 @@
+ return err;
+
+ spin_lock_bh(&phy->csi.lock);
-
++
+ phy->csi.enable = !!mode;
+
+ /* clean up old csi stats */
@@ -880,6 +900,10 @@
+ }
+
+ return 0;
++
++error:
++ dev_err(dev->mt76.dev, "Invalid band idx: %d\n", band_idx);
++ return -EINVAL;
+}
+
+static int
@@ -889,8 +913,11 @@
+{
+#define RESERVED_SET BIT(31)
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
-+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct mt7996_phy *phy;
++ struct mt76_phy *mphy;
+ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {0};
++ u8 band_idx = 0;
+ int err = 0;
+
+ if (*storage & RESERVED_SET) {
@@ -906,6 +933,20 @@
+ return err;
+ }
+
++ if (tb[MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX])
++ band_idx = nla_get_u8(tb[MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX]);
++
++ if (!mt7996_band_valid(dev, band_idx))
++ return -EINVAL;
+
++ mphy = dev->mt76.phys[band_idx];
++ if (!mphy)
++ return -EINVAL;
++
++ phy = (struct mt7996_phy *)mphy->priv;
++ if (!phy)
++ return -EINVAL;
++
+ if (!(*storage & RESERVED_SET) && tb[MTK_VENDOR_ATTR_CSI_CTRL_DUMP_NUM]) {
+ *storage = nla_get_u16(tb[MTK_VENDOR_ATTR_CSI_CTRL_DUMP_NUM]);
+ *storage |= RESERVED_SET;
@@ -987,7 +1028,7 @@
static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
{
-@@ -1129,6 +1322,18 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+@@ -1129,6 +1361,18 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
.policy = beacon_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_BEACON_CTRL_MAX,
},
@@ -1006,7 +1047,7 @@
};
void mt7996_vendor_register(struct mt7996_phy *phy)
-@@ -1136,6 +1341,9 @@ void mt7996_vendor_register(struct mt7996_phy *phy)
+@@ -1136,6 +1380,9 @@ void mt7996_vendor_register(struct mt7996_phy *phy)
phy->mt76->hw->wiphy->vendor_commands = mt7996_vendor_commands;
phy->mt76->hw->wiphy->n_vendor_commands = ARRAY_SIZE(mt7996_vendor_commands);
@@ -1017,7 +1058,7 @@
}
#endif
diff --git a/mt7996/vendor.h b/mt7996/vendor.h
-index 3234677..abe3fde 100644
+index 32346775..834b3d08 100644
--- a/mt7996/vendor.h
+++ b/mt7996/vendor.h
@@ -7,6 +7,7 @@
@@ -1028,7 +1069,7 @@
MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL = 0xc3,
MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4,
MTK_NL80211_VENDOR_SUBCMD_MU_CTRL = 0xc5,
-@@ -240,6 +241,55 @@ enum mtk_vendor_attr_beacon_ctrl {
+@@ -240,6 +241,57 @@ enum mtk_vendor_attr_beacon_ctrl {
NUM_MTK_VENDOR_ATTRS_BEACON_CTRL - 1
};
@@ -1046,6 +1087,8 @@
+
+ MTK_VENDOR_ATTR_CSI_CTRL_DATA,
+
++ MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX,
++
+ /* keep last */
+ NUM_MTK_VENDOR_ATTRS_CSI_CTRL,
+ MTK_VENDOR_ATTR_CSI_CTRL_MAX =
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0115-mtk-wifi-mt76-mt7996-add-more-debug-info-for-MLO.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0119-mtk-mt76-mt7996-add-more-debug-info-for-MLO.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0115-mtk-wifi-mt76-mt7996-add-more-debug-info-for-MLO.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0119-mtk-mt76-mt7996-add-more-debug-info-for-MLO.patch
index fad0b87..772fb37 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0115-mtk-wifi-mt76-mt7996-add-more-debug-info-for-MLO.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0119-mtk-mt76-mt7996-add-more-debug-info-for-MLO.patch
@@ -1,38 +1,40 @@
-From 9f8261c0ffa9a1bbe4f810ce39c70c1f8954c60d Mon Sep 17 00:00:00 2001
+From 9fe070ee29d4d63044a27782e643cd3dad8a8669 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 22 Apr 2024 11:06:48 +0800
-Subject: [PATCH 115/116] mtk: wifi: mt76: mt7996: add more debug info for MLO
+Subject: [PATCH 119/199] mtk: mt76: mt7996: add more debug info for MLO
---
mt76_connac_mcu.c | 1 +
mt76_connac_mcu.h | 1 +
- mt7996/debugfs.c | 34 +-
+ mt7996/debugfs.c | 35 +-
mt7996/mac.c | 15 +
mt7996/main.c | 14 +
- mt7996/mcu.c | 18 +
+ mt7996/mcu.c | 27 ++
mt7996/mcu.h | 8 +
- mt7996/mt7996.h | 20 +
- mt7996/mtk_debug.h | 660 +++++++++++++++++++++++++
- mt7996/mtk_debugfs.c | 1085 ++++++++++++++++++++++++++++++++++++++++++
- 10 files changed, 1847 insertions(+), 9 deletions(-)
+ mt7996/mt7996.h | 22 +
+ mt7996/mtk_debug.h | 660 ++++++++++++++++++++++++++
+ mt7996/mtk_debugfs.c | 1050 ++++++++++++++++++++++++++++++++++++++++++
+ tools/fwlog.c | 40 +-
+ tools/main.c | 1 +
+ 12 files changed, 1856 insertions(+), 18 deletions(-)
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 71f3d30..a4924c4 100644
+index ab7cf4a6..8d1036e1 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
-@@ -433,6 +433,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
+@@ -432,6 +432,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
}
memcpy(basic->peer_addr, link_sta->addr, ETH_ALEN);
+ pr_info("%s: link %u addr [%pM]\n", __func__, link_sta->link_id, basic->peer_addr);
- basic->qos = sta->wme;
+ basic->qos = link_sta->sta->wme;
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv);
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index daaf87f..27bff39 100644
+index 1852e512..870417f3 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1287,6 +1287,7 @@ enum {
+@@ -1295,6 +1295,7 @@ enum {
MCU_UNI_CMD_THERMAL = 0x35,
MCU_UNI_CMD_VOW = 0x37,
MCU_UNI_CMD_PP = 0x38,
@@ -41,7 +43,7 @@
MCU_UNI_CMD_TESTMODE_TRX_PARAM = 0x42,
MCU_UNI_CMD_TESTMODE_CTRL = 0x46,
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
-index 26927ed..77349c2 100644
+index fe8fea5d..63b8887d 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -314,15 +314,17 @@ mt7996_fw_debug_wm_set(void *data, u64 val)
@@ -97,22 +99,23 @@
ret = mt7996_mcu_fw_dbg_ctrl(dev, debug_category[i], 2);
if (ret)
return ret;
-@@ -506,6 +511,14 @@ mt7996_fw_debug_bin_set(void *data, u64 val)
+@@ -506,6 +511,15 @@ mt7996_fw_debug_bin_set(void *data, u64 val)
if (ret)
return ret;
+#ifdef CONFIG_MTK_DEBUG
-+ dev->dbg.dump_mcu_pkt = val & BIT(4) ? true : false;
-+ dev->dbg.dump_txd = val & BIT(5) ? true : false;
-+ dev->dbg.dump_tx_pkt = val & BIT(6) ? true : false;
-+ dev->dbg.dump_rx_pkt = val & BIT(7) ? true : false;
-+ dev->dbg.dump_rx_raw = val & BIT(8) ? true : false;
++ dev->dbg.dump_mcu_pkt = !!(val & BIT(4));
++ dev->dbg.dump_txd = !!(val & BIT(5));
++ dev->dbg.dump_tx_pkt = !!(val & BIT(6));
++ dev->dbg.dump_rx_pkt = !!(val & BIT(7));
++ dev->dbg.dump_rx_raw = !!(val & BIT(8));
++ dev->dbg.dump_mcu_event = !!(val & BIT(9));
+#endif
+
return mt7996_fw_debug_wm_set(dev, dev->fw_debug_wm);
}
-@@ -1208,6 +1221,9 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
+@@ -1195,6 +1209,9 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len)
{
bool is_fwlog = get_unaligned_le32(data) == FW_BIN_LOG_MAGIC;
@@ -123,7 +126,7 @@
if (is_fwlog) {
if (dev->relay_fwlog)
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index 2a45fc0..a8cf24c 100644
+index 803f7ce3..6462c64c 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -331,6 +331,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
@@ -137,7 +140,7 @@
hw_aggr = status->aggr;
memset(status, 0, sizeof(*status));
-@@ -511,6 +515,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+@@ -505,6 +509,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
}
hdr_gap = (u8 *)rxd - skb->data + 2 * remove_pad;
@@ -148,7 +151,7 @@
if (hdr_trans && ieee80211_has_morefrags(fc)) {
if (mt7996_reverse_frag0_hdr_trans(skb, hdr_gap))
return -EINVAL;
-@@ -967,6 +975,13 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -982,6 +990,13 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
tx_info->buf[1].skip_unmap = true;
tx_info->nbuf = MT_CT_DMA_BUF_NUM;
@@ -163,10 +166,10 @@
}
diff --git a/mt7996/main.c b/mt7996/main.c
-index 35f2495..2cc0c32 100644
+index b94af2f6..fa9486e4 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
-@@ -431,6 +431,9 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
+@@ -433,6 +433,9 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
rcu_assign_pointer(mvif->link[link_id], mconf);
rcu_assign_pointer(mvif->sta.link[link_id], mlink);
@@ -176,7 +179,7 @@
return 0;
error:
mt7996_remove_bss_conf(vif, conf, mconf);
-@@ -603,6 +606,11 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+@@ -610,6 +613,11 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
add = vif->valid_links ?: BIT(0);
}
@@ -188,7 +191,7 @@
mutex_lock(&dev->mt76.mutex);
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
-@@ -1133,6 +1141,8 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
+@@ -1140,6 +1148,8 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
mt76_wcid_mask_set(dev->mt76.wcid_phy_mask, idx);
rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->wcid);
mt76_wcid_init(&mlink->wcid);
@@ -197,15 +200,15 @@
}
if (!assoc)
-@@ -1167,6 +1177,7 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- unsigned int link_id;
+@@ -1177,6 +1187,7 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ if (!ieee80211_vif_is_mld(vif) || rem == sta->valid_links)
+ cancel_delayed_work(&mvif->beacon_mon_work);
+ mlo_dbg(mt7996_hw_phy(mvif->hw), "rem=%lu\n", rem);
for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
struct mt7996_bss_conf *mconf =
mconf_dereference_protected(mvif, link_id);
-@@ -1192,6 +1203,7 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+@@ -1202,6 +1213,7 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
unsigned int link_id;
int i, ret;
@@ -213,7 +216,7 @@
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
struct mt7996_bss_conf *mconf =
mconf_dereference_protected(mvif, link_id);
-@@ -2530,6 +2542,7 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2556,6 +2568,7 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id;
int ret = 0;
@@ -221,7 +224,7 @@
if (old_links == new_links)
return 0;
-@@ -2578,6 +2591,7 @@ mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2601,6 +2614,7 @@ mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned long rem = old_links & ~new_links;
int ret = 0;
@@ -230,7 +233,7 @@
if (rem)
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
-index 6c9ec31..fa17f73 100644
+index c59dbbea..0b02b76b 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -333,6 +333,10 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
@@ -244,7 +247,18 @@
if (wait_seq)
*wait_seq = seq;
+@@ -1120,6 +1124,10 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+ struct mt7996_mcu_rxd *rxd = (struct mt7996_mcu_rxd *)skb->data;
+
-@@ -1336,6 +1340,8 @@ mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
++#ifdef CONFIG_MTK_DEBUG
++ if (dev->dbg.dump_mcu_event)
++ mt7996_packet_log_to_host(dev, skb->data, skb->len, PKT_BIN_DEBUG_MCU_EVENT, 0);
++#endif
+ switch (rxd->eid) {
+ case MCU_UNI_EVENT_FW_LOG_2_HOST:
+ mt7996_mcu_rx_log_message(dev, skb);
+@@ -1336,6 +1344,8 @@ mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
}
mld->own_mld_id = mconf->own_mld_id;
@@ -253,7 +267,7 @@
}
static void
-@@ -1487,6 +1493,10 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
+@@ -1487,6 +1497,10 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
}
memcpy(bss->bssid, conf->bssid, ETH_ALEN);
@@ -264,16 +278,16 @@
bss->bcn_interval = cpu_to_le16(conf->beacon_int);
bss->dtim_period = conf->dtim_period;
bss->phymode = mt76_connac_get_phy_mode(phy, vif,
-@@ -2770,6 +2780,8 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
-
+@@ -2771,6 +2785,8 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
/* starec basic */
- mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, conf, link_sta, enable, newly);
+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, conf, link_sta,
+ enable, newly);
+ mlo_dbg(mconf->phy, "link=%u, newly=%d, en=%d\n",
+ mlink->wcid.link_id, newly, enable);
if (!enable)
goto out;
-@@ -2852,12 +2864,16 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+@@ -2853,12 +2869,16 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
mld_setup->link_num = hweight16(sta->valid_links);
mld_setup_link = (struct mld_setup_link *)mld_setup->link_info;
@@ -290,7 +304,7 @@
mld_setup_link++;
}
}
-@@ -3121,6 +3137,8 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
+@@ -3122,6 +3142,8 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
return mt7996_mcu_muar_config(phy, conf, mconf, false, enable);
memcpy(data.tlv.omac_addr, conf->addr, ETH_ALEN);
@@ -299,11 +313,23 @@
return mt76_mcu_send_msg(&dev->mt76, MCU_WMWA_UNI_CMD(DEV_INFO_UPDATE),
&data, sizeof(data), true);
}
+@@ -3226,6 +3248,11 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ BSS_CHANGED_BEACON);
+
+ memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
++
++ if (dev->dbg.dump_txd)
++ mt7996_packet_log_to_host(dev, (__le32 *)buf, MT_TXD_SIZE, PKT_BIN_DEBUG_TXD, 0);
++ if (dev->dbg.dump_tx_pkt)
++ mt7996_packet_log_to_host(dev, skb->data, skb->len, PKT_BIN_DEBUG_TX, 0);
+ }
+
+ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
diff --git a/mt7996/mcu.h b/mt7996/mcu.h
-index dc93fab..84d961d 100644
+index 42e9f525..5e217719 100644
--- a/mt7996/mcu.h
+++ b/mt7996/mcu.h
-@@ -1035,6 +1035,14 @@ enum {
+@@ -1029,6 +1029,14 @@ enum {
UNI_RRO_SET_FLUSH_TIMEOUT
};
@@ -319,15 +345,16 @@
UNI_CMD_SR_ENABLE = 0x1,
UNI_CMD_SR_ENABLE_SD,
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 0d537fb..de7cf1e 100644
+index f0492078..ff13d00e 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -730,6 +730,13 @@ struct mt7996_dev {
+@@ -737,6 +737,14 @@ struct mt7996_dev {
u8 fw_dbg_lv;
u32 bcn_total_cnt[__MT_MAX_BAND];
u32 sid;
+
+ bool dump_mcu_pkt:1;
++ bool dump_mcu_event:1;
+ bool dump_txd:1;
+ bool dump_tx_pkt:1;
+ bool dump_rx_pkt:1;
@@ -336,7 +363,7 @@
} dbg;
const struct mt7996_dbg_reg_desc *dbg_reg;
#endif
-@@ -925,6 +932,8 @@ mt7996_get_link_wcid(struct mt7996_dev *dev, u16 idx, u8 band_idx)
+@@ -935,6 +943,8 @@ mt7996_get_link_wcid(struct mt7996_dev *dev, u16 idx, u8 band_idx)
return &mlink->wcid;
}
@@ -345,7 +372,7 @@
extern const struct ieee80211_ops mt7996_ops;
extern struct pci_driver mt7996_pci_driver;
extern struct pci_driver mt7996_hif_driver;
-@@ -1256,6 +1265,17 @@ void mt7996_tm_update_channel(struct mt7996_phy *phy);
+@@ -1266,6 +1276,18 @@ void mt7996_tm_update_channel(struct mt7996_phy *phy);
int mt7996_mcu_set_vow_drr_dbg(struct mt7996_dev *dev, u32 val);
int mt7996_mcu_thermal_debug(struct mt7996_dev *dev, u8 mode, u8 action);
@@ -357,6 +384,7 @@
+ PKT_BIN_DEBUG_TX,
+ PKT_BIN_DEBUG_RX,
+ PKT_BIN_DEBUG_RX_RAW,
++ PKT_BIN_DEBUG_MCU_EVENT,
+};
+
+void mt7996_packet_log_to_host(struct mt7996_dev *dev, const void *data, int len, int type, int des_len);
@@ -364,7 +392,7 @@
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
diff --git a/mt7996/mtk_debug.h b/mt7996/mtk_debug.h
-index da2a607..8299023 100644
+index da2a6072..82990239 100644
--- a/mt7996/mtk_debug.h
+++ b/mt7996/mtk_debug.h
@@ -2288,4 +2288,664 @@ enum cipher_suit {
@@ -1033,10 +1061,10 @@
+
#endif
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
-index c787551..6640448 100644
+index cc1224ed..c7f5b56e 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
-@@ -3228,6 +3228,1072 @@ mt7996_thermal_recal_set(void *data, u64 val)
+@@ -3187,6 +3187,1038 @@ mt7996_thermal_recal_set(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(fops_thermal_recal, NULL,
mt7996_thermal_recal_set, "%llu\n");
@@ -1061,10 +1089,6 @@
+ if (ret)
+ return ret;
+
-+ ret = mt7996_mcu_get_per_sta_info(mdev, UNI_PER_STA_TX_CNT, 1, &dev->wlan_idx);
-+ if (ret)
-+ return ret;
-+
+ /* Reset counters in MT76. */
+ rcu_read_lock();
+ wcid = rcu_dereference(dev->mt76.wcid[dev->wlan_idx]);
@@ -1078,36 +1102,6 @@
+}
+DEFINE_DEBUGFS_ATTRIBUTE(fops_reset_counter, NULL, mt7996_reset_counter, "%llu\n");
+
-+static int
-+mt7996_per_read(struct seq_file *s, void *data)
-+{
-+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
-+ u16 wlan_idx = dev->wlan_idx;
-+ struct mt76_wcid *wcid;
-+ u32 total, failed;
-+ int ret;
-+
-+ ret = mt7996_mcu_get_per_sta_info(&dev->mt76, UNI_PER_STA_TX_CNT, 1, &wlan_idx);
-+ if (ret)
-+ return ret;
-+
-+ rcu_read_lock();
-+ wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
-+ if (wcid) {
-+ total = wcid->stats.tx_total_mpdu_cnt;
-+ failed = wcid->stats.tx_failed_mpdu_cnt;
-+ seq_printf(s, "WCID %hu\tTxTotalMpduCount: %u\tTxFailedMpduCount: %u\tPER: %u.%u%%\n",
-+ wlan_idx, total, failed,
-+ total ? failed * 1000 / total / 10 : 0,
-+ total ? failed * 1000 / total % 10 : 0);
-+ } else {
-+ ret = -EINVAL;
-+ }
-+ rcu_read_unlock();
-+
-+ return ret;
-+}
-+
+void mt7996_packet_log_to_host(struct mt7996_dev *dev, const void *data, int len, int type, int des_len)
+{
+ struct bin_debug_hdr *hdr;
@@ -1260,7 +1254,7 @@
+ .llseek = default_llseek,
+};
+
-+static int mt7996_amsdu_info_read(struct seq_file *s, void *data)
++static int mt7996_hw_amsdu_info_read(struct seq_file *s, void *data)
+{
+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
+ u32 amsdu_cnt[WF_PLE_TOP_AMSDU_PACK_NUM] = {0}, total_cnt;
@@ -2109,12 +2103,11 @@
int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
struct mt7996_dev *dev = phy->dev;
-@@ -3337,6 +4403,25 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+@@ -3295,6 +4327,24 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
debugfs_create_file("thermal_recal", 0200, dir, dev, &fops_thermal_recal);
+ debugfs_create_file("reset_counter", 0200, dir, dev, &fops_reset_counter);
-+ debugfs_create_devm_seqfile(dev->mt76.dev, "per", dir, mt7996_per_read);
+
+ debugfs_create_devm_seqfile(dev->mt76.dev, "drr_info", dir,
+ mt7996_drr_info);
@@ -2130,11 +2123,106 @@
+ /* amsdu */
+ debugfs_create_file("amsdu_algo", 0600, dir, dev, &fops_amsdu_algo);
+ debugfs_create_file("amsdu_para", 0600, dir, dev, &fops_amsdu_para);
-+ debugfs_create_devm_seqfile(dev->mt76.dev, "amsdu_info", dir,
-+ mt7996_amsdu_info_read);
++ debugfs_create_devm_seqfile(dev->mt76.dev, "hw_amsdu_info", dir,
++ mt7996_hw_amsdu_info_read);
return 0;
}
+diff --git a/tools/fwlog.c b/tools/fwlog.c
+index 0e2de2dc..8d163e1d 100644
+--- a/tools/fwlog.c
++++ b/tools/fwlog.c
+@@ -94,7 +94,7 @@ static void handle_signal(int sig)
+ done = true;
+ }
+
+-static int mt76_log_socket(struct sockaddr_in *remote, char *ip)
++static int mt76_log_socket(struct sockaddr_in *remote, char *ip, unsigned short port)
+ {
+ struct sockaddr_in local = {
+ .sin_family = AF_INET,
+@@ -103,7 +103,7 @@ static int mt76_log_socket(struct sockaddr_in *remote, char *ip)
+ int s, ret;
+
+ remote->sin_family = AF_INET;
+- remote->sin_port = htons(55688);
++ remote->sin_port = htons(port);
+ if (!inet_aton(ip, &remote->sin_addr)) {
+ fprintf(stderr, "Invalid destination IP address: %s\n", ip);
+ return -EINVAL;
+@@ -201,15 +201,37 @@ int mt76_fwlog(const char *phyname, int argc, char **argv)
+ {
+ struct sockaddr_in remote;
+ int in_fd, out_fd, ret;
++ char dev_ip[16] = {};
++ unsigned short port;
+
+- if (argc < 1) {
+- fprintf(stderr, "need destination address\n");
++ if (argc < 2) {
++ fprintf(stderr, "need destination address and fw_debug_bin\n");
+ return -EINVAL;
+ }
+
+- out_fd = mt76_log_socket(&remote, argv[0]);
+- if (out_fd < 0)
+- return out_fd;
++
++ if (argc == 2) {
++ /* support ip:port format */
++ if (strchr(argv[0], ':')) {
++ sscanf(argv[0], "%[^:]:%hu", dev_ip, &port);
++ } else {
++ strncpy(dev_ip, argv[0], sizeof(dev_ip));
++ port = 55688;
++ }
++
++ out_fd = mt76_log_socket(&remote, dev_ip, port);
++ if (out_fd < 0)
++ return out_fd;
++ } else if (argc == 3) {
++ out_fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR);
++ if (out_fd < 0) {
++ perror("open");
++ return out_fd;
++ }
++ } else {
++ fprintf(stderr, "Too many arguments.\n");
++ return -EINVAL;
++ }
+
+ ret = mt76_set_fwlog_en(phyname, true, argv[1]);
+ if (ret)
+@@ -221,7 +243,7 @@ int mt76_fwlog(const char *phyname, int argc, char **argv)
+ goto disable;
+ }
+
+- if (mt76_log_relay(in_fd, out_fd, &remote))
++ if (mt76_log_relay(in_fd, out_fd, argc == 3 ? NULL : &remote))
+ fprintf(stderr, "Failed to relay FW log.\n");
+
+ close(in_fd);
+@@ -240,7 +262,7 @@ int mt76_idxlog(const char *phyname, int argc, char **argv)
+ int in_fd, out_fd, ret;
+
+ if (argc) {
+- out_fd = mt76_log_socket(&remote, argv[0]);
++ out_fd = mt76_log_socket(&remote, argv[0], 55688);
+ if (out_fd < 0)
+ return out_fd;
+ } else {
+diff --git a/tools/main.c b/tools/main.c
+index e9e25567..dcbb9b26 100644
+--- a/tools/main.c
++++ b/tools/main.c
+@@ -49,6 +49,7 @@ void usage(void)
+ "eeprom set <addr>=<val> [...]",
+ "eeprom changes",
+ "eeprom reset",
++ "fwlog <ip> <fw_debug_bin input> <fwlog name>",
+ };
+ int i;
+
--
2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0120-mtk-mt76-add-internal-debug-tool.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0120-mtk-mt76-add-internal-debug-tool.patch
new file mode 100644
index 0000000..99adad3
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0120-mtk-mt76-add-internal-debug-tool.patch
@@ -0,0 +1,1904 @@
+From a63950272ed7934e2777155cb8ea06bb82d75c33 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Mon, 22 Apr 2024 12:22:05 +0800
+Subject: [PATCH 120/199] mtk: mt76: add internal debug tool
+
+Add the following DebugFS knobs:
+- reset_counter: reset TX/RX statistical counters in FW, WTBL, and MT76.
+- per: show PER, which is calculated using MPDU-based statistics from CMDRPT-TX.
+
+Sources of statistics stored in Eagle mt76_sta_stats are summarized below.
+<tx_bytes> source: CMDRPT-TX
+<tx_packets> unit: MSDU. source: WTBL.
+<tx_retries> unit: MPDU. source: TX-Free-Done Event
+<tx_failed> unit: MPDU. source: TX-Free-Done Event
+<tx_total_mpdu_cnt> unit: MPDU. source: CMDRPT-TX
+<tx_failed_mpdu_cnt> unit: MPDU. source: CMDRPT-TX
+<rx_bytes> source: RXRPT
+<rx_packets> unit: MSDU. source: WTBL.
+<rx_errors> Not used.
+<rx_drops> Not used.
+
+Add token pending time
+
+Refactor DebugFS knob amsdu_info to read unambiguous CR addresses for HW-AMSDU information.
+
+Remove the duplicate function in mtk_debugfs.c & mtk_debug_i.c
+Only enable mt7996_mcu_fw_log_2_host function in mcu.c
+
+mtk: wifi: mt76: mt7996: add more ids support for eagle and kite
+
+IDS is the internal debug commands for firmware debug usage. This
+debugfs will be called only when we use chihuahua tool. Since MT7990 and
+MT7992 use the same firmware branch. This commit change some ids idx and
+support mode ids options as below:
+
+1. set fw_dbg=2:62 for MUCOP
+2. set fw_dbg=1:85 for BSRP
+3. set fw_dbg=1:86 for Tput Monitor
+4. set fw_dbg=1:100 for MLO
+5. set fw_dbg=1:101 for ERROR Log
+
+mtk: wifi: mt76: mt7996: revise DebugFS command ple_info to show correct TXCMD queue information
+
+Each band has its own set of TXCMD queues in PLE module.
+However, the original codebase only specifies one shared set of queues with wrong queue indices.
+
+mtk: wifi: mt76: mt7992: revise DebugFS command ple_info to accommodate Kite
+
+Because Kite only supports 512 STAs, the number of AC_QUEUE_EMPTY CRs is less than that of Eagle.
+Consequently, some related macros have to be revised to prevent reading wrong CRs.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/Makefile | 3 +-
+ mt7996/debugfs.c | 6 +-
+ mt7996/init.c | 4 +
+ mt7996/mac.c | 2 +
+ mt7996/mt7996.h | 12 +
+ mt7996/mtk_debug_i.h | 987 +++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_debugfs_i.c | 720 ++++++++++++++++++++++++++++++
+ 7 files changed, 1732 insertions(+), 2 deletions(-)
+ create mode 100644 mt7996/mtk_debug_i.h
+ create mode 100644 mt7996/mtk_debugfs_i.c
+
+diff --git a/mt7996/Makefile b/mt7996/Makefile
+index 6643c7a3..49ec9154 100644
+--- a/mt7996/Makefile
++++ b/mt7996/Makefile
+@@ -1,4 +1,5 @@
+ # SPDX-License-Identifier: ISC
++EXTRA_CFLAGS += -Werror
+ EXTRA_CFLAGS += -DCONFIG_MT76_LEDS
+ EXTRA_CFLAGS += -DCONFIG_MTK_DEBUG
+ EXTRA_CFLAGS += -DCONFIG_MTK_VENDOR
+@@ -11,4 +12,4 @@ mt7996e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o \
+ mt7996e-$(CONFIG_DEV_COREDUMP) += coredump.o
+ mt7996e-$(CONFIG_NL80211_TESTMODE) += testmode.o
+
+-mt7996e-y += mtk_debugfs.o mtk_mcu.o
++mt7996e-y += mtk_debugfs.o mtk_mcu.o mtk_debugfs_i.o
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 63b8887d..2c553cf3 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1118,8 +1118,12 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
+ debugfs_create_file("fw_debug_muru_disable", 0600, dir, dev,
+ &fops_fw_debug_muru_disable);
+
+- if (phy == &dev->phy)
++ if (phy == &dev->phy) {
+ dev->debugfs_dir = dir;
++#ifdef CONFIG_MTK_DEBUG
++ mt7996_mtk_init_debugfs_internal(phy, dir);
++#endif
++ }
+
+ #ifdef CONFIG_MTK_DEBUG
+ debugfs_create_u16("wlan_idx", 0600, dir, &dev->wlan_idx);
+diff --git a/mt7996/init.c b/mt7996/init.c
+index a1941869..057d20db 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -886,6 +886,10 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+ mt76_wr(dev, MT_RRO_ADDR_ARRAY_BASE0,
+ dev->wed_rro.addr_elem[0].phy_addr);
+ } else {
++ INIT_LIST_HEAD(&dev->wed_rro.pg_addr_cache);
++ for (i = 0; i < MT7996_RRO_MSDU_PG_HASH_SIZE; i++)
++ INIT_LIST_HEAD(&dev->wed_rro.pg_hash_head[i]);
++
+ /* TODO: remove line after WM has set */
+ mt76_clear(dev, WF_RRO_AXI_MST_CFG, WF_RRO_AXI_MST_CFG_DIDX_OK);
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 6462c64c..c6816ab5 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -334,6 +334,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ #ifdef CONFIG_MTK_DEBUG
+ if (dev->dbg.dump_rx_raw)
+ mt7996_packet_log_to_host(dev, skb->data, skb->len, PKT_BIN_DEBUG_RX_RAW, 0);
++ mt7996_dump_bmac_rxd_info(dev, rxd);
+ #endif
+ hw_aggr = status->aggr;
+ memset(status, 0, sizeof(*status));
+@@ -995,6 +996,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ mt7996_packet_log_to_host(dev, txwi, MT_TXD_SIZE, PKT_BIN_DEBUG_TXD, 0);
+ if (dev->dbg.dump_tx_pkt)
+ mt7996_packet_log_to_host(dev, t->skb->data, t->skb->len, PKT_BIN_DEBUG_TX, 0);
++ mt7996_dump_bmac_txd_info(NULL, dev, (__le32 *)txwi, true, false);
+ #endif
+
+ return 0;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index ff13d00e..ef544957 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -101,6 +101,7 @@
+
+ #define MT7996_BUILD_TIME_LEN 24
+
++#define MT7996_RRO_MSDU_PG_HASH_SIZE 127
+ #define MT7996_RRO_MAX_SESSION 1024
+ #define MT7996_RRO_WINDOW_MAX_LEN 1024
+ #define MT7996_RRO_ADDR_ELEM_LEN 128
+@@ -688,6 +689,9 @@ struct mt7996_dev {
+ struct work_struct work;
+ struct list_head poll_list;
+ spinlock_t lock;
++
++ struct list_head pg_addr_cache;
++ struct list_head pg_hash_head[MT7996_RRO_MSDU_PG_HASH_SIZE];
+ } wed_rro;
+
+ bool testmode_enable;
+@@ -744,7 +748,11 @@ struct mt7996_dev {
+ bool dump_tx_pkt:1;
+ bool dump_rx_pkt:1;
+ bool dump_rx_raw:1;
++ u8 dump_ple_txd;
+ u32 token_idx;
++ u32 rxd_read_cnt;
++ u32 txd_read_cnt;
++ u32 fid_idx;
+ } dbg;
+ const struct mt7996_dbg_reg_desc *dbg_reg;
+ #endif
+@@ -1288,6 +1296,10 @@ enum {
+ };
+
+ void mt7996_packet_log_to_host(struct mt7996_dev *dev, const void *data, int len, int type, int des_len);
++void mt7996_dump_bmac_rxd_info(struct mt7996_dev *dev, __le32 *rxd);
++void mt7996_dump_bmac_txd_info(struct seq_file *s, struct mt7996_dev *dev,
++ __le32 *txd, bool is_hif_txd, bool dump_txp);
++int mt7996_mtk_init_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
+ #endif
+
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mtk_debug_i.h b/mt7996/mtk_debug_i.h
+new file mode 100644
+index 00000000..d3756fa2
+--- /dev/null
++++ b/mt7996/mtk_debug_i.h
+@@ -0,0 +1,987 @@
++#ifndef __MTK_DEBUG_I_H
++#define __MTK_DEBUG_I_H
++
++#ifdef CONFIG_MTK_DEBUG
++
++// DW0
++#define WF_RX_DESCRIPTOR_RX_BYTE_COUNT_DW 0
++#define WF_RX_DESCRIPTOR_RX_BYTE_COUNT_ADDR 0
++#define WF_RX_DESCRIPTOR_RX_BYTE_COUNT_MASK 0x0000ffff // 15- 0
++#define WF_RX_DESCRIPTOR_RX_BYTE_COUNT_SHIFT 0
++#define WF_RX_DESCRIPTOR_PACKET_TYPE_DW 0
++#define WF_RX_DESCRIPTOR_PACKET_TYPE_ADDR 0
++#define WF_RX_DESCRIPTOR_PACKET_TYPE_MASK 0xf8000000 // 31-27
++#define WF_RX_DESCRIPTOR_PACKET_TYPE_SHIFT 27
++// DW1
++#define WF_RX_DESCRIPTOR_MLD_ID_DW 1
++#define WF_RX_DESCRIPTOR_MLD_ID_ADDR 4
++#define WF_RX_DESCRIPTOR_MLD_ID_MASK 0x00000fff // 11- 0
++#define WF_RX_DESCRIPTOR_MLD_ID_SHIFT 0
++#define WF_RX_DESCRIPTOR_GROUP_VLD_DW 1
++#define WF_RX_DESCRIPTOR_GROUP_VLD_ADDR 4
++#define WF_RX_DESCRIPTOR_GROUP_VLD_MASK 0x001f0000 // 20-16
++#define WF_RX_DESCRIPTOR_GROUP_VLD_SHIFT 16
++#define WF_RX_DESCRIPTOR_KID_DW 1
++#define WF_RX_DESCRIPTOR_KID_ADDR 4
++#define WF_RX_DESCRIPTOR_KID_MASK 0x00600000 // 22-21
++#define WF_RX_DESCRIPTOR_KID_SHIFT 21
++#define WF_RX_DESCRIPTOR_CM_DW 1
++#define WF_RX_DESCRIPTOR_CM_ADDR 4
++#define WF_RX_DESCRIPTOR_CM_MASK 0x00800000 // 23-23
++#define WF_RX_DESCRIPTOR_CM_SHIFT 23
++#define WF_RX_DESCRIPTOR_CLM_DW 1
++#define WF_RX_DESCRIPTOR_CLM_ADDR 4
++#define WF_RX_DESCRIPTOR_CLM_MASK 0x01000000 // 24-24
++#define WF_RX_DESCRIPTOR_CLM_SHIFT 24
++#define WF_RX_DESCRIPTOR_I_DW 1
++#define WF_RX_DESCRIPTOR_I_ADDR 4
++#define WF_RX_DESCRIPTOR_I_MASK 0x02000000 // 25-25
++#define WF_RX_DESCRIPTOR_I_SHIFT 25
++#define WF_RX_DESCRIPTOR_T_DW 1
++#define WF_RX_DESCRIPTOR_T_ADDR 4
++#define WF_RX_DESCRIPTOR_T_MASK 0x04000000 // 26-26
++#define WF_RX_DESCRIPTOR_T_SHIFT 26
++#define WF_RX_DESCRIPTOR_BN_DW 1
++#define WF_RX_DESCRIPTOR_BN_ADDR 4
++#define WF_RX_DESCRIPTOR_BN_MASK 0x18000000 // 28-27
++#define WF_RX_DESCRIPTOR_BN_SHIFT 27
++#define WF_RX_DESCRIPTOR_BIPN_FAIL_DW 1
++#define WF_RX_DESCRIPTOR_BIPN_FAIL_ADDR 4
++#define WF_RX_DESCRIPTOR_BIPN_FAIL_MASK 0x20000000 // 29-29
++#define WF_RX_DESCRIPTOR_BIPN_FAIL_SHIFT 29
++// DW2
++#define WF_RX_DESCRIPTOR_BSSID_DW 2
++#define WF_RX_DESCRIPTOR_BSSID_ADDR 8
++#define WF_RX_DESCRIPTOR_BSSID_MASK 0x0000003f // 5- 0
++#define WF_RX_DESCRIPTOR_BSSID_SHIFT 0
++#define WF_RX_DESCRIPTOR_H_DW 2
++#define WF_RX_DESCRIPTOR_H_ADDR 8
++#define WF_RX_DESCRIPTOR_H_MASK 0x00000080 // 7- 7
++#define WF_RX_DESCRIPTOR_H_SHIFT 7
++#define WF_RX_DESCRIPTOR_HEADER_LENGTH_DW 2
++#define WF_RX_DESCRIPTOR_HEADER_LENGTH_ADDR 8
++#define WF_RX_DESCRIPTOR_HEADER_LENGTH_MASK 0x00001f00 // 12- 8
++#define WF_RX_DESCRIPTOR_HEADER_LENGTH_SHIFT 8
++#define WF_RX_DESCRIPTOR_HO_DW 2
++#define WF_RX_DESCRIPTOR_HO_ADDR 8
++#define WF_RX_DESCRIPTOR_HO_MASK 0x0000e000 // 15-13
++#define WF_RX_DESCRIPTOR_HO_SHIFT 13
++#define WF_RX_DESCRIPTOR_SEC_MODE_DW 2
++#define WF_RX_DESCRIPTOR_SEC_MODE_ADDR 8
++#define WF_RX_DESCRIPTOR_SEC_MODE_MASK 0x001f0000 // 20-16
++#define WF_RX_DESCRIPTOR_SEC_MODE_SHIFT 16
++#define WF_RX_DESCRIPTOR_MUBAR_DW 2
++#define WF_RX_DESCRIPTOR_MUBAR_ADDR 8
++#define WF_RX_DESCRIPTOR_MUBAR_MASK 0x00200000 // 21-21
++#define WF_RX_DESCRIPTOR_MUBAR_SHIFT 21
++#define WF_RX_DESCRIPTOR_SWBIT_DW 2
++#define WF_RX_DESCRIPTOR_SWBIT_ADDR 8
++#define WF_RX_DESCRIPTOR_SWBIT_MASK 0x00400000 // 22-22
++#define WF_RX_DESCRIPTOR_SWBIT_SHIFT 22
++#define WF_RX_DESCRIPTOR_DAF_DW 2
++#define WF_RX_DESCRIPTOR_DAF_ADDR 8
++#define WF_RX_DESCRIPTOR_DAF_MASK 0x00800000 // 23-23
++#define WF_RX_DESCRIPTOR_DAF_SHIFT 23
++#define WF_RX_DESCRIPTOR_EL_DW 2
++#define WF_RX_DESCRIPTOR_EL_ADDR 8
++#define WF_RX_DESCRIPTOR_EL_MASK 0x01000000 // 24-24
++#define WF_RX_DESCRIPTOR_EL_SHIFT 24
++#define WF_RX_DESCRIPTOR_HTF_DW 2
++#define WF_RX_DESCRIPTOR_HTF_ADDR 8
++#define WF_RX_DESCRIPTOR_HTF_MASK 0x02000000 // 25-25
++#define WF_RX_DESCRIPTOR_HTF_SHIFT 25
++#define WF_RX_DESCRIPTOR_INTF_DW 2
++#define WF_RX_DESCRIPTOR_INTF_ADDR 8
++#define WF_RX_DESCRIPTOR_INTF_MASK 0x04000000 // 26-26
++#define WF_RX_DESCRIPTOR_INTF_SHIFT 26
++#define WF_RX_DESCRIPTOR_FRAG_DW 2
++#define WF_RX_DESCRIPTOR_FRAG_ADDR 8
++#define WF_RX_DESCRIPTOR_FRAG_MASK 0x08000000 // 27-27
++#define WF_RX_DESCRIPTOR_FRAG_SHIFT 27
++#define WF_RX_DESCRIPTOR_NUL_DW 2
++#define WF_RX_DESCRIPTOR_NUL_ADDR 8
++#define WF_RX_DESCRIPTOR_NUL_MASK 0x10000000 // 28-28
++#define WF_RX_DESCRIPTOR_NUL_SHIFT 28
++#define WF_RX_DESCRIPTOR_NDATA_DW 2
++#define WF_RX_DESCRIPTOR_NDATA_ADDR 8
++#define WF_RX_DESCRIPTOR_NDATA_MASK 0x20000000 // 29-29
++#define WF_RX_DESCRIPTOR_NDATA_SHIFT 29
++#define WF_RX_DESCRIPTOR_NAMP_DW 2
++#define WF_RX_DESCRIPTOR_NAMP_ADDR 8
++#define WF_RX_DESCRIPTOR_NAMP_MASK 0x40000000 // 30-30
++#define WF_RX_DESCRIPTOR_NAMP_SHIFT 30
++#define WF_RX_DESCRIPTOR_BF_RPT_DW 2
++#define WF_RX_DESCRIPTOR_BF_RPT_ADDR 8
++#define WF_RX_DESCRIPTOR_BF_RPT_MASK 0x80000000 // 31-31
++#define WF_RX_DESCRIPTOR_BF_RPT_SHIFT 31
++// DW3
++#define WF_RX_DESCRIPTOR_RXV_SN_DW 3
++#define WF_RX_DESCRIPTOR_RXV_SN_ADDR 12
++#define WF_RX_DESCRIPTOR_RXV_SN_MASK 0x000000ff // 7- 0
++#define WF_RX_DESCRIPTOR_RXV_SN_SHIFT 0
++#define WF_RX_DESCRIPTOR_CH_FREQUENCY_DW 3
++#define WF_RX_DESCRIPTOR_CH_FREQUENCY_ADDR 12
++#define WF_RX_DESCRIPTOR_CH_FREQUENCY_MASK 0x0000ff00 // 15- 8
++#define WF_RX_DESCRIPTOR_CH_FREQUENCY_SHIFT 8
++#define WF_RX_DESCRIPTOR_A1_TYPE_DW 3
++#define WF_RX_DESCRIPTOR_A1_TYPE_ADDR 12
++#define WF_RX_DESCRIPTOR_A1_TYPE_MASK 0x00030000 // 17-16
++#define WF_RX_DESCRIPTOR_A1_TYPE_SHIFT 16
++#define WF_RX_DESCRIPTOR_HTC_DW 3
++#define WF_RX_DESCRIPTOR_HTC_ADDR 12
++#define WF_RX_DESCRIPTOR_HTC_MASK 0x00040000 // 18-18
++#define WF_RX_DESCRIPTOR_HTC_SHIFT 18
++#define WF_RX_DESCRIPTOR_TCL_DW 3
++#define WF_RX_DESCRIPTOR_TCL_ADDR 12
++#define WF_RX_DESCRIPTOR_TCL_MASK 0x00080000 // 19-19
++#define WF_RX_DESCRIPTOR_TCL_SHIFT 19
++#define WF_RX_DESCRIPTOR_BBM_DW 3
++#define WF_RX_DESCRIPTOR_BBM_ADDR 12
++#define WF_RX_DESCRIPTOR_BBM_MASK 0x00100000 // 20-20
++#define WF_RX_DESCRIPTOR_BBM_SHIFT 20
++#define WF_RX_DESCRIPTOR_BU_DW 3
++#define WF_RX_DESCRIPTOR_BU_ADDR 12
++#define WF_RX_DESCRIPTOR_BU_MASK 0x00200000 // 21-21
++#define WF_RX_DESCRIPTOR_BU_SHIFT 21
++#define WF_RX_DESCRIPTOR_CO_ANT_DW 3
++#define WF_RX_DESCRIPTOR_CO_ANT_ADDR 12
++#define WF_RX_DESCRIPTOR_CO_ANT_MASK 0x00400000 // 22-22
++#define WF_RX_DESCRIPTOR_CO_ANT_SHIFT 22
++#define WF_RX_DESCRIPTOR_BF_CQI_DW 3
++#define WF_RX_DESCRIPTOR_BF_CQI_ADDR 12
++#define WF_RX_DESCRIPTOR_BF_CQI_MASK 0x00800000 // 23-23
++#define WF_RX_DESCRIPTOR_BF_CQI_SHIFT 23
++#define WF_RX_DESCRIPTOR_FC_DW 3
++#define WF_RX_DESCRIPTOR_FC_ADDR 12
++#define WF_RX_DESCRIPTOR_FC_MASK 0x01000000 // 24-24
++#define WF_RX_DESCRIPTOR_FC_SHIFT 24
++#define WF_RX_DESCRIPTOR_VLAN_DW 3
++#define WF_RX_DESCRIPTOR_VLAN_ADDR 12
++#define WF_RX_DESCRIPTOR_VLAN_MASK 0x80000000 // 31-31
++#define WF_RX_DESCRIPTOR_VLAN_SHIFT 31
++// DW4
++#define WF_RX_DESCRIPTOR_PF_DW 4
++#define WF_RX_DESCRIPTOR_PF_ADDR 16
++#define WF_RX_DESCRIPTOR_PF_MASK 0x00000003 // 1- 0
++#define WF_RX_DESCRIPTOR_PF_SHIFT 0
++#define WF_RX_DESCRIPTOR_MAC_DW 4
++#define WF_RX_DESCRIPTOR_MAC_ADDR 16
++#define WF_RX_DESCRIPTOR_MAC_MASK 0x00000004 // 2- 2
++#define WF_RX_DESCRIPTOR_MAC_SHIFT 2
++#define WF_RX_DESCRIPTOR_TID_DW 4
++#define WF_RX_DESCRIPTOR_TID_ADDR 16
++#define WF_RX_DESCRIPTOR_TID_MASK 0x00000078 // 6- 3
++#define WF_RX_DESCRIPTOR_TID_SHIFT 3
++#define WF_RX_DESCRIPTOR_ETHER_TYPE_OFFSET_DW 4
++#define WF_RX_DESCRIPTOR_ETHER_TYPE_OFFSET_ADDR 16
++#define WF_RX_DESCRIPTOR_ETHER_TYPE_OFFSET_MASK 0x00003f80 // 13- 7
++#define WF_RX_DESCRIPTOR_ETHER_TYPE_OFFSET_SHIFT 7
++#define WF_RX_DESCRIPTOR_IP_DW 4
++#define WF_RX_DESCRIPTOR_IP_ADDR 16
++#define WF_RX_DESCRIPTOR_IP_MASK 0x00004000 // 14-14
++#define WF_RX_DESCRIPTOR_IP_SHIFT 14
++#define WF_RX_DESCRIPTOR_UT_DW 4
++#define WF_RX_DESCRIPTOR_UT_ADDR 16
++#define WF_RX_DESCRIPTOR_UT_MASK 0x00008000 // 15-15
++#define WF_RX_DESCRIPTOR_UT_SHIFT 15
++#define WF_RX_DESCRIPTOR_PSE_FID_DW 4
++#define WF_RX_DESCRIPTOR_PSE_FID_ADDR 16
++#define WF_RX_DESCRIPTOR_PSE_FID_MASK 0x0fff0000 // 27-16
++#define WF_RX_DESCRIPTOR_PSE_FID_SHIFT 16
++// DW5
++// DW6
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_31_0__DW 6
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_31_0__ADDR 24
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_31_0__MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_31_0__SHIFT 0
++// DW7
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_33_32__DW 7
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_33_32__ADDR 28
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_33_32__MASK 0x00000003 // 1- 0
++#define WF_RX_DESCRIPTOR_CLS_BITMAP_33_32__SHIFT 0
++#define WF_RX_DESCRIPTOR_DP_DW 7
++#define WF_RX_DESCRIPTOR_DP_ADDR 28
++#define WF_RX_DESCRIPTOR_DP_MASK 0x00080000 // 19-19
++#define WF_RX_DESCRIPTOR_DP_SHIFT 19
++#define WF_RX_DESCRIPTOR_CLS_DW 7
++#define WF_RX_DESCRIPTOR_CLS_ADDR 28
++#define WF_RX_DESCRIPTOR_CLS_MASK 0x00100000 // 20-20
++#define WF_RX_DESCRIPTOR_CLS_SHIFT 20
++#define WF_RX_DESCRIPTOR_OFLD_DW 7
++#define WF_RX_DESCRIPTOR_OFLD_ADDR 28
++#define WF_RX_DESCRIPTOR_OFLD_MASK 0x00600000 // 22-21
++#define WF_RX_DESCRIPTOR_OFLD_SHIFT 21
++#define WF_RX_DESCRIPTOR_MGC_DW 7
++#define WF_RX_DESCRIPTOR_MGC_ADDR 28
++#define WF_RX_DESCRIPTOR_MGC_MASK 0x00800000 // 23-23
++#define WF_RX_DESCRIPTOR_MGC_SHIFT 23
++#define WF_RX_DESCRIPTOR_WOL_DW 7
++#define WF_RX_DESCRIPTOR_WOL_ADDR 28
++#define WF_RX_DESCRIPTOR_WOL_MASK 0x1f000000 // 28-24
++#define WF_RX_DESCRIPTOR_WOL_SHIFT 24
++#define WF_RX_DESCRIPTOR_PF_MODE_DW 7
++#define WF_RX_DESCRIPTOR_PF_MODE_ADDR 28
++#define WF_RX_DESCRIPTOR_PF_MODE_MASK 0x20000000 // 29-29
++#define WF_RX_DESCRIPTOR_PF_MODE_SHIFT 29
++#define WF_RX_DESCRIPTOR_PF_STS_DW 7
++#define WF_RX_DESCRIPTOR_PF_STS_ADDR 28
++#define WF_RX_DESCRIPTOR_PF_STS_MASK 0xc0000000 // 31-30
++#define WF_RX_DESCRIPTOR_PF_STS_SHIFT 30
++// DW8
++#define WF_RX_DESCRIPTOR_FRAME_CONTROL_FIELD_DW 8
++#define WF_RX_DESCRIPTOR_FRAME_CONTROL_FIELD_ADDR 32
++#define WF_RX_DESCRIPTOR_FRAME_CONTROL_FIELD_MASK 0x0000ffff // 15- 0
++#define WF_RX_DESCRIPTOR_FRAME_CONTROL_FIELD_SHIFT 0
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_15_0__DW 8
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_15_0__ADDR 32
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_15_0__MASK 0xffff0000 // 31-16
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_15_0__SHIFT 16
++// DW9
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_47_16__DW 9
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_47_16__ADDR 36
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_47_16__MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_47_16__SHIFT 0
++// DW10
++#define WF_RX_DESCRIPTOR_FRAGMENT_NUMBER_DW 10
++#define WF_RX_DESCRIPTOR_FRAGMENT_NUMBER_ADDR 40
++#define WF_RX_DESCRIPTOR_FRAGMENT_NUMBER_MASK 0x0000000f // 3- 0
++#define WF_RX_DESCRIPTOR_FRAGMENT_NUMBER_SHIFT 0
++#define WF_RX_DESCRIPTOR_SEQUENCE_NUMBER_DW 10
++#define WF_RX_DESCRIPTOR_SEQUENCE_NUMBER_ADDR 40
++#define WF_RX_DESCRIPTOR_SEQUENCE_NUMBER_MASK 0x0000fff0 // 15- 4
++#define WF_RX_DESCRIPTOR_SEQUENCE_NUMBER_SHIFT 4
++#define WF_RX_DESCRIPTOR_QOS_CONTROL_FIELD_DW 10
++#define WF_RX_DESCRIPTOR_QOS_CONTROL_FIELD_ADDR 40
++#define WF_RX_DESCRIPTOR_QOS_CONTROL_FIELD_MASK 0xffff0000 // 31-16
++#define WF_RX_DESCRIPTOR_QOS_CONTROL_FIELD_SHIFT 16
++// DW11
++#define WF_RX_DESCRIPTOR_HT_CONTROL_FIELD_DW 11
++#define WF_RX_DESCRIPTOR_HT_CONTROL_FIELD_ADDR 44
++#define WF_RX_DESCRIPTOR_HT_CONTROL_FIELD_MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_HT_CONTROL_FIELD_SHIFT 0
++// DW12
++#define WF_RX_DESCRIPTOR_PN_31_0__DW 12
++#define WF_RX_DESCRIPTOR_PN_31_0__ADDR 48
++#define WF_RX_DESCRIPTOR_PN_31_0__MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_PN_31_0__SHIFT 0
++// DW13
++#define WF_RX_DESCRIPTOR_PN_63_32__DW 13
++#define WF_RX_DESCRIPTOR_PN_63_32__ADDR 52
++#define WF_RX_DESCRIPTOR_PN_63_32__MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_PN_63_32__SHIFT 0
++// DW14
++#define WF_RX_DESCRIPTOR_PN_95_64__DW 14
++#define WF_RX_DESCRIPTOR_PN_95_64__ADDR 56
++#define WF_RX_DESCRIPTOR_PN_95_64__MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_PN_95_64__SHIFT 0
++// DW15
++#define WF_RX_DESCRIPTOR_PN_127_96__DW 15
++#define WF_RX_DESCRIPTOR_PN_127_96__ADDR 60
++#define WF_RX_DESCRIPTOR_PN_127_96__MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_PN_127_96__SHIFT 0
++// DW16
++#define WF_RX_DESCRIPTOR_TIMESTAMP_DW 16
++#define WF_RX_DESCRIPTOR_TIMESTAMP_ADDR 64
++#define WF_RX_DESCRIPTOR_TIMESTAMP_MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_TIMESTAMP_SHIFT 0
++// DW17
++#define WF_RX_DESCRIPTOR_CRC_DW 17
++#define WF_RX_DESCRIPTOR_CRC_ADDR 68
++#define WF_RX_DESCRIPTOR_CRC_MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_CRC_SHIFT 0
++// DW18
++// DW19
++// DW20
++#define WF_RX_DESCRIPTOR_P_RXV_DW 20
++#define WF_RX_DESCRIPTOR_P_RXV_ADDR 80
++#define WF_RX_DESCRIPTOR_P_RXV_MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_P_RXV_SHIFT 0
++// DW21
++// DO NOT process repeat field(p_rxv)
++// DW22
++#define WF_RX_DESCRIPTOR_DBW_DW 22
++#define WF_RX_DESCRIPTOR_DBW_ADDR 88
++#define WF_RX_DESCRIPTOR_DBW_MASK 0x00000007 // 2- 0
++#define WF_RX_DESCRIPTOR_DBW_SHIFT 0
++#define WF_RX_DESCRIPTOR_GI_DW 22
++#define WF_RX_DESCRIPTOR_GI_ADDR 88
++#define WF_RX_DESCRIPTOR_GI_MASK 0x00000018 // 4- 3
++#define WF_RX_DESCRIPTOR_GI_SHIFT 3
++#define WF_RX_DESCRIPTOR_DCM_DW 22
++#define WF_RX_DESCRIPTOR_DCM_ADDR 88
++#define WF_RX_DESCRIPTOR_DCM_MASK 0x00000020 // 5- 5
++#define WF_RX_DESCRIPTOR_DCM_SHIFT 5
++#define WF_RX_DESCRIPTOR_NUM_RX_DW 22
++#define WF_RX_DESCRIPTOR_NUM_RX_ADDR 88
++#define WF_RX_DESCRIPTOR_NUM_RX_MASK 0x000001c0 // 8- 6
++#define WF_RX_DESCRIPTOR_NUM_RX_SHIFT 6
++#define WF_RX_DESCRIPTOR_STBC_DW 22
++#define WF_RX_DESCRIPTOR_STBC_ADDR 88
++#define WF_RX_DESCRIPTOR_STBC_MASK 0x00000600 // 10- 9
++#define WF_RX_DESCRIPTOR_STBC_SHIFT 9
++#define WF_RX_DESCRIPTOR_TX_MODE_DW 22
++#define WF_RX_DESCRIPTOR_TX_MODE_ADDR 88
++#define WF_RX_DESCRIPTOR_TX_MODE_MASK 0x00007800 // 14-11
++#define WF_RX_DESCRIPTOR_TX_MODE_SHIFT 11
++// DW23
++#define WF_RX_DESCRIPTOR_RCPI_DW 23
++#define WF_RX_DESCRIPTOR_RCPI_ADDR 92
++#define WF_RX_DESCRIPTOR_RCPI_MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_RCPI_SHIFT 0
++// DW24
++#define WF_RX_DESCRIPTOR_C_RXV_DW 24
++#define WF_RX_DESCRIPTOR_C_RXV_ADDR 96
++#define WF_RX_DESCRIPTOR_C_RXV_MASK 0xffffffff // 31- 0
++#define WF_RX_DESCRIPTOR_C_RXV_SHIFT 0
++// DW25
++// DO NOT process repeat field(c_rxv)
++// DW26
++// DO NOT process repeat field(c_rxv)
++// DW27
++// DO NOT process repeat field(c_rxv)
++// DW28
++// DO NOT process repeat field(c_rxv)
++// DW29
++// DO NOT process repeat field(c_rxv)
++// DW30
++// DO NOT process repeat field(c_rxv)
++// DW31
++// DO NOT process repeat field(c_rxv)
++// DW32
++// DO NOT process repeat field(c_rxv)
++// DW33
++// DO NOT process repeat field(c_rxv)
++// DW34
++// DO NOT process repeat field(c_rxv)
++// DW35
++// DO NOT process repeat field(c_rxv)
++// DW36
++// DO NOT process repeat field(c_rxv)
++// DW37
++// DO NOT process repeat field(c_rxv)
++// DW38
++// DO NOT process repeat field(c_rxv)
++// DW39
++// DO NOT process repeat field(c_rxv)
++// DW40
++// DO NOT process repeat field(c_rxv)
++// DW41
++// DO NOT process repeat field(c_rxv)
++// DW42
++// DO NOT process repeat field(c_rxv)
++// DW43
++// DO NOT process repeat field(c_rxv)
++// DW44
++// DO NOT process repeat field(c_rxv)
++// DW45
++// DO NOT process repeat field(c_rxv)
++// DW46
++// DW47
++
++/* TXD */
++// DW0
++#define WF_TX_DESCRIPTOR_TX_BYTE_COUNT_DW 0
++#define WF_TX_DESCRIPTOR_TX_BYTE_COUNT_ADDR 0
++#define WF_TX_DESCRIPTOR_TX_BYTE_COUNT_MASK 0x0000ffff // 15- 0
++#define WF_TX_DESCRIPTOR_TX_BYTE_COUNT_SHIFT 0
++#define WF_TX_DESCRIPTOR_ETHER_TYPE_OFFSET_DW 0
++#define WF_TX_DESCRIPTOR_ETHER_TYPE_OFFSET_ADDR 0
++#define WF_TX_DESCRIPTOR_ETHER_TYPE_OFFSET_MASK 0x007f0000 // 22-16
++#define WF_TX_DESCRIPTOR_ETHER_TYPE_OFFSET_SHIFT 16
++#define WF_TX_DESCRIPTOR_PKT_FT_DW 0
++#define WF_TX_DESCRIPTOR_PKT_FT_ADDR 0
++#define WF_TX_DESCRIPTOR_PKT_FT_MASK 0x01800000 // 24-23
++#define WF_TX_DESCRIPTOR_PKT_FT_SHIFT 23
++#define WF_TX_DESCRIPTOR_Q_IDX_DW 0
++#define WF_TX_DESCRIPTOR_Q_IDX_ADDR 0
++#define WF_TX_DESCRIPTOR_Q_IDX_MASK 0xfe000000 // 31-25
++#define WF_TX_DESCRIPTOR_Q_IDX_SHIFT 25
++// DW1
++#define WF_TX_DESCRIPTOR_MLD_ID_DW 1
++#define WF_TX_DESCRIPTOR_MLD_ID_ADDR 4
++#define WF_TX_DESCRIPTOR_MLD_ID_MASK 0x00000fff // 11- 0
++#define WF_TX_DESCRIPTOR_MLD_ID_SHIFT 0
++#define WF_TX_DESCRIPTOR_TGID_DW 1
++#define WF_TX_DESCRIPTOR_TGID_ADDR 4
++#define WF_TX_DESCRIPTOR_TGID_MASK 0x00003000 // 13-12
++#define WF_TX_DESCRIPTOR_TGID_SHIFT 12
++#define WF_TX_DESCRIPTOR_HF_DW 1
++#define WF_TX_DESCRIPTOR_HF_ADDR 4
++#define WF_TX_DESCRIPTOR_HF_MASK 0x0000c000 // 15-14
++#define WF_TX_DESCRIPTOR_HF_SHIFT 14
++#define WF_TX_DESCRIPTOR_HEADER_LENGTH_DW 1
++#define WF_TX_DESCRIPTOR_HEADER_LENGTH_ADDR 4
++#define WF_TX_DESCRIPTOR_HEADER_LENGTH_MASK 0x001f0000 // 20-16
++#define WF_TX_DESCRIPTOR_HEADER_LENGTH_SHIFT 16
++#define WF_TX_DESCRIPTOR_MRD_DW 1
++#define WF_TX_DESCRIPTOR_MRD_ADDR 4
++#define WF_TX_DESCRIPTOR_MRD_MASK 0x00010000 // 16-16
++#define WF_TX_DESCRIPTOR_MRD_SHIFT 16
++#define WF_TX_DESCRIPTOR_EOSP_DW 1
++#define WF_TX_DESCRIPTOR_EOSP_ADDR 4
++#define WF_TX_DESCRIPTOR_EOSP_MASK 0x00020000 // 17-17
++#define WF_TX_DESCRIPTOR_EOSP_SHIFT 17
++#define WF_TX_DESCRIPTOR_EOSP_DW 1
++#define WF_TX_DESCRIPTOR_EOSP_ADDR 4
++#define WF_TX_DESCRIPTOR_EOSP_MASK 0x00020000 // 17-17
++#define WF_TX_DESCRIPTOR_EOSP_SHIFT 17
++#define WF_TX_DESCRIPTOR_AMS_DW 1
++#define WF_TX_DESCRIPTOR_AMS_ADDR 4
++#define WF_TX_DESCRIPTOR_AMS_MASK 0x00040000 // 18-18
++#define WF_TX_DESCRIPTOR_AMS_SHIFT 18
++#define WF_TX_DESCRIPTOR_RMVL_DW 1
++#define WF_TX_DESCRIPTOR_RMVL_ADDR 4
++#define WF_TX_DESCRIPTOR_RMVL_MASK 0x00040000 // 18-18
++#define WF_TX_DESCRIPTOR_RMVL_SHIFT 18
++#define WF_TX_DESCRIPTOR_VLAN_DW 1
++#define WF_TX_DESCRIPTOR_VLAN_ADDR 4
++#define WF_TX_DESCRIPTOR_VLAN_MASK 0x00080000 // 19-19
++#define WF_TX_DESCRIPTOR_VLAN_SHIFT 19
++#define WF_TX_DESCRIPTOR_ETYP_DW 1
++#define WF_TX_DESCRIPTOR_ETYP_ADDR 4
++#define WF_TX_DESCRIPTOR_ETYP_MASK 0x00100000 // 20-20
++#define WF_TX_DESCRIPTOR_ETYP_SHIFT 20
++#define WF_TX_DESCRIPTOR_TID_MGMT_TYPE_DW 1
++#define WF_TX_DESCRIPTOR_TID_MGMT_TYPE_ADDR 4
++#define WF_TX_DESCRIPTOR_TID_MGMT_TYPE_MASK 0x01e00000 // 24-21
++#define WF_TX_DESCRIPTOR_TID_MGMT_TYPE_SHIFT 21
++#define WF_TX_DESCRIPTOR_OM_DW 1
++#define WF_TX_DESCRIPTOR_OM_ADDR 4
++#define WF_TX_DESCRIPTOR_OM_MASK 0x7e000000 // 30-25
++#define WF_TX_DESCRIPTOR_OM_SHIFT 25
++#define WF_TX_DESCRIPTOR_FR_DW 1
++#define WF_TX_DESCRIPTOR_FR_ADDR 4
++#define WF_TX_DESCRIPTOR_FR_MASK 0x80000000 // 31-31
++#define WF_TX_DESCRIPTOR_FR_SHIFT 31
++// DW2
++#define WF_TX_DESCRIPTOR_SUBTYPE_DW 2
++#define WF_TX_DESCRIPTOR_SUBTYPE_ADDR 8
++#define WF_TX_DESCRIPTOR_SUBTYPE_MASK 0x0000000f // 3- 0
++#define WF_TX_DESCRIPTOR_SUBTYPE_SHIFT 0
++#define WF_TX_DESCRIPTOR_FTYPE_DW 2
++#define WF_TX_DESCRIPTOR_FTYPE_ADDR 8
++#define WF_TX_DESCRIPTOR_FTYPE_MASK 0x00000030 // 5- 4
++#define WF_TX_DESCRIPTOR_FTYPE_SHIFT 4
++#define WF_TX_DESCRIPTOR_BF_TYPE_DW 2
++#define WF_TX_DESCRIPTOR_BF_TYPE_ADDR 8
++#define WF_TX_DESCRIPTOR_BF_TYPE_MASK 0x000000c0 // 7- 6
++#define WF_TX_DESCRIPTOR_BF_TYPE_SHIFT 6
++#define WF_TX_DESCRIPTOR_OM_MAP_DW 2
++#define WF_TX_DESCRIPTOR_OM_MAP_ADDR 8
++#define WF_TX_DESCRIPTOR_OM_MAP_MASK 0x00000100 // 8- 8
++#define WF_TX_DESCRIPTOR_OM_MAP_SHIFT 8
++#define WF_TX_DESCRIPTOR_RTS_DW 2
++#define WF_TX_DESCRIPTOR_RTS_ADDR 8
++#define WF_TX_DESCRIPTOR_RTS_MASK 0x00000200 // 9- 9
++#define WF_TX_DESCRIPTOR_RTS_SHIFT 9
++#define WF_TX_DESCRIPTOR_HEADER_PADDING_DW 2
++#define WF_TX_DESCRIPTOR_HEADER_PADDING_ADDR 8
++#define WF_TX_DESCRIPTOR_HEADER_PADDING_MASK 0x00000c00 // 11-10
++#define WF_TX_DESCRIPTOR_HEADER_PADDING_SHIFT 10
++#define WF_TX_DESCRIPTOR_DU_DW 2
++#define WF_TX_DESCRIPTOR_DU_ADDR 8
++#define WF_TX_DESCRIPTOR_DU_MASK 0x00001000 // 12-12
++#define WF_TX_DESCRIPTOR_DU_SHIFT 12
++#define WF_TX_DESCRIPTOR_HE_DW 2
++#define WF_TX_DESCRIPTOR_HE_ADDR 8
++#define WF_TX_DESCRIPTOR_HE_MASK 0x00002000 // 13-13
++#define WF_TX_DESCRIPTOR_HE_SHIFT 13
++#define WF_TX_DESCRIPTOR_FRAG_DW 2
++#define WF_TX_DESCRIPTOR_FRAG_ADDR 8
++#define WF_TX_DESCRIPTOR_FRAG_MASK 0x0000c000 // 15-14
++#define WF_TX_DESCRIPTOR_FRAG_SHIFT 14
++#define WF_TX_DESCRIPTOR_REMAINING_TX_TIME_DW 2
++#define WF_TX_DESCRIPTOR_REMAINING_TX_TIME_ADDR 8
++#define WF_TX_DESCRIPTOR_REMAINING_TX_TIME_MASK 0x03ff0000 // 25-16
++#define WF_TX_DESCRIPTOR_REMAINING_TX_TIME_SHIFT 16
++#define WF_TX_DESCRIPTOR_POWER_OFFSET_DW 2
++#define WF_TX_DESCRIPTOR_POWER_OFFSET_ADDR 8
++#define WF_TX_DESCRIPTOR_POWER_OFFSET_MASK 0xfc000000 // 31-26
++#define WF_TX_DESCRIPTOR_POWER_OFFSET_SHIFT 26
++// DW3
++#define WF_TX_DESCRIPTOR_NA_DW 3
++#define WF_TX_DESCRIPTOR_NA_ADDR 12
++#define WF_TX_DESCRIPTOR_NA_MASK 0x00000001 // 0- 0
++#define WF_TX_DESCRIPTOR_NA_SHIFT 0
++#define WF_TX_DESCRIPTOR_PF_DW 3
++#define WF_TX_DESCRIPTOR_PF_ADDR 12
++#define WF_TX_DESCRIPTOR_PF_MASK 0x00000002 // 1- 1
++#define WF_TX_DESCRIPTOR_PF_SHIFT 1
++#define WF_TX_DESCRIPTOR_EMRD_DW 3
++#define WF_TX_DESCRIPTOR_EMRD_ADDR 12
++#define WF_TX_DESCRIPTOR_EMRD_MASK 0x00000004 // 2- 2
++#define WF_TX_DESCRIPTOR_EMRD_SHIFT 2
++#define WF_TX_DESCRIPTOR_EEOSP_DW 3
++#define WF_TX_DESCRIPTOR_EEOSP_ADDR 12
++#define WF_TX_DESCRIPTOR_EEOSP_MASK 0x00000008 // 3- 3
++#define WF_TX_DESCRIPTOR_EEOSP_SHIFT 3
++#define WF_TX_DESCRIPTOR_BM_DW 3
++#define WF_TX_DESCRIPTOR_BM_ADDR 12
++#define WF_TX_DESCRIPTOR_BM_MASK 0x00000010 // 4- 4
++#define WF_TX_DESCRIPTOR_BM_SHIFT 4
++#define WF_TX_DESCRIPTOR_HW_AMSDU_CAP_DW 3
++#define WF_TX_DESCRIPTOR_HW_AMSDU_CAP_ADDR 12
++#define WF_TX_DESCRIPTOR_HW_AMSDU_CAP_MASK 0x00000020 // 5- 5
++#define WF_TX_DESCRIPTOR_HW_AMSDU_CAP_SHIFT 5
++#define WF_TX_DESCRIPTOR_TX_COUNT_DW 3
++#define WF_TX_DESCRIPTOR_TX_COUNT_ADDR 12
++#define WF_TX_DESCRIPTOR_TX_COUNT_MASK 0x000007c0 // 10- 6
++#define WF_TX_DESCRIPTOR_TX_COUNT_SHIFT 6
++#define WF_TX_DESCRIPTOR_REMAINING_TX_COUNT_DW 3
++#define WF_TX_DESCRIPTOR_REMAINING_TX_COUNT_ADDR 12
++#define WF_TX_DESCRIPTOR_REMAINING_TX_COUNT_MASK 0x0000f800 // 15-11
++#define WF_TX_DESCRIPTOR_REMAINING_TX_COUNT_SHIFT 11
++#define WF_TX_DESCRIPTOR_SN_DW 3
++#define WF_TX_DESCRIPTOR_SN_ADDR 12
++#define WF_TX_DESCRIPTOR_SN_MASK 0x0fff0000 // 27-16
++#define WF_TX_DESCRIPTOR_SN_SHIFT 16
++#define WF_TX_DESCRIPTOR_BA_DIS_DW 3
++#define WF_TX_DESCRIPTOR_BA_DIS_ADDR 12
++#define WF_TX_DESCRIPTOR_BA_DIS_MASK 0x10000000 // 28-28
++#define WF_TX_DESCRIPTOR_BA_DIS_SHIFT 28
++#define WF_TX_DESCRIPTOR_PM_DW 3
++#define WF_TX_DESCRIPTOR_PM_ADDR 12
++#define WF_TX_DESCRIPTOR_PM_MASK 0x20000000 // 29-29
++#define WF_TX_DESCRIPTOR_PM_SHIFT 29
++#define WF_TX_DESCRIPTOR_PN_VLD_DW 3
++#define WF_TX_DESCRIPTOR_PN_VLD_ADDR 12
++#define WF_TX_DESCRIPTOR_PN_VLD_MASK 0x40000000 // 30-30
++#define WF_TX_DESCRIPTOR_PN_VLD_SHIFT 30
++#define WF_TX_DESCRIPTOR_SN_VLD_DW 3
++#define WF_TX_DESCRIPTOR_SN_VLD_ADDR 12
++#define WF_TX_DESCRIPTOR_SN_VLD_MASK 0x80000000 // 31-31
++#define WF_TX_DESCRIPTOR_SN_VLD_SHIFT 31
++// DW4
++#define WF_TX_DESCRIPTOR_PN_31_0__DW 4
++#define WF_TX_DESCRIPTOR_PN_31_0__ADDR 16
++#define WF_TX_DESCRIPTOR_PN_31_0__MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_PN_31_0__SHIFT 0
++// DW5
++#define WF_TX_DESCRIPTOR_PID_DW 5
++#define WF_TX_DESCRIPTOR_PID_ADDR 20
++#define WF_TX_DESCRIPTOR_PID_MASK 0x000000ff // 7- 0
++#define WF_TX_DESCRIPTOR_PID_SHIFT 0
++#define WF_TX_DESCRIPTOR_TXSFM_DW 5
++#define WF_TX_DESCRIPTOR_TXSFM_ADDR 20
++#define WF_TX_DESCRIPTOR_TXSFM_MASK 0x00000100 // 8- 8
++#define WF_TX_DESCRIPTOR_TXSFM_SHIFT 8
++#define WF_TX_DESCRIPTOR_TXS2M_DW 5
++#define WF_TX_DESCRIPTOR_TXS2M_ADDR 20
++#define WF_TX_DESCRIPTOR_TXS2M_MASK 0x00000200 // 9- 9
++#define WF_TX_DESCRIPTOR_TXS2M_SHIFT 9
++#define WF_TX_DESCRIPTOR_TXS2H_DW 5
++#define WF_TX_DESCRIPTOR_TXS2H_ADDR 20
++#define WF_TX_DESCRIPTOR_TXS2H_MASK 0x00000400 // 10-10
++#define WF_TX_DESCRIPTOR_TXS2H_SHIFT 10
++#define WF_TX_DESCRIPTOR_FBCZ_DW 5
++#define WF_TX_DESCRIPTOR_FBCZ_ADDR 20
++#define WF_TX_DESCRIPTOR_FBCZ_MASK 0x00001000 // 12-12
++#define WF_TX_DESCRIPTOR_FBCZ_SHIFT 12
++#define WF_TX_DESCRIPTOR_BYPASS_RBB_DW 5
++#define WF_TX_DESCRIPTOR_BYPASS_RBB_ADDR 20
++#define WF_TX_DESCRIPTOR_BYPASS_RBB_MASK 0x00002000 // 13-13
++#define WF_TX_DESCRIPTOR_BYPASS_RBB_SHIFT 13
++#define WF_TX_DESCRIPTOR_BYPASS_TBB_DW 5
++#define WF_TX_DESCRIPTOR_BYPASS_TBB_ADDR 20
++#define WF_TX_DESCRIPTOR_BYPASS_TBB_MASK 0x00004000 // 14-14
++#define WF_TX_DESCRIPTOR_BYPASS_TBB_SHIFT 14
++#define WF_TX_DESCRIPTOR_FL_DW 5
++#define WF_TX_DESCRIPTOR_FL_ADDR 20
++#define WF_TX_DESCRIPTOR_FL_MASK 0x00008000 // 15-15
++#define WF_TX_DESCRIPTOR_FL_SHIFT 15
++#define WF_TX_DESCRIPTOR_PN_47_32__DW 5
++#define WF_TX_DESCRIPTOR_PN_47_32__ADDR 20
++#define WF_TX_DESCRIPTOR_PN_47_32__MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_PN_47_32__SHIFT 16
++// DW6
++#define WF_TX_DESCRIPTOR_AMSDU_CAP_UTXB_DW 6
++#define WF_TX_DESCRIPTOR_AMSDU_CAP_UTXB_ADDR 24
++#define WF_TX_DESCRIPTOR_AMSDU_CAP_UTXB_MASK 0x00000002 // 1- 1
++#define WF_TX_DESCRIPTOR_AMSDU_CAP_UTXB_SHIFT 1
++#define WF_TX_DESCRIPTOR_DAS_DW 6
++#define WF_TX_DESCRIPTOR_DAS_ADDR 24
++#define WF_TX_DESCRIPTOR_DAS_MASK 0x00000004 // 2- 2
++#define WF_TX_DESCRIPTOR_DAS_SHIFT 2
++#define WF_TX_DESCRIPTOR_DIS_MAT_DW 6
++#define WF_TX_DESCRIPTOR_DIS_MAT_ADDR 24
++#define WF_TX_DESCRIPTOR_DIS_MAT_MASK 0x00000008 // 3- 3
++#define WF_TX_DESCRIPTOR_DIS_MAT_SHIFT 3
++#define WF_TX_DESCRIPTOR_MSDU_COUNT_DW 6
++#define WF_TX_DESCRIPTOR_MSDU_COUNT_ADDR 24
++#define WF_TX_DESCRIPTOR_MSDU_COUNT_MASK 0x000003f0 // 9- 4
++#define WF_TX_DESCRIPTOR_MSDU_COUNT_SHIFT 4
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_IDX_DW 6
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_IDX_ADDR 24
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_IDX_MASK 0x00007c00 // 14-10
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_IDX_SHIFT 10
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_EN_DW 6
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_EN_ADDR 24
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_EN_MASK 0x00008000 // 15-15
++#define WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_EN_SHIFT 15
++#define WF_TX_DESCRIPTOR_FIXED_RATE_IDX_DW 6
++#define WF_TX_DESCRIPTOR_FIXED_RATE_IDX_ADDR 24
++#define WF_TX_DESCRIPTOR_FIXED_RATE_IDX_MASK 0x003f0000 // 21-16
++#define WF_TX_DESCRIPTOR_FIXED_RATE_IDX_SHIFT 16
++#define WF_TX_DESCRIPTOR_BW_DW 6
++#define WF_TX_DESCRIPTOR_BW_ADDR 24
++#define WF_TX_DESCRIPTOR_BW_MASK 0x03c00000 // 25-22
++#define WF_TX_DESCRIPTOR_BW_SHIFT 22
++#define WF_TX_DESCRIPTOR_VTA_DW 6
++#define WF_TX_DESCRIPTOR_VTA_ADDR 24
++#define WF_TX_DESCRIPTOR_VTA_MASK 0x10000000 // 28-28
++#define WF_TX_DESCRIPTOR_VTA_SHIFT 28
++#define WF_TX_DESCRIPTOR_SRC_DW 6
++#define WF_TX_DESCRIPTOR_SRC_ADDR 24
++#define WF_TX_DESCRIPTOR_SRC_MASK 0xc0000000 // 31-30
++#define WF_TX_DESCRIPTOR_SRC_SHIFT 30
++// DW7
++#define WF_TX_DESCRIPTOR_SW_TX_TIME_DW 7
++#define WF_TX_DESCRIPTOR_SW_TX_TIME_ADDR 28
++#define WF_TX_DESCRIPTOR_SW_TX_TIME_MASK 0x000003ff // 9- 0
++#define WF_TX_DESCRIPTOR_SW_TX_TIME_SHIFT 0
++#define WF_TX_DESCRIPTOR_UT_DW 7
++#define WF_TX_DESCRIPTOR_UT_ADDR 28
++#define WF_TX_DESCRIPTOR_UT_MASK 0x00008000 // 15-15
++#define WF_TX_DESCRIPTOR_UT_SHIFT 15
++#define WF_TX_DESCRIPTOR_CTXD_CNT_DW 7
++#define WF_TX_DESCRIPTOR_CTXD_CNT_ADDR 28
++#define WF_TX_DESCRIPTOR_CTXD_CNT_MASK 0x03c00000 // 25-22
++#define WF_TX_DESCRIPTOR_CTXD_CNT_SHIFT 22
++#define WF_TX_DESCRIPTOR_CTXD_DW 7
++#define WF_TX_DESCRIPTOR_CTXD_ADDR 28
++#define WF_TX_DESCRIPTOR_CTXD_MASK 0x04000000 // 26-26
++#define WF_TX_DESCRIPTOR_CTXD_SHIFT 26
++#define WF_TX_DESCRIPTOR_HM_DW 7
++#define WF_TX_DESCRIPTOR_HM_ADDR 28
++#define WF_TX_DESCRIPTOR_HM_MASK 0x08000000 // 27-27
++#define WF_TX_DESCRIPTOR_HM_SHIFT 27
++#define WF_TX_DESCRIPTOR_DP_DW 7
++#define WF_TX_DESCRIPTOR_DP_ADDR 28
++#define WF_TX_DESCRIPTOR_DP_MASK 0x10000000 // 28-28
++#define WF_TX_DESCRIPTOR_DP_SHIFT 28
++#define WF_TX_DESCRIPTOR_IP_DW 7
++#define WF_TX_DESCRIPTOR_IP_ADDR 28
++#define WF_TX_DESCRIPTOR_IP_MASK 0x20000000 // 29-29
++#define WF_TX_DESCRIPTOR_IP_SHIFT 29
++#define WF_TX_DESCRIPTOR_TXD_LEN_DW 7
++#define WF_TX_DESCRIPTOR_TXD_LEN_ADDR 28
++#define WF_TX_DESCRIPTOR_TXD_LEN_MASK 0xc0000000 // 31-30
++#define WF_TX_DESCRIPTOR_TXD_LEN_SHIFT 30
++// DW8
++#define WF_TX_DESCRIPTOR_MSDU0_DW 8
++#define WF_TX_DESCRIPTOR_MSDU0_ADDR 32
++#define WF_TX_DESCRIPTOR_MSDU0_MASK 0x0000ffff // 15- 0
++#define WF_TX_DESCRIPTOR_MSDU0_SHIFT 0
++#define WF_TX_DESCRIPTOR_MSDU1_DW 8
++#define WF_TX_DESCRIPTOR_MSDU1_ADDR 32
++#define WF_TX_DESCRIPTOR_MSDU1_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_MSDU1_SHIFT 16
++// DW9
++#define WF_TX_DESCRIPTOR_MSDU2_DW 9
++#define WF_TX_DESCRIPTOR_MSDU2_ADDR 36
++#define WF_TX_DESCRIPTOR_MSDU2_MASK 0x0000ffff // 15- 0
++#define WF_TX_DESCRIPTOR_MSDU2_SHIFT 0
++#define WF_TX_DESCRIPTOR_MSDU3_DW 9
++#define WF_TX_DESCRIPTOR_MSDU3_ADDR 36
++#define WF_TX_DESCRIPTOR_MSDU3_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_MSDU3_SHIFT 16
++// DW10
++#define WF_TX_DESCRIPTOR_TXP0_DW 10
++#define WF_TX_DESCRIPTOR_TXP0_ADDR 40
++#define WF_TX_DESCRIPTOR_TXP0_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP0_SHIFT 0
++// DW11
++// DO NOT process repeat field(txp[0])
++#define WF_TX_DESCRIPTOR_TXP1_DW 11
++#define WF_TX_DESCRIPTOR_TXP1_ADDR 44
++#define WF_TX_DESCRIPTOR_TXP1_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP1_SHIFT 16
++// DW12
++// DO NOT process repeat field(txp[1])
++// DW13
++#define WF_TX_DESCRIPTOR_TXP2_DW 13
++#define WF_TX_DESCRIPTOR_TXP2_ADDR 52
++#define WF_TX_DESCRIPTOR_TXP2_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP2_SHIFT 0
++// DW14
++// DO NOT process repeat field(txp[2])
++#define WF_TX_DESCRIPTOR_TXP3_DW 14
++#define WF_TX_DESCRIPTOR_TXP3_ADDR 56
++#define WF_TX_DESCRIPTOR_TXP3_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP3_SHIFT 16
++// DW15
++// DO NOT process repeat field(txp[3])
++// DW16
++#define WF_TX_DESCRIPTOR_MSDU4_DW 16
++#define WF_TX_DESCRIPTOR_MSDU4_ADDR 64
++#define WF_TX_DESCRIPTOR_MSDU4_MASK 0x0000ffff // 15- 0
++#define WF_TX_DESCRIPTOR_MSDU4_SHIFT 0
++#define WF_TX_DESCRIPTOR_MSDU5_DW 16
++#define WF_TX_DESCRIPTOR_MSDU5_ADDR 64
++#define WF_TX_DESCRIPTOR_MSDU5_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_MSDU5_SHIFT 16
++// DW17
++#define WF_TX_DESCRIPTOR_MSDU6_DW 17
++#define WF_TX_DESCRIPTOR_MSDU6_ADDR 68
++#define WF_TX_DESCRIPTOR_MSDU6_MASK 0x0000ffff // 15- 0
++#define WF_TX_DESCRIPTOR_MSDU6_SHIFT 0
++#define WF_TX_DESCRIPTOR_MSDU7_DW 17
++#define WF_TX_DESCRIPTOR_MSDU7_ADDR 68
++#define WF_TX_DESCRIPTOR_MSDU7_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_MSDU7_SHIFT 16
++// DW18
++#define WF_TX_DESCRIPTOR_TXP4_DW 18
++#define WF_TX_DESCRIPTOR_TXP4_ADDR 72
++#define WF_TX_DESCRIPTOR_TXP4_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP4_SHIFT 0
++// DW19
++// DO NOT process repeat field(txp[4])
++#define WF_TX_DESCRIPTOR_TXP5_DW 19
++#define WF_TX_DESCRIPTOR_TXP5_ADDR 76
++#define WF_TX_DESCRIPTOR_TXP5_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP5_SHIFT 16
++// DW20
++// DO NOT process repeat field(txp[5])
++// DW21
++#define WF_TX_DESCRIPTOR_TXP6_DW 21
++#define WF_TX_DESCRIPTOR_TXP6_ADDR 84
++#define WF_TX_DESCRIPTOR_TXP6_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP6_SHIFT 0
++// DW22
++// DO NOT process repeat field(txp[6])
++#define WF_TX_DESCRIPTOR_TXP7_DW 22
++#define WF_TX_DESCRIPTOR_TXP7_ADDR 88
++#define WF_TX_DESCRIPTOR_TXP7_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP7_SHIFT 16
++// DW23
++// DO NOT process repeat field(txp[7])
++// DW24
++#define WF_TX_DESCRIPTOR_TXP8_DW 24
++#define WF_TX_DESCRIPTOR_TXP8_ADDR 96
++#define WF_TX_DESCRIPTOR_TXP8_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP8_SHIFT 0
++// DW25
++// DO NOT process repeat field(txp[8])
++#define WF_TX_DESCRIPTOR_TXP9_DW 25
++#define WF_TX_DESCRIPTOR_TXP9_ADDR 100
++#define WF_TX_DESCRIPTOR_TXP9_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP9_SHIFT 16
++// DW26
++// DO NOT process repeat field(txp[9])
++// DW27
++#define WF_TX_DESCRIPTOR_TXP10_DW 27
++#define WF_TX_DESCRIPTOR_TXP10_ADDR 108
++#define WF_TX_DESCRIPTOR_TXP10_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP10_SHIFT 0
++// DW28
++// DO NOT process repeat field(txp[10])
++#define WF_TX_DESCRIPTOR_TXP11_DW 28
++#define WF_TX_DESCRIPTOR_TXP11_ADDR 112
++#define WF_TX_DESCRIPTOR_TXP11_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP11_SHIFT 16
++// DW29
++// DO NOT process repeat field(txp[11])
++// DW30
++#define WF_TX_DESCRIPTOR_TXP12_DW 30
++#define WF_TX_DESCRIPTOR_TXP12_ADDR 120
++#define WF_TX_DESCRIPTOR_TXP12_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP12_SHIFT 0
++// DW31
++// DO NOT process repeat field(txp[12])
++#define WF_TX_DESCRIPTOR_TXP13_DW 31
++#define WF_TX_DESCRIPTOR_TXP13_ADDR 124
++#define WF_TX_DESCRIPTOR_TXP13_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP13_SHIFT 16
++// DW32
++// DO NOT process repeat field(txp[13])
++// DW33
++#define WF_TX_DESCRIPTOR_TXP14_DW 33
++#define WF_TX_DESCRIPTOR_TXP14_ADDR 132
++#define WF_TX_DESCRIPTOR_TXP14_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP14_SHIFT 0
++// DW34
++// DO NOT process repeat field(txp[14])
++#define WF_TX_DESCRIPTOR_TXP15_DW 34
++#define WF_TX_DESCRIPTOR_TXP15_ADDR 136
++#define WF_TX_DESCRIPTOR_TXP15_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP15_SHIFT 16
++// DW35
++// DO NOT process repeat field(txp[15])
++// DW36
++#define WF_TX_DESCRIPTOR_TXP16_DW 36
++#define WF_TX_DESCRIPTOR_TXP16_ADDR 144
++#define WF_TX_DESCRIPTOR_TXP16_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP16_SHIFT 0
++// DW37
++// DO NOT process repeat field(txp[16])
++#define WF_TX_DESCRIPTOR_TXP17_DW 37
++#define WF_TX_DESCRIPTOR_TXP17_ADDR 148
++#define WF_TX_DESCRIPTOR_TXP17_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP17_SHIFT 16
++// DW38
++// DO NOT process repeat field(txp[17])
++// DW39
++#define WF_TX_DESCRIPTOR_TXP18_DW 39
++#define WF_TX_DESCRIPTOR_TXP18_ADDR 156
++#define WF_TX_DESCRIPTOR_TXP18_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP18_SHIFT 0
++// DW40
++// DO NOT process repeat field(txp[18])
++#define WF_TX_DESCRIPTOR_TXP19_DW 40
++#define WF_TX_DESCRIPTOR_TXP19_ADDR 160
++#define WF_TX_DESCRIPTOR_TXP19_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP19_SHIFT 16
++// DW41
++// DO NOT process repeat field(txp[19])
++// DW42
++#define WF_TX_DESCRIPTOR_TXP20_DW 42
++#define WF_TX_DESCRIPTOR_TXP20_ADDR 168
++#define WF_TX_DESCRIPTOR_TXP20_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP20_SHIFT 0
++// DW43
++// DO NOT process repeat field(txp[20])
++#define WF_TX_DESCRIPTOR_TXP21_DW 43
++#define WF_TX_DESCRIPTOR_TXP21_ADDR 172
++#define WF_TX_DESCRIPTOR_TXP21_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP21_SHIFT 16
++// DW44
++// DO NOT process repeat field(txp[21])
++// DW45
++#define WF_TX_DESCRIPTOR_TXP22_DW 45
++#define WF_TX_DESCRIPTOR_TXP22_ADDR 180
++#define WF_TX_DESCRIPTOR_TXP22_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP22_SHIFT 0
++// DW46
++// DO NOT process repeat field(txp[22])
++#define WF_TX_DESCRIPTOR_TXP23_DW 46
++#define WF_TX_DESCRIPTOR_TXP23_ADDR 184
++#define WF_TX_DESCRIPTOR_TXP23_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP23_SHIFT 16
++// DW47
++// DO NOT process repeat field(txp[23])
++// DW48
++#define WF_TX_DESCRIPTOR_TXP24_DW 48
++#define WF_TX_DESCRIPTOR_TXP24_ADDR 192
++#define WF_TX_DESCRIPTOR_TXP24_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP24_SHIFT 0
++// DW49
++// DO NOT process repeat field(txp[24])
++#define WF_TX_DESCRIPTOR_TXP25_DW 49
++#define WF_TX_DESCRIPTOR_TXP25_ADDR 196
++#define WF_TX_DESCRIPTOR_TXP25_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP25_SHIFT 16
++// DW50
++// DO NOT process repeat field(txp[25])
++// DW51
++#define WF_TX_DESCRIPTOR_TXP26_DW 51
++#define WF_TX_DESCRIPTOR_TXP26_ADDR 204
++#define WF_TX_DESCRIPTOR_TXP26_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP26_SHIFT 0
++// DW52
++// DO NOT process repeat field(txp[26])
++#define WF_TX_DESCRIPTOR_TXP27_DW 52
++#define WF_TX_DESCRIPTOR_TXP27_ADDR 208
++#define WF_TX_DESCRIPTOR_TXP27_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP27_SHIFT 16
++// DW53
++// DO NOT process repeat field(txp[27])
++// DW54
++#define WF_TX_DESCRIPTOR_TXP28_DW 54
++#define WF_TX_DESCRIPTOR_TXP28_ADDR 216
++#define WF_TX_DESCRIPTOR_TXP28_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP28_SHIFT 0
++// DW55
++// DO NOT process repeat field(txp[28])
++#define WF_TX_DESCRIPTOR_TXP29_DW 55
++#define WF_TX_DESCRIPTOR_TXP29_ADDR 220
++#define WF_TX_DESCRIPTOR_TXP29_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP29_SHIFT 16
++// DW56
++// DO NOT process repeat field(txp[29])
++// DW57
++#define WF_TX_DESCRIPTOR_TXP30_DW 57
++#define WF_TX_DESCRIPTOR_TXP30_ADDR 228
++#define WF_TX_DESCRIPTOR_TXP30_MASK 0xffffffff // 31- 0
++#define WF_TX_DESCRIPTOR_TXP30_SHIFT 0
++// DW58
++// DO NOT process repeat field(txp[30])
++#define WF_TX_DESCRIPTOR_TXP31_DW 58
++#define WF_TX_DESCRIPTOR_TXP31_ADDR 232
++#define WF_TX_DESCRIPTOR_TXP31_MASK 0xffff0000 // 31-16
++#define WF_TX_DESCRIPTOR_TXP31_SHIFT 16
++// DW59
++// DO NOT process repeat field(txp[31])
++
++/* TXP PAO */
++#define HIF_TXP_V2_SIZE (24 * 4)
++/* DW0 */
++#define HIF_TXD_VERSION_SHIFT 19
++#define HIF_TXD_VERSION_MASK 0x00780000
++
++/* DW8 */
++#define HIF_TXP_PRIORITY_SHIFT 0
++#define HIF_TXP_PRIORITY_MASK 0x00000001
++#define HIF_TXP_FIXED_RATE_SHIFT 1
++#define HIF_TXP_FIXED_RATE_MASK 0x00000002
++#define HIF_TXP_TCP_SHIFT 2
++#define HIF_TXP_TCP_MASK 0x00000004
++#define HIF_TXP_NON_CIPHER_SHIFT 3
++#define HIF_TXP_NON_CIPHER_MASK 0x00000008
++#define HIF_TXP_VLAN_SHIFT 4
++#define HIF_TXP_VLAN_MASK 0x00000010
++#define HIF_TXP_BC_MC_FLAG_SHIFT 5
++#define HIF_TXP_BC_MC_FLAG_MASK 0x00000060
++#define HIF_TXP_FR_HOST_SHIFT 7
++#define HIF_TXP_FR_HOST_MASK 0x00000080
++#define HIF_TXP_ETYPE_SHIFT 8
++#define HIF_TXP_ETYPE_MASK 0x00000100
++#define HIF_TXP_TXP_AMSDU_SHIFT 9
++#define HIF_TXP_TXP_AMSDU_MASK 0x00000200
++#define HIF_TXP_TXP_MC_CLONE_SHIFT 10
++#define HIF_TXP_TXP_MC_CLONE_MASK 0x00000400
++#define HIF_TXP_TOKEN_ID_SHIFT 16
++#define HIF_TXP_TOKEN_ID_MASK 0xffff0000
++
++/* DW9 */
++#define HIF_TXP_BSS_IDX_SHIFT 0
++#define HIF_TXP_BSS_IDX_MASK 0x000000ff
++#define HIF_TXP_USER_PRIORITY_SHIFT 8
++#define HIF_TXP_USER_PRIORITY_MASK 0x0000ff00
++#define HIF_TXP_BUF_NUM_SHIFT 16
++#define HIF_TXP_BUF_NUM_MASK 0x001f0000
++#define HIF_TXP_MSDU_CNT_SHIFT 21
++#define HIF_TXP_MSDU_CNT_MASK 0x03e00000
++#define HIF_TXP_SRC_SHIFT 26
++#define HIF_TXP_SRC_MASK 0x0c000000
++
++/* DW10 */
++#define HIF_TXP_ETH_TYPE_SHIFT 0
++#define HIF_TXP_ETH_TYPE_MASK 0x0000ffff
++#define HIF_TXP_WLAN_IDX_SHIFT 16
++#define HIF_TXP_WLAN_IDX_MASK 0x0fff0000
++
++/* DW11 */
++#define HIF_TXP_PPE_INFO_SHIFT 0
++#define HIF_TXP_PPE_INFO_MASK 0xffffffff
++
++/* DW12 - DW31 */
++#define HIF_TXP_BUF_PTR0_L_SHIFT 0
++#define HIF_TXP_BUF_PTR0_L_MASK 0xffffffff
++#define HIF_TXP_BUF_LEN0_SHIFT 0
++#define HIF_TXP_BUF_LEN0_MASK 0x00000fff
++#define HIF_TXP_BUF_PTR0_H_SHIFT 12
++#define HIF_TXP_BUF_PTR0_H_MASK 0x0000f000
++#define HIF_TXP_BUF_LEN1_SHIFT 16
++#define HIF_TXP_BUF_LEN1_MASK 0x0fff0000
++#define HIF_TXP_BUF_PTR1_H_SHIFT 28
++#define HIF_TXP_BUF_PTR1_H_MASK 0xf0000000
++#define HIF_TXP_BUF_PTR1_L_SHIFT 0
++#define HIF_TXP_BUF_PTR1_L_MASK 0xffffffff
++
++/* DW31 */
++#define HIF_TXP_ML_SHIFT 16
++#define HIF_TXP_ML_MASK 0xffff0000
++
++#endif
++
++#endif
+diff --git a/mt7996/mtk_debugfs_i.c b/mt7996/mtk_debugfs_i.c
+new file mode 100644
+index 00000000..ea412cd5
+--- /dev/null
++++ b/mt7996/mtk_debugfs_i.c
+@@ -0,0 +1,720 @@
++#include <linux/inet.h>
++#include "mt7996.h"
++#include "../mt76.h"
++#include "mcu.h"
++#include "mac.h"
++#include "eeprom.h"
++#include "mtk_debug.h"
++#include "mtk_debug_i.h"
++#include "mtk_mcu.h"
++
++#ifdef CONFIG_MTK_DEBUG
++
++#define info_or_seq_printf(seq, fmt, ...) do { \
++ if (seq) \
++ seq_printf(seq, fmt, ##__VA_ARGS__); \
++ else \
++ pr_info(fmt, ##__VA_ARGS__); \
++} while (0)
++
++static void info_or_seq_hex_dump(struct seq_file *seq, int prefix_type,
++ int rowsize, int groupsize, const void *buf,
++ size_t len, bool ascii)
++{
++ if (seq)
++ seq_hex_dump(seq, "", prefix_type, rowsize, groupsize,
++ buf, len, ascii);
++ else
++ print_hex_dump(KERN_INFO, "", prefix_type,
++ rowsize, groupsize, buf, len, ascii);
++}
++
++//bmac dump mac txp
++static void mt7996_dump_bmac_mac_txp_info(struct seq_file *s, struct mt7996_dev *dev,
++ __le32 *txp)
++{
++ struct mt7996_txp_token {
++ __le16 msdu[4];
++ } *msdu;
++ struct mt7996_txp_ptr {
++ __le32 addr1;
++ __le32 addr_info;
++ __le32 addr2;
++ } *ptr;
++ int i = 0;
++
++ for (i = 0; i < 12; i = i+2 ) {
++ if (i == 0 || i == 4) {
++ msdu = (struct mt7996_txp_token *) txp;
++ info_or_seq_printf(s, "msdu token(%d-%d)=%ld %ld %ld %ld (0x%08x-0x%08x)\n", i, i+3,
++ (msdu->msdu[0] & GENMASK(14, 0)),
++ (msdu->msdu[1] & GENMASK(14, 0)),
++ (msdu->msdu[2] & GENMASK(14, 0)),
++ (msdu->msdu[3] & GENMASK(14, 0)), *txp, *(txp+1));
++ txp = txp + 2;
++ }
++ ptr = (struct mt7996_txp_ptr *) txp;
++ info_or_seq_printf(s, "ptr%02d : addr(0x%08x) len(%ld) addr_h(%02lx) SRC(%d) ML(%d) \n",
++ i, ptr->addr1,
++ FIELD_GET(GENMASK(11, 0), ptr->addr_info),
++ FIELD_GET(GENMASK(13, 12), ptr->addr_info),
++ !!(ptr->addr_info & BIT(14)),
++ !!(ptr->addr_info & BIT(15)));
++ info_or_seq_printf(s, "ptr%02d : addr(0x%08x) len(%ld) addr_h(%02lx) SRC(%d) ML(%d) \n",
++ i+1, ptr->addr2,
++ FIELD_GET(GENMASK(27, 16), ptr->addr_info),
++ FIELD_GET(GENMASK(29, 28), ptr->addr_info),
++ !!(ptr->addr_info & BIT(30)),
++ !!(ptr->addr_info & BIT(31)));
++ txp = txp + 3;
++ }
++}
++
++//bmac dump hif txp
++void mt7996_dump_bmac_hif_txp_info(struct seq_file *s, struct mt7996_dev *dev,
++ __le32 *txp, u32 hif_txp_ver)
++{
++ int i, j = 0;
++ u32 dw;
++
++ info_or_seq_printf(s, "txp raw data: size=%d\n", HIF_TXP_V2_SIZE);
++ info_or_seq_hex_dump(s, DUMP_PREFIX_OFFSET, 16, 1, (u8 *)txp, HIF_TXP_V2_SIZE, false);
++
++ info_or_seq_printf(s, "BMAC_TXP Fields:\n");
++
++ /* dw0 */
++ if (hif_txp_ver == 2) {
++ dw = le32_to_cpu(txp[0]);
++ info_or_seq_printf(s, "HIF_TXP_PRIORITY = %d\n",
++ GET_FIELD(HIF_TXP_PRIORITY, dw));
++ info_or_seq_printf(s, "HIF_TXP_FIXED_RATE = %d\n",
++ GET_FIELD(HIF_TXP_FIXED_RATE, dw));
++ info_or_seq_printf(s, "HIF_TXP_TCP = %d\n",
++ GET_FIELD(HIF_TXP_TCP, dw));
++ info_or_seq_printf(s, "HIF_TXP_NON_CIPHER = %d\n",
++ GET_FIELD(HIF_TXP_NON_CIPHER, dw));
++ info_or_seq_printf(s, "HIF_TXP_VLAN = %d\n",
++ GET_FIELD(HIF_TXP_VLAN, dw));
++ info_or_seq_printf(s, "HIF_TXP_BC_MC_FLAG = %d\n",
++ GET_FIELD(HIF_TXP_BC_MC_FLAG, dw));
++ info_or_seq_printf(s, "HIF_TXP_FR_HOST = %d\n",
++ GET_FIELD(HIF_TXP_FR_HOST, dw));
++ info_or_seq_printf(s, "HIF_TXP_ETYPE = %d\n",
++ GET_FIELD(HIF_TXP_ETYPE, dw));
++ info_or_seq_printf(s, "HIF_TXP_TXP_AMSDU = %d\n",
++ GET_FIELD(HIF_TXP_TXP_AMSDU, dw));
++ info_or_seq_printf(s, "HIF_TXP_TXP_MC_CLONE = %d\n",
++ GET_FIELD(HIF_TXP_TXP_MC_CLONE, dw));
++ info_or_seq_printf(s, "HIF_TXP_TOKEN_ID = %d\n",
++ GET_FIELD(HIF_TXP_TOKEN_ID, dw));
++
++ /* dw1 */
++ dw = le32_to_cpu(txp[1]);
++ info_or_seq_printf(s, "HIF_TXP_BSS_IDX = %d\n",
++ GET_FIELD(HIF_TXP_BSS_IDX, dw));
++ info_or_seq_printf(s, "HIF_TXP_USER_PRIORITY = %d\n",
++ GET_FIELD(HIF_TXP_USER_PRIORITY, dw));
++ info_or_seq_printf(s, "HIF_TXP_BUF_NUM = %d\n",
++ GET_FIELD(HIF_TXP_BUF_NUM, dw));
++ info_or_seq_printf(s, "HIF_TXP_MSDU_CNT = %d\n",
++ GET_FIELD(HIF_TXP_MSDU_CNT, dw));
++ info_or_seq_printf(s, "HIF_TXP_SRC = %d\n",
++ GET_FIELD(HIF_TXP_SRC, dw));
++
++ /* dw2 */
++ dw = le32_to_cpu(txp[2]);
++ info_or_seq_printf(s, "HIF_TXP_ETH_TYPE(network-endian) = 0x%x\n",
++ GET_FIELD(HIF_TXP_ETH_TYPE, dw));
++ info_or_seq_printf(s, "HIF_TXP_WLAN_IDX = %d\n",
++ GET_FIELD(HIF_TXP_WLAN_IDX, dw));
++
++ /* dw3 */
++ dw = le32_to_cpu(txp[3]);
++ info_or_seq_printf(s, "HIF_TXP_PPE_INFO = 0x%x\n",
++ GET_FIELD(HIF_TXP_PPE_INFO, dw));
++
++ for (i = 0; i < 13; i++) {
++ if (i % 2 == 0) {
++ info_or_seq_printf(s, "HIF_TXP_BUF_PTR%d_L = 0x%x\n",
++ i, GET_FIELD(HIF_TXP_BUF_PTR0_L,
++ le32_to_cpu(txp[4 + j])));
++ j++;
++ info_or_seq_printf(s, "HIF_TXP_BUF_LEN%d = %d\n",
++ i, GET_FIELD(HIF_TXP_BUF_LEN0, le32_to_cpu(txp[4 + j])));
++ info_or_seq_printf(s, "HIF_TXP_BUF_PTR%d_H = 0x%x\n",
++ i, GET_FIELD(HIF_TXP_BUF_PTR0_H, le32_to_cpu(txp[4 + j])));
++ if (i <= 10) {
++ info_or_seq_printf(s, "HIF_TXP_BUF_LEN%d = %d\n",
++ i + 1, GET_FIELD(HIF_TXP_BUF_LEN1, le32_to_cpu(txp[4 + j])));
++ info_or_seq_printf(s, "HIF_TXP_BUF_PTR%d_H = 0x%x\n",
++ i + 1, GET_FIELD(HIF_TXP_BUF_PTR1_H, le32_to_cpu(txp[4 + j])));
++ }
++ j++;
++ } else {
++ info_or_seq_printf(s, "HIF_TXP_BUF_PTR%d_L = 0x%x\n",
++ i, GET_FIELD(HIF_TXP_BUF_PTR1_L,
++ le32_to_cpu(txp[4 + j])));
++ j++;
++ }
++ }
++
++ info_or_seq_printf(s, "ml = 0x%x\n",
++ GET_FIELD(HIF_TXP_ML, le32_to_cpu(txp[23])));
++ } else {
++ struct mt76_connac_txp_common *txp_v1 = (struct mt76_connac_txp_common *)txp;
++
++ info_or_seq_printf(s, "FLAGS = (%04x)\n", txp_v1->fw.flags);
++
++ info_or_seq_printf(s, "MSDU = %d\n", txp_v1->fw.token);
++
++ info_or_seq_printf(s, "BSS_IDX = %d\n", txp_v1->fw.bss_idx);
++
++ info_or_seq_printf(s, "WCID = %d\n",txp_v1->fw.rept_wds_wcid);
++
++ info_or_seq_printf(s, "MSDU_CNT = %d\n", txp_v1->fw.nbuf);
++
++ for (i = 0; i < MT_TXP_MAX_BUF_NUM; i++)
++ info_or_seq_printf(s, "ptr%02d : addr(0x%08x) len(%d)\n", i, le32_to_cpu(txp_v1->fw.buf[i]),
++ le16_to_cpu(txp_v1->fw.len[i]));
++ }
++}
++
++/* bmac txd dump */
++void mt7996_dump_bmac_txd_info(struct seq_file *s, struct mt7996_dev *dev,
++ __le32 *txd, bool is_hif_txd, bool dump_txp)
++{
++ u32 hif_txp_ver = 0;
++
++ /* dump stop */
++ if (!dev->dbg.txd_read_cnt)
++ return;
++
++ /* force dump */
++ if (dev->dbg.txd_read_cnt > 8)
++ dev->dbg.txd_read_cnt = 8;
++
++ /* dump txd_read_cnt times */
++ if (dev->dbg.txd_read_cnt != 8)
++ dev->dbg.txd_read_cnt--;
++
++ info_or_seq_printf(s, "txd raw data: size=%d\n", MT_TXD_SIZE);
++ info_or_seq_hex_dump(s, DUMP_PREFIX_OFFSET, 16, 1, (u8 *)txd, MT_TXD_SIZE, false);
++
++ info_or_seq_printf(s, "BMAC_TXD Fields:\n");
++ /* dw0 */
++ if (is_hif_txd) {
++ hif_txp_ver = FIELD_GET(GENMASK(22, 19), txd[0]);
++ info_or_seq_printf(s, "HIF TXD VER = %d\n", hif_txp_ver);
++ }
++ info_or_seq_printf(s, "TX_BYTE_COUNT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TX_BYTE_COUNT, txd[0]));
++ info_or_seq_printf(s, "ETHER_TYPE_OFFSET(word) = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_ETHER_TYPE_OFFSET, txd[0]));
++ info_or_seq_printf(s, "PKT_FT = %d%s%s%s%s\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PKT_FT, txd[0]),
++ GET_FIELD(WF_TX_DESCRIPTOR_PKT_FT, txd[0]) == 0 ? "(ct)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_PKT_FT, txd[0]) == 1 ? "(s&f)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_PKT_FT, txd[0]) == 2 ? "(cmd)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_PKT_FT, txd[0]) == 3 ? "(redirect)" : "");
++ info_or_seq_printf(s, "Q_IDX = %d%s%s%s\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_Q_IDX, txd[0]),
++ GET_FIELD(WF_TX_DESCRIPTOR_Q_IDX, txd[0]) == 0x10 ? "(ALTX)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_Q_IDX, txd[0]) == 0x11 ? "(BMC)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_Q_IDX, txd[0]) == 0x12 ? "(BCN)" : "");
++
++ /* dw1 */
++ info_or_seq_printf(s, "MLD_ID = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_MLD_ID, txd[1]));
++ info_or_seq_printf(s, "TGID = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TGID, txd[1]));
++ info_or_seq_printf(s, "HF = %d%s%s%s%s\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]),
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 0 ? "(eth/802.3)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 1 ? "(cmd)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 2 ? "(802.11)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 3 ? "(802.11 enhanced" : "");
++ info_or_seq_printf(s, "802.11 HEADER_LENGTH = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 2 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_HEADER_LENGTH, txd[1]) : 0);
++ info_or_seq_printf(s, "MRD = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 0 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_MRD, txd[1]) : 0);
++ info_or_seq_printf(s, "EOSP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 0 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_EOSP, txd[1]) : 0);
++ info_or_seq_printf(s, "AMS = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 3 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_AMS, txd[1]) : 0);
++ info_or_seq_printf(s, "RMVL = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 0 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_RMVL, txd[1]): 0);
++ info_or_seq_printf(s, "VLAN = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 0 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_VLAN, txd[1]) : 0);
++ info_or_seq_printf(s, "ETYP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HF, txd[1]) == 0 ?
++ GET_FIELD(WF_TX_DESCRIPTOR_ETYP, txd[1]) : 0);
++ info_or_seq_printf(s, "TID_MGMT_TYPE = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TID_MGMT_TYPE, txd[1]));
++ info_or_seq_printf(s, "OM = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_OM, txd[1]));
++ info_or_seq_printf(s, "FR = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_FR, txd[1]));
++
++ /* dw2 */
++ info_or_seq_printf(s, "SUBTYPE = %d%s%s%s%s\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_SUBTYPE, txd[2]),
++ (GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 0) &&
++ (GET_FIELD(WF_TX_DESCRIPTOR_SUBTYPE, txd[2]) == 13) ?
++ "(action)" : "",
++ (GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 1) &&
++ (GET_FIELD(WF_TX_DESCRIPTOR_SUBTYPE, txd[2]) == 8) ?
++ "(bar)" : "",
++ (GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 2) &&
++ (GET_FIELD(WF_TX_DESCRIPTOR_SUBTYPE, txd[2]) == 4) ?
++ "(null)" : "",
++ (GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 2) &&
++ (GET_FIELD(WF_TX_DESCRIPTOR_SUBTYPE, txd[2]) == 12) ?
++ "(qos null)" : "");
++
++ info_or_seq_printf(s, "FTYPE = %d%s%s%s\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]),
++ GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 0 ? "(mgmt)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 1 ? "(ctl)" : "",
++ GET_FIELD(WF_TX_DESCRIPTOR_FTYPE, txd[2]) == 2 ? "(data)" : "");
++ info_or_seq_printf(s, "BF_TYPE = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_BF_TYPE, txd[2]));
++ info_or_seq_printf(s, "OM_MAP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_OM_MAP, txd[2]));
++ info_or_seq_printf(s, "RTS = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_RTS, txd[2]));
++ info_or_seq_printf(s, "HEADER_PADDING = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HEADER_PADDING, txd[2]));
++ info_or_seq_printf(s, "DU = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_DU, txd[2]));
++ info_or_seq_printf(s, "HE = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HE, txd[2]));
++ info_or_seq_printf(s, "FRAG = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_FRAG, txd[2]));
++ info_or_seq_printf(s, "REMAINING_TX_TIME = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_REMAINING_TX_TIME, txd[2]));
++ info_or_seq_printf(s, "POWER_OFFSET = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_POWER_OFFSET, txd[2]));
++
++ /* dw3 */
++ info_or_seq_printf(s, "NA = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_NA, txd[3]));
++ info_or_seq_printf(s, "PF = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PF, txd[3]));
++ info_or_seq_printf(s, "EMRD = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_EMRD, txd[3]));
++ info_or_seq_printf(s, "EEOSP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_EEOSP, txd[3]));
++ info_or_seq_printf(s, "BM = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_BM, txd[3]));
++ info_or_seq_printf(s, "HW_AMSDU_CAP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HW_AMSDU_CAP, txd[3]));
++ info_or_seq_printf(s, "TX_COUNT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TX_COUNT, txd[3]));
++ info_or_seq_printf(s, "REMAINING_TX_COUNT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_REMAINING_TX_COUNT, txd[3]));
++ info_or_seq_printf(s, "SN = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_SN, txd[3]));
++ info_or_seq_printf(s, "BA_DIS = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_BA_DIS, txd[3]));
++ info_or_seq_printf(s, "PM = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PM, txd[3]));
++ info_or_seq_printf(s, "PN_VLD = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PN_VLD, txd[3]));
++ info_or_seq_printf(s, "SN_VLD = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_SN_VLD, txd[3]));
++
++ /* dw4 */
++ info_or_seq_printf(s, "PN_31_0 = 0x%x\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PN_31_0_, txd[4]));
++
++ /* dw5 */
++ info_or_seq_printf(s, "PID = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PID, txd[5]));
++ info_or_seq_printf(s, "TXSFM = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TXSFM, txd[5]));
++ info_or_seq_printf(s, "TXS2M = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TXS2M, txd[5]));
++ info_or_seq_printf(s, "TXS2H = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TXS2H, txd[5]));
++ info_or_seq_printf(s, "FBCZ = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_FBCZ, txd[5]));
++ info_or_seq_printf(s, "BYPASS_RBB = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_BYPASS_RBB, txd[5]));
++
++ info_or_seq_printf(s, "FL = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_FL, txd[5]));
++ info_or_seq_printf(s, "PN_47_32 = 0x%x\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_PN_47_32_, txd[5]));
++
++ /* dw6 */
++ info_or_seq_printf(s, "AMSDU_CAP_UTXB = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_AMSDU_CAP_UTXB, txd[6]));
++ info_or_seq_printf(s, "DAS = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_DAS, txd[6]));
++ info_or_seq_printf(s, "DIS_MAT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_DIS_MAT, txd[6]));
++ info_or_seq_printf(s, "MSDU_COUNT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_MSDU_COUNT, txd[6]));
++ info_or_seq_printf(s, "TIMESTAMP_OFFSET = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TIMESTAMP_OFFSET_IDX, txd[6]));
++ info_or_seq_printf(s, "FIXED_RATE_IDX = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_FIXED_RATE_IDX, txd[6]));
++ info_or_seq_printf(s, "BW = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_BW, txd[6]));
++ info_or_seq_printf(s, "VTA = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_VTA, txd[6]));
++ info_or_seq_printf(s, "SRC = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_SRC, txd[6]));
++
++ /* dw7 */
++ info_or_seq_printf(s, "SW_TX_TIME(unit:65536ns) = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_SW_TX_TIME , txd[7]));
++ info_or_seq_printf(s, "UT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_UT, txd[7]));
++ info_or_seq_printf(s, "CTXD_CNT = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_CTXD_CNT, txd[7]));
++ info_or_seq_printf(s, "HM = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_HM, txd[7]));
++ info_or_seq_printf(s, "DP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_DP, txd[7]));
++ info_or_seq_printf(s, "IP = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_IP, txd[7]));
++ info_or_seq_printf(s, "TXD_LEN = %d\n",
++ GET_FIELD(WF_TX_DESCRIPTOR_TXD_LEN, txd[7]));
++
++ if (dump_txp) {
++ __le32 *txp = txd + 8;
++
++ if (is_hif_txd)
++ mt7996_dump_bmac_hif_txp_info(s, dev, txp, hif_txp_ver);
++ else
++ mt7996_dump_bmac_mac_txp_info(s, dev, txp);
++ }
++}
++
++static void
++mt7996_dump_mac_fid(struct seq_file *s, struct mt7996_dev *dev, u32 fid, bool is_ple)
++{
++#define PLE_MEM_SIZE 128
++#define PSE_MEM_SIZE 256
++ u8 data[PSE_MEM_SIZE] = {0};
++ u32 addr = 0;
++ int i = 0, cr_cnt = PSE_MEM_SIZE;
++ u32 *ptr = (u32 *) data;
++
++ if (is_ple) {
++ cr_cnt = PLE_MEM_SIZE;
++ seq_printf(s, "dump ple: fid = 0x%08x\n", fid);
++ } else {
++ seq_printf(s, "dump pse: fid = 0x%08x\n", fid);
++ }
++
++ for (i = 0; i < cr_cnt; i = i + 4) {
++ if (is_ple)
++ addr = (0xa << 28 | fid << 15) + i;
++ else
++ addr = (0xb << 28 | fid << 15) + i;
++ *ptr = mt76_rr(dev, addr);
++ ptr++;
++ }
++
++ seq_printf(s, "raw data: size=%d\n", cr_cnt);
++
++ seq_hex_dump(s, "", DUMP_PREFIX_OFFSET, 16, 1, (u8 *)data, cr_cnt, false);
++ /* dump one txd info */
++ if (is_ple) {
++ dev->dbg.txd_read_cnt = 1;
++ mt7996_dump_bmac_txd_info(s, dev, (__le32 *)&data[0], false, true);
++ }
++}
++
++static int
++mt7996_ple_fid_read(struct seq_file *s, void *data) {
++ struct mt7996_dev *dev = dev_get_drvdata(s->private);
++
++ mt7996_dump_mac_fid(s, dev, dev->dbg.fid_idx, true);
++ return 0;
++}
++
++static int
++mt7996_pse_fid_read(struct seq_file *s, void *data) {
++ struct mt7996_dev *dev = dev_get_drvdata(s->private);
++
++ mt7996_dump_mac_fid(s, dev, dev->dbg.fid_idx, false);
++ return 0;
++}
++
++void mt7996_dump_bmac_rxd_info(struct mt7996_dev *dev, __le32 *rxd)
++{
++ /* dump stop */
++ if (!dev->dbg.rxd_read_cnt)
++ return;
++
++ /* force dump */
++ if (dev->dbg.rxd_read_cnt > 8)
++ dev->dbg.rxd_read_cnt = 8;
++
++ /* dump txd_read_cnt times */
++ if (dev->dbg.rxd_read_cnt != 8)
++ dev->dbg.rxd_read_cnt--;
++
++ printk("rxd raw data: size=%d\n", MT_TXD_SIZE);
++ print_hex_dump(KERN_ERR , "", DUMP_PREFIX_OFFSET, 16, 1, (u8 *)rxd, 96, false);
++
++ printk("BMAC_RXD Fields:\n");
++
++ /* group0 */
++ /* dw0 */
++ printk("RX_BYTE_COUNT = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_RX_BYTE_COUNT, le32_to_cpu(rxd[0])));
++ printk("PACKET_TYPE = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_PACKET_TYPE, le32_to_cpu(rxd[0])));
++
++ /* dw1 */
++ printk("MLD_ID = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_MLD_ID, le32_to_cpu(rxd[1])));
++ printk("GROUP_VLD = 0x%x%s%s%s%s%s\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1])),
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_1 ? "[group1]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_2 ? "[group2]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_3 ? "[group3]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ? "[group4]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_5 ? "[group5]" : "");
++ printk("KID = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_KID, le32_to_cpu(rxd[1])));
++ printk("CM = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_CM, le32_to_cpu(rxd[1])));
++ printk("CLM = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_CLM, le32_to_cpu(rxd[1])));
++ printk("I = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_I, le32_to_cpu(rxd[1])));
++ printk("T = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_T, le32_to_cpu(rxd[1])));
++ printk("BN = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BN, le32_to_cpu(rxd[1])));
++ printk("BIPN_FAIL = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BIPN_FAIL, le32_to_cpu(rxd[1])));
++
++ /* dw2 */
++ printk("BSSID = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BSSID, le32_to_cpu(rxd[2])));
++ printk("H = %d%s\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_H, le32_to_cpu(rxd[2])),
++ GET_FIELD(WF_RX_DESCRIPTOR_H, le32_to_cpu(rxd[2])) == 0 ?
++ "802.11 frame" : "eth/802.3 frame");
++ printk("HEADER_LENGTH(word) = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_HEADER_LENGTH, le32_to_cpu(rxd[2])));
++ printk("HO(word) = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_HO, le32_to_cpu(rxd[2])));
++ printk("SEC_MODE = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_SEC_MODE, le32_to_cpu(rxd[2])));
++ printk("MUBAR = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_MUBAR, le32_to_cpu(rxd[2])));
++ printk("SWBIT = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_SWBIT, le32_to_cpu(rxd[2])));
++ printk("DAF = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_DAF, le32_to_cpu(rxd[2])));
++ printk("EL = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_EL, le32_to_cpu(rxd[2])));
++ printk("HTF = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_HTF, le32_to_cpu(rxd[2])));
++ printk("INTF = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_INTF, le32_to_cpu(rxd[2])));
++ printk("FRAG = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_FRAG, le32_to_cpu(rxd[2])));
++ printk("NUL = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_NUL, le32_to_cpu(rxd[2])));
++ printk("NDATA = %d%s\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_NDATA, le32_to_cpu(rxd[2])),
++ GET_FIELD(WF_RX_DESCRIPTOR_NDATA, le32_to_cpu(rxd[2])) == 0 ?
++ "[data frame]" : "[mgmt/ctl frame]");
++ printk("NAMP = %d%s\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_NAMP, le32_to_cpu(rxd[2])),
++ GET_FIELD(WF_RX_DESCRIPTOR_NAMP, le32_to_cpu(rxd[2])) == 0 ?
++ "[ampdu frame]" : "[mpdu frame]");
++ printk("BF_RPT = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BF_RPT, le32_to_cpu(rxd[2])));
++
++ /* dw3 */
++ printk("RXV_SN = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_RXV_SN, le32_to_cpu(rxd[3])));
++ printk("CH_FREQUENCY = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_CH_FREQUENCY, le32_to_cpu(rxd[3])));
++ printk("A1_TYPE = %d%s%s%s%s\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_A1_TYPE, le32_to_cpu(rxd[3])),
++ GET_FIELD(WF_RX_DESCRIPTOR_A1_TYPE, le32_to_cpu(rxd[3])) == 0 ?
++ "[reserved]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_A1_TYPE, le32_to_cpu(rxd[3])) == 1 ?
++ "[uc2me]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_A1_TYPE, le32_to_cpu(rxd[3])) == 2 ?
++ "[mc]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_A1_TYPE, le32_to_cpu(rxd[3])) == 3 ?
++ "[bc]" : "");
++ printk("HTC = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_HTC, le32_to_cpu(rxd[3])));
++ printk("TCL = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_TCL, le32_to_cpu(rxd[3])));
++ printk("BBM = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BBM, le32_to_cpu(rxd[3])));
++ printk("BU = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BU, le32_to_cpu(rxd[3])));
++ printk("CO_ANT = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_CO_ANT, le32_to_cpu(rxd[3])));
++ printk("BF_CQI = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_BF_CQI, le32_to_cpu(rxd[3])));
++ printk("FC = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_FC, le32_to_cpu(rxd[3])));
++ printk("VLAN = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_VLAN, le32_to_cpu(rxd[3])));
++
++ /* dw4 */
++ printk("PF = %d%s%s%s%s\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_PF, le32_to_cpu(rxd[4])),
++ GET_FIELD(WF_RX_DESCRIPTOR_PF, le32_to_cpu(rxd[4])) == 0 ?
++ "[msdu]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_PF, le32_to_cpu(rxd[4])) == 1 ?
++ "[final amsdu]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_PF, le32_to_cpu(rxd[4])) == 2 ?
++ "[middle amsdu]" : "",
++ GET_FIELD(WF_RX_DESCRIPTOR_PF, le32_to_cpu(rxd[4])) == 3 ?
++ "[first amsdu]" : "");
++ printk("MAC = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_MAC, le32_to_cpu(rxd[4])));
++ printk("TID = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_TID, le32_to_cpu(rxd[4])));
++ printk("ETHER_TYPE_OFFSET = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_ETHER_TYPE_OFFSET, le32_to_cpu(rxd[4])));
++ printk("IP = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_IP, le32_to_cpu(rxd[4])));
++ printk("UT = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_UT, le32_to_cpu(rxd[4])));
++ printk("PSE_FID = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_PSE_FID, le32_to_cpu(rxd[4])));
++
++ /* group4 */
++ /* dw0 */
++ printk("FRAME_CONTROL_FIELD = 0x%x\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_FRAME_CONTROL_FIELD, le32_to_cpu(rxd[8])) : 0);
++ printk("PEER_MLD_ADDRESS_15_0 = 0x%x\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_15_0_,
++ le32_to_cpu(rxd[8])) : 0);
++
++ /* dw1 */
++ printk("PEER_MLD_ADDRESS_47_16 = 0x%x\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_PEER_MLD_ADDRESS_47_16_,
++ le32_to_cpu(rxd[9])) : 0);
++
++ /* dw2 */
++ printk("FRAGMENT_NUMBER = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_FRAGMENT_NUMBER,
++ le32_to_cpu(rxd[10])) : 0);
++ printk("SEQUENCE_NUMBER = %d\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_SEQUENCE_NUMBER,
++ le32_to_cpu(rxd[10])) : 0);
++ printk("QOS_CONTROL_FIELD = 0x%x\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_QOS_CONTROL_FIELD,
++ le32_to_cpu(rxd[10])) : 0);
++
++ /* dw3 */
++ printk("HT_CONTROL_FIELD = 0x%x\n",
++ GET_FIELD(WF_RX_DESCRIPTOR_GROUP_VLD, le32_to_cpu(rxd[1]))
++ & BMAC_GROUP_VLD_4 ?
++ GET_FIELD(WF_RX_DESCRIPTOR_HT_CONTROL_FIELD,
++ le32_to_cpu(rxd[11])) : 0);
++}
++
++static int mt7996_token_txd_read(struct seq_file *s, void *data)
++{
++ struct mt7996_dev *dev = dev_get_drvdata(s->private);
++ struct mt76_txwi_cache *t;
++ u8* txwi;
++
++ seq_printf(s, "\n");
++ spin_lock_bh(&dev->mt76.token_lock);
++
++ t = idr_find(&dev->mt76.token, dev->dbg.token_idx);
++ if (t != NULL) {
++ struct mt76_dev *mdev = &dev->mt76;
++ txwi = ((u8*)(t)) - (mdev->drv->txwi_size);
++ /* dump one txd info */
++ dev->dbg.txd_read_cnt = 1;
++ mt7996_dump_bmac_txd_info(s, dev, (__le32 *)txwi, true, true);
++ seq_printf(s, "\n");
++ seq_printf(s, "[SKB]\n");
++ seq_hex_dump(s, "", DUMP_PREFIX_OFFSET, 16, 1, (u8 *)t->skb->data, t->skb->len, false);
++ seq_printf(s, "\n");
++ }
++ spin_unlock_bh(&dev->mt76.token_lock);
++ return 0;
++}
++
++static int mt7996_rx_msdu_pg_read(struct seq_file *s, void *data)
++{
++ struct mt7996_dev *dev = dev_get_drvdata(s->private);
++ struct list_head *p;
++ int i, count = 0, total = 0;
++
++ seq_printf(s, "Rx Msdu page:\n");
++ spin_lock(&dev->wed_rro.lock);
++ for (i = 0; i < MT7996_RRO_MSDU_PG_HASH_SIZE; i++) {
++ list_for_each(p, &dev->wed_rro.pg_hash_head[i]) {
++ count++;
++ }
++ }
++
++ total = count;
++ list_for_each(p, &dev->wed_rro.pg_addr_cache) {
++ total++;
++ }
++ seq_printf(s, "\ttotal:%8d used:%8d\n", total, count);
++ spin_unlock(&dev->wed_rro.lock);
++
++ return 0;
++}
++
++int mt7996_mtk_init_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
++{
++ struct mt7996_dev *dev = phy->dev;
++
++ debugfs_create_devm_seqfile(dev->mt76.dev, "token_txd", dir,
++ mt7996_token_txd_read);
++ debugfs_create_u32("txd_dump", 0600, dir, &dev->dbg.txd_read_cnt);
++ debugfs_create_u32("rxd_dump", 0600, dir, &dev->dbg.rxd_read_cnt);
++ debugfs_create_devm_seqfile(dev->mt76.dev, "rx_msdu_pg", dir,
++ mt7996_rx_msdu_pg_read);
++
++ /* ple/pse fid raw data dump */
++ debugfs_create_u32("fid_idx", 0600, dir, &dev->dbg.fid_idx);
++ debugfs_create_devm_seqfile(dev->mt76.dev, "ple_fid", dir,
++ mt7996_ple_fid_read);
++ debugfs_create_devm_seqfile(dev->mt76.dev, "pse_fid", dir,
++ mt7996_pse_fid_read);
++
++ debugfs_create_u8("dump_ple_txd", 0600, dir, &dev->dbg.dump_ple_txd);
++ return 0;
++}
++
++#endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0121-mtk-mt76-mt7996-add-linux-tracing-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0121-mtk-mt76-mt7996-add-linux-tracing-support.patch
new file mode 100644
index 0000000..70831fd
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0121-mtk-mt76-mt7996-add-linux-tracing-support.patch
@@ -0,0 +1,394 @@
+From 5ef5041a7200a4e3877df4c3533bd3c5e2038615 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 7 Sep 2022 12:13:20 +0800
+Subject: [PATCH 121/199] mtk: mt76: mt7996: add linux tracing support
+
+Add static tracepoint support for besra.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ agg-rx.c | 2 +
+ mac80211.c | 3 +
+ mt7996/Makefile | 2 +-
+ mt7996/mac.c | 6 ++
+ mt7996/mcu.c | 8 +++
+ mt7996/mt7996_trace.h | 141 ++++++++++++++++++++++++++++++++++++++++++
+ mt7996/trace.c | 12 ++++
+ trace.h | 58 +++++++++++++++++
+ 8 files changed, 231 insertions(+), 1 deletion(-)
+ create mode 100644 mt7996/mt7996_trace.h
+ create mode 100644 mt7996/trace.c
+
+diff --git a/agg-rx.c b/agg-rx.c
+index 07c386c7..b48943c4 100644
+--- a/agg-rx.c
++++ b/agg-rx.c
+@@ -3,6 +3,7 @@
+ * Copyright (C) 2018 Felix Fietkau <nbd@nbd.name>
+ */
+ #include "mt76.h"
++#include "trace.h"
+
+ static unsigned long mt76_aggr_tid_to_timeo(u8 tidno)
+ {
+@@ -187,6 +188,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
+ seqno = status->seqno;
+ size = tid->size;
+ sn_less = ieee80211_sn_less(seqno, head);
++ trace_mt76_rx_aggr_reorder(tid->dev, wcid, head, seqno, sn_less);
+
+ if (!tid->started) {
+ if (sn_less)
+diff --git a/mac80211.c b/mac80211.c
+index 5e4935f2..dc91e827 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -5,6 +5,7 @@
+ #include <linux/sched.h>
+ #include <linux/of.h>
+ #include "mt76.h"
++#include "trace.h"
+
+ static const struct ieee80211_channel mt76_channels_2ghz[] = {
+ CHAN2G(1, 2412),
+@@ -1307,6 +1308,7 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
+
+ mt76_check_ccmp_pn(skb);
+ skb_shinfo(skb)->frag_list = NULL;
++ trace_mt76_rx_complete(dev, (struct mt76_rx_status *)skb->cb, 0);
+ mt76_rx_convert(dev, skb, &hw, &sta);
+ ieee80211_rx_list(hw, sta, skb, &list);
+
+@@ -1316,6 +1318,7 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
+ nskb = nskb->next;
+ skb->next = NULL;
+
++ trace_mt76_rx_complete(dev, (struct mt76_rx_status *)skb->cb, 1);
+ mt76_rx_convert(dev, skb, &hw, &sta);
+ ieee80211_rx_list(hw, sta, skb, &list);
+ }
+diff --git a/mt7996/Makefile b/mt7996/Makefile
+index 49ec9154..936edc61 100644
+--- a/mt7996/Makefile
++++ b/mt7996/Makefile
+@@ -12,4 +12,4 @@ mt7996e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o \
+ mt7996e-$(CONFIG_DEV_COREDUMP) += coredump.o
+ mt7996e-$(CONFIG_NL80211_TESTMODE) += testmode.o
+
+-mt7996e-y += mtk_debugfs.o mtk_mcu.o mtk_debugfs_i.o
++mt7996e-y += mtk_debugfs.o mtk_mcu.o mtk_debugfs_i.o trace.o
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index c6816ab5..6ba07156 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -11,6 +11,7 @@
+ #include "mac.h"
+ #include "mcu.h"
+ #include "vendor.h"
++#include "mt7996_trace.h"
+
+ static const struct mt7996_dfs_radar_spec etsi_radar_specs = {
+ .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 },
+@@ -344,6 +345,8 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ phy = mphy->priv;
+ status->phy_idx = mphy->band_idx;
+
++ trace_mt7996_fill_rx(phy, skb->data, skb->len);
++
+ if (!test_bit(MT76_STATE_RUNNING, &mphy->state))
+ return -EINVAL;
+
+@@ -609,6 +612,8 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ !(status->flag & RX_FLAG_8023))
+ mt76_connac3_mac_decode_he_radiotap(skb, rxv, mode);
+
++ trace_mt7996_fill_rx_done(phy, status->seqno, hdr_gap);
++
+ if (!status->wcid || !ieee80211_is_data_qos(fc) || hw_aggr)
+ return 0;
+
+@@ -998,6 +1003,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ mt7996_packet_log_to_host(dev, t->skb->data, t->skb->len, PKT_BIN_DEBUG_TX, 0);
+ mt7996_dump_bmac_txd_info(NULL, dev, (__le32 *)txwi, true, false);
+ #endif
++ trace_mt7996_tx_prepare(dev, wcid, qid, txwi, t->skb->data, t->skb->len);
+
+ return 0;
+ }
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 0b02b76b..1cc08a30 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -10,6 +10,7 @@
+ #include "mcu.h"
+ #include "mac.h"
+ #include "eeprom.h"
++#include "mt7996_trace.h"
+
+ #define fw_name(_dev, name, ...) ({ \
+ char *_fw; \
+@@ -305,6 +306,9 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
+ else if (cmd & __MCU_CMD_FIELD_WM)
+ uni_txd->s2d_index = MCU_S2D_H2N;
+
++ trace_mt7996_mcu_cmd(dev, 1, uni_txd->cid, 0,
++ skb->data, skb->len);
++
+ goto exit;
+ }
+
+@@ -332,6 +336,8 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
+ else
+ mcu_txd->s2d_index = MCU_S2D_H2N;
+
++ trace_mt7996_mcu_cmd(dev, 0, mcu_txd->cid, mcu_txd->ext_cid,
++ skb->data, skb->len);
+ exit:
+ #ifdef CONFIG_MTK_DEBUG
+ if (dev->dbg.dump_mcu_pkt)
+@@ -1177,6 +1183,8 @@ void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+ struct mt7996_mcu_rxd *rxd = (struct mt7996_mcu_rxd *)skb->data;
+
++ trace_mt7996_mcu_event(dev, rxd->option & MCU_UNI_CMD_UNSOLICITED_EVENT,
++ rxd->eid, rxd->ext_eid, skb->data, skb->len);
+ if (rxd->option & MCU_UNI_CMD_UNSOLICITED_EVENT) {
+ mt7996_mcu_uni_rx_unsolicited_event(dev, skb);
+ return;
+diff --git a/mt7996/mt7996_trace.h b/mt7996/mt7996_trace.h
+new file mode 100644
+index 00000000..5fa73482
+--- /dev/null
++++ b/mt7996/mt7996_trace.h
+@@ -0,0 +1,141 @@
++/* SPDX-License-Identifier: ISC */
++/*
++ * Copyright (C) 2022 MediaTek Inc.
++ */
++
++#if !defined(__MT7996_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
++#define __MT7996_TRACE_H
++
++#include <linux/types.h>
++#include <linux/tracepoint.h>
++#include "mt7996.h"
++
++#undef TRACE_SYSTEM
++#define TRACE_SYSTEM mt7996
++
++#define MAXNAME 32
++#define DEV_ENTRY __array(char, wiphy_name, 32)
++#define DEV_ASSIGN(_w) strlcpy(__entry->wiphy_name, wiphy_name(_w), MAXNAME)
++#define DEV_PR_FMT "%s"
++#define DEV_PR_ARG __entry->wiphy_name
++
++DECLARE_EVENT_CLASS(mt7996_mcu_debug,
++ TP_PROTO(struct mt7996_dev *dev, bool uni, u8 id, u8 ext_id,
++ const void *data, size_t len),
++ TP_ARGS(dev, uni, id, ext_id, data, len),
++ TP_STRUCT__entry(
++ __field(bool, uni)
++ __field(u8, id)
++ __field(u8, ext_id)
++ __field(size_t, len)
++ __dynamic_array(u8, data, len)
++ ),
++ TP_fast_assign(
++ __entry->uni = uni;
++ __entry->id = id;
++ __entry->ext_id = ext_id;
++ __entry->len = len;
++ memcpy(__get_dynamic_array(data), data, len);
++ ),
++ TP_printk(
++ "uni: %d, id: %u, ext_id: %u, len: %zu",
++ __entry->uni,
++ __entry->id,
++ __entry->ext_id,
++ __entry->len
++ )
++);
++
++DEFINE_EVENT(mt7996_mcu_debug, mt7996_mcu_cmd,
++ TP_PROTO(struct mt7996_dev *dev, bool uni, u8 id, u8 ext_id,
++ const void *data, size_t len),
++ TP_ARGS(dev, uni, id, ext_id, data, len)
++);
++
++DEFINE_EVENT(mt7996_mcu_debug, mt7996_mcu_event,
++ TP_PROTO(struct mt7996_dev *dev, bool uni, u8 id, u8 ext_id,
++ const void *data, size_t len),
++ TP_ARGS(dev, uni, id, ext_id, data, len)
++);
++
++TRACE_EVENT(mt7996_tx_prepare,
++ TP_PROTO(struct mt7996_dev *dev, struct mt76_wcid *wcid, enum mt76_txq_id qid,
++ const void *txwi, const void *data, size_t len),
++ TP_ARGS(dev, wcid, qid, txwi, data, len),
++
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u16, wcid)
++ __field(u8, qid)
++ __array(u8, txwi, MT_TXD_SIZE)
++ __field(size_t, len)
++ __dynamic_array(u8, data, len)
++ ),
++
++ TP_fast_assign(
++ DEV_ASSIGN(dev->mt76.phys[wcid->phy_idx]->hw->wiphy);
++ __entry->wcid = wcid->idx;
++ __entry->qid = qid;
++ memcpy(__entry->txwi, txwi, MT_TXD_SIZE);
++ __entry->len = len;
++ memcpy(__get_dynamic_array(data), data, len);
++ ),
++
++ TP_printk(
++ DEV_PR_FMT " wcid: %u, qid: %u, len: %zu",
++ DEV_PR_ARG, __entry->wcid, __entry->qid, __entry->len
++ )
++);
++
++TRACE_EVENT(mt7996_fill_rx,
++ TP_PROTO(struct mt7996_phy *phy, const void *data, size_t len),
++ TP_ARGS(phy, data, len),
++
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(size_t, len)
++ __dynamic_array(u8, data, len)
++ ),
++
++ TP_fast_assign(
++ DEV_ASSIGN(phy->mt76->hw->wiphy);
++ __entry->len = len;
++ memcpy(__get_dynamic_array(data), data, len);
++ ),
++
++ TP_printk(
++ DEV_PR_FMT " len: %zu",
++ DEV_PR_ARG, __entry->len
++ )
++);
++
++TRACE_EVENT(mt7996_fill_rx_done,
++ TP_PROTO(struct mt7996_phy *phy, u16 seqno, u16 hdr_gap),
++ TP_ARGS(phy, seqno, hdr_gap),
++
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u16, seqno)
++ __field(u16, hdr_gap)
++ ),
++
++ TP_fast_assign(
++ DEV_ASSIGN(phy->mt76->hw->wiphy);
++ __entry->seqno = seqno;
++ __entry->hdr_gap = hdr_gap;
++ ),
++
++ TP_printk(
++ DEV_PR_FMT " seqno: %u, hdr_gap: %u",
++ DEV_PR_ARG, __entry->seqno, __entry->hdr_gap
++ )
++);
++
++#endif
++
++#undef TRACE_INCLUDE_PATH
++#define TRACE_INCLUDE_PATH ./mt7996
++#undef TRACE_INCLUDE_FILE
++#define TRACE_INCLUDE_FILE mt7996_trace
++
++#include <trace/define_trace.h>
+diff --git a/mt7996/trace.c b/mt7996/trace.c
+new file mode 100644
+index 00000000..ba36f79a
+--- /dev/null
++++ b/mt7996/trace.c
+@@ -0,0 +1,12 @@
++/* SPDX-License-Identifier: ISC */
++/*
++ * Copyright (C) 2022 MediaTek Inc.
++ */
++
++#include <linux/module.h>
++
++#ifndef __CHECKER__
++#define CREATE_TRACE_POINTS
++#include "mt7996_trace.h"
++
++#endif
+diff --git a/trace.h b/trace.h
+index c3d0ef8e..57c94c6b 100644
+--- a/trace.h
++++ b/trace.h
+@@ -101,6 +101,64 @@ DEFINE_EVENT(dev_txid_evt, mac_txdone,
+ TP_ARGS(dev, wcid, pktid)
+ );
+
++TRACE_EVENT(mt76_rx_complete,
++ TP_PROTO(struct mt76_dev *dev, struct mt76_rx_status *status, bool sub),
++ TP_ARGS(dev, status, sub),
++
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u16, seqno)
++ __field(u16, wcid)
++ __field(u8, first_amsdu)
++ __field(bool, sub)
++ ),
++
++ TP_fast_assign(
++ strlcpy(__entry->wiphy_name,
++ wiphy_name(mt76_dev_phy(dev, status->phy_idx)->hw->wiphy),
++ MAXNAME);
++ __entry->seqno = status->seqno;
++ __entry->wcid = status->wcid ? status->wcid->idx : 0;
++ __entry->first_amsdu = status->first_amsdu;
++ __entry->sub = sub;
++ ),
++
++ TP_printk(
++ DEV_PR_FMT " seqno: %u, wcid: %u, first_amsdu: %x, sub: %d",
++ DEV_PR_ARG, __entry->seqno, __entry->wcid, __entry->first_amsdu,
++ __entry->sub
++ )
++);
++
++TRACE_EVENT(mt76_rx_aggr_reorder,
++ TP_PROTO(struct mt76_dev *dev, struct mt76_wcid *wcid, u16 _head, u16 seqno, bool sn_less),
++ TP_ARGS(dev, wcid, _head, seqno, sn_less),
++
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u16, wcid)
++ __field(u16, _head)
++ __field(u16, seqno)
++ __field(bool, sn_less)
++ ),
++
++ TP_fast_assign(
++ strlcpy(__entry->wiphy_name,
++ wiphy_name(dev->phys[wcid->phy_idx]->hw->wiphy),
++ MAXNAME);
++ __entry->wcid = wcid->idx;
++ __entry->_head = _head;
++ __entry->seqno = seqno;
++ __entry->sn_less = sn_less;
++ ),
++
++ TP_printk(
++ DEV_PR_FMT " wcid: %u, head: %u, seqno: %u, sn_less: %d",
++ DEV_PR_ARG, __entry->wcid, __entry->_head, __entry->seqno,
++ __entry->sn_less
++ )
++);
++
+ #endif
+
+ #undef TRACE_INCLUDE_PATH
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0122-mtk-mt76-temp-changes-for-SQC-period.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0122-mtk-mt76-temp-changes-for-SQC-period.patch
new file mode 100644
index 0000000..335413f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0122-mtk-mt76-temp-changes-for-SQC-period.patch
@@ -0,0 +1,225 @@
+From 59bc821a3e6440f117f8e864e468a1c297be482a Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <meichia.chiu@mediatek.com>
+Date: Fri, 9 Jun 2023 14:11:30 +0800
+Subject: [PATCH 122/199] mtk: mt76: temp changes for SQC period
+
+mtk: wifi: mt76: mt7996: For SQC test Disable single sku
+
+During SQC testing, disable single sku to prevent max power from
+being restricted by regdb setting
+
+NOTE: This patch is only for apply during SQC and will be
+removed after SQC.
+
+mtk: wifi: mt76: mt7996: Enable WM/WA UART log during the SQC period
+
+Enable WM/WA UART log by default during the SQC period
+
+mtk: wifi: mt76: mt7996: add SER flow log for debug during the SQC period.
+
+Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
+Signed-off-by: mtk27745 <rex.lu@mediatek.com>
+---
+ mt7996/dma.c | 39 +++++++++++++++++++++++++++++++++++++++
+ mt7996/mac.c | 29 +++++++++++++++++++++++++++++
+ mt7996/mcu.c | 4 ++--
+ mt7996/mtk_debugfs.c | 1 +
+ 4 files changed, 71 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/dma.c b/mt7996/dma.c
+index a2490fa7..bbc3814d 100644
+--- a/mt7996/dma.c
++++ b/mt7996/dma.c
+@@ -800,11 +800,23 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
+ for (i = 0; i < __MT_MCUQ_MAX; i++)
+ mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[i], true);
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER tx queue clean up done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt76_for_each_q_rx(&dev->mt76, i)
+ mt76_queue_rx_cleanup(dev, &dev->mt76.q_rx[i]);
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER rx queue clean up done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt76_tx_status_check(&dev->mt76, true);
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER mt76_tx_status_check done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ /* reset wfsys */
+ if (force)
+ mt7996_wfsys_reset(dev);
+@@ -815,7 +827,15 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
+ mtk_wed_device_dma_reset(&dev->mt76.mmio.wed);
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER wed dma reset done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt7996_dma_disable(dev, force);
++
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER dma disable done.",
++ wiphy_name(dev->mt76.hw->wiphy));
+ mt76_wed_dma_reset(&dev->mt76);
+
+ /* reset hw queues */
+@@ -827,9 +847,16 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
+ mt76_dma_reset_tx_queue(&dev->mt76, phy3->q_tx[i]);
+ }
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER dma tx queue reset done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ for (i = 0; i < __MT_MCUQ_MAX; i++)
+ mt76_queue_reset(dev, dev->mt76.q_mcu[i], true);
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER mcu queue reset done.",
++ wiphy_name(dev->mt76.hw->wiphy));
+ mt76_for_each_q_rx(&dev->mt76, i) {
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
+ if (mt76_queue_is_wed_rro(&dev->mt76.q_rx[i]) ||
+@@ -843,6 +870,10 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
+ mt76_queue_reset(dev, &dev->mt76.q_rx[i], true);
+ }
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER rx queue reset done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt76_tx_status_check(&dev->mt76, true);
+
+ mt76_for_each_q_rx(&dev->mt76, i) {
+@@ -854,7 +885,15 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
+ mt76_queue_rx_reset(dev, i);
+ }
+
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER rx queue rx reset done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt7996_dma_enable(dev, !force);
++
++ if (!force)
++ dev_info(dev->mt76.dev,"%s L1 SER dma enable done.",
++ wiphy_name(dev->mt76.hw->wiphy));
+ }
+
+ void mt7996_dma_cleanup(struct mt7996_dev *dev)
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 6ba07156..fc83cea1 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1980,6 +1980,9 @@ void mt7996_mac_reset_work(struct work_struct *work)
+ if (phy3)
+ ieee80211_stop_queues(phy3->mt76->hw);
+
++ dev_info(dev->mt76.dev,"%s L1 SER queue stop done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ set_bit(MT76_RESET, &dev->mphy.state);
+ set_bit(MT76_MCU_RESET, &dev->mphy.state);
+ if (phy2)
+@@ -1989,6 +1992,10 @@ void mt7996_mac_reset_work(struct work_struct *work)
+ wake_up(&dev->mt76.mcu.wait);
+
+ mt76_worker_disable(&dev->mt76.tx_worker);
++
++ dev_info(dev->mt76.dev,"%s L1 SER disable tx_work done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt76_for_each_q_rx(&dev->mt76, i) {
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
+ mt76_queue_is_wed_rro(&dev->mt76.q_rx[i]))
+@@ -1998,14 +2005,30 @@ void mt7996_mac_reset_work(struct work_struct *work)
+ }
+ napi_disable(&dev->mt76.tx_napi);
+
++ dev_info(dev->mt76.dev,"%s L1 SER napi disable done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_STOPPED);
+
++ dev_info(dev->mt76.dev,"%s L1 SER dma stop done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ if (mt7996_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) {
+ mt7996_dma_reset(dev, false);
+
++ dev_info(dev->mt76.dev,"%s L1 SER dma reset done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt7996_tx_token_put(dev);
++
++ dev_info(dev->mt76.dev,"%s L1 SER token put done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ idr_init(&dev->mt76.token);
+
++ dev_info(dev->mt76.dev,"%s L1 SER idr init done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_INIT);
+ mt7996_wait_reset_state(dev, MT_MCU_CMD_RECOVERY_DONE);
+ }
+@@ -2016,6 +2039,9 @@ void mt7996_mac_reset_work(struct work_struct *work)
+ /* enable DMA Tx/Tx and interrupt */
+ mt7996_dma_start(dev, false, false);
+
++ dev_info(dev->mt76.dev,"%s L1 SER dma start done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
+ u32 wed_irq_mask = MT_INT_RRO_RX_DONE | MT_INT_TX_DONE_BAND2 |
+ dev->mt76.mmio.irqmask;
+@@ -2042,6 +2068,9 @@ void mt7996_mac_reset_work(struct work_struct *work)
+ MT_INT_TX_RX_DONE_EXT);
+ }
+
++ dev_info(dev->mt76.dev,"%s L1 SER wed start done.",
++ wiphy_name(dev->mt76.hw->wiphy));
++
+ clear_bit(MT76_MCU_RESET, &dev->mphy.state);
+ clear_bit(MT76_RESET, &dev->mphy.state);
+ if (phy2)
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 1cc08a30..a88beb36 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -3850,11 +3850,11 @@ int mt7996_mcu_init_firmware(struct mt7996_dev *dev)
+ return ret;
+
+ set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
+- ret = mt7996_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0);
++ ret = mt7996_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 1);
+ if (ret)
+ return ret;
+
+- ret = mt7996_mcu_fw_log_2_host(dev, MCU_FW_LOG_WA, 0);
++ ret = mt7996_mcu_fw_log_2_host(dev, MCU_FW_LOG_WA, 1);
+ if (ret)
+ return ret;
+
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index c7f5b56e..0820e0d0 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -4298,6 +4298,7 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ debugfs_create_file("red", 0200, dir, dev, &fops_red_config);
+ debugfs_create_file("vow_drr_dbg", 0200, dir, dev, &fops_vow_drr_dbg);
+
++ dev->dbg.sku_disable = true; /* For SQC */
+ debugfs_create_u8("sku_disable", 0600, dir, &dev->dbg.sku_disable);
+ debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0116-mtk-wifi-mt76-mt7996-remain-multiple-wiphy-model-for.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0123-mtk-mt76-mt7996-remain-multiple-wiphy-model-for-test.patch
similarity index 85%
rename from recipes-wifi/linux-mt76/files/patches-3.x/0116-mtk-wifi-mt76-mt7996-remain-multiple-wiphy-model-for.patch
rename to recipes-wifi/linux-mt76/files/patches-3.x/0123-mtk-mt76-mt7996-remain-multiple-wiphy-model-for-test.patch
index 351cb74..7c5f0e4 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/0116-mtk-wifi-mt76-mt7996-remain-multiple-wiphy-model-for.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0123-mtk-mt76-mt7996-remain-multiple-wiphy-model-for-test.patch
@@ -1,8 +1,8 @@
-From 81a4701e1fb249ce062c5d17e6c670265ef0f05e Mon Sep 17 00:00:00 2001
+From f4f602099ba8cfdf81172f1d3789d810439cc174 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 22 Apr 2024 16:49:48 +0800
-Subject: [PATCH 116/116] mtk: wifi: mt76: mt7996: remain multiple wiphy model
- for testmode
+Subject: [PATCH 123/199] mtk: mt76: mt7996: remain multiple wiphy model for
+ testmode
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -12,10 +12,10 @@
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/mt7996/init.c b/mt7996/init.c
-index ff72aab..58944c6 100644
+index 057d20db..9da12f07 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -794,9 +794,11 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -795,9 +795,11 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
mtk_wed_device_start(&dev->mt76.mmio.wed_hif2, MT_INT_TX_RX_DONE_EXT);
}
@@ -30,7 +30,7 @@
return 0;
-@@ -832,8 +834,9 @@ mt7996_unregister_phy(struct mt7996_phy *phy, enum mt76_band_id band)
+@@ -833,8 +835,9 @@ mt7996_unregister_phy(struct mt7996_phy *phy, enum mt76_band_id band)
if (!phy)
return;
@@ -43,7 +43,7 @@
#ifdef CONFIG_MTK_VENDOR
mt7996_unregister_csi(phy);
diff --git a/mt7996/main.c b/mt7996/main.c
-index 2cc0c32..9738e76 100644
+index fa9486e4..f52bb2f9 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -140,8 +140,8 @@ static int mt7996_start(struct ieee80211_hw *hw)
@@ -68,7 +68,7 @@
return;
cancel_delayed_work_sync(&dev->scs_work);
-@@ -453,6 +453,12 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
+@@ -455,6 +455,12 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
is_zero_ether_addr(vif->addr))
phy->monitor_vif = vif;
@@ -82,10 +82,10 @@
mvif->dev = dev;
mvif->hw = hw;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index de7cf1e..45f8af1 100644
+index ef544957..827c24bf 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
-@@ -860,16 +860,15 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
+@@ -876,16 +876,15 @@ mt7996_get_background_radar_cap(struct mt7996_dev *dev)
static inline struct mt7996_phy *
mt7996_band_phy(struct ieee80211_hw *hw, enum nl80211_band band)
{
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0124-mtk-mt76-mt7996-enable-ibf-capability-for-mt7992.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0124-mtk-mt76-mt7996-enable-ibf-capability-for-mt7992.patch
new file mode 100644
index 0000000..14ec534
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0124-mtk-mt76-mt7996-enable-ibf-capability-for-mt7992.patch
@@ -0,0 +1,42 @@
+From a0cf73079cf52808d6b4196d433d62aebd751c16 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Tue, 23 Apr 2024 09:19:25 +0800
+Subject: [PATCH 124/199] mtk: mt76: mt7996: enable ibf capability for mt7992
+
+For the specific sku of mt7992, it supports both ibf and ebf
+functionality. The firmware algorithm may decide which type is better
+according to the station's beamform capability.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/mcu.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index a88beb36..28123fb7 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -2265,6 +2265,8 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+ struct ieee80211_bss_conf *conf, struct mt7996_bss_conf *mconf,
+ struct ieee80211_link_sta *link_sta)
+ {
++#define EBF_MODE BIT(0)
++#define IBF_MODE BIT(1)
+ struct mt7996_phy *phy = mconf->phy;
+ int tx_ant = hweight16(phy->mt76->chainmask) - 1;
+ struct sta_rec_bf *bf;
+@@ -2302,7 +2304,10 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+ else
+ return;
+
+- bf->bf_cap = ebf ? ebf : dev->ibf << 1;
++ bf->bf_cap = ebf ? EBF_MODE : (dev->ibf ? IBF_MODE : 0);
++ if (is_mt7992(&dev->mt76) &&
++ tx_ant == hweight8(phy->mt76->hw->wiphy->available_antennas_tx))
++ bf->bf_cap |= IBF_MODE;
+ bf->bw = link_sta->bandwidth;
+ bf->ibf_dbw = link_sta->bandwidth;
+ bf->ibf_nrow = tx_ant;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0125-mtk-mt76-remove-the-limitation-for-legacy-AP-sacn.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0125-mtk-mt76-remove-the-limitation-for-legacy-AP-sacn.patch
new file mode 100644
index 0000000..cc53fd1
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0125-mtk-mt76-remove-the-limitation-for-legacy-AP-sacn.patch
@@ -0,0 +1,38 @@
+From 6ae8ff7998348080caa661a1e31c36febd3443ee Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Thu, 2 May 2024 15:40:21 +0800
+Subject: [PATCH 125/199] mtk: mt76: remove the limitation for legacy AP sacn
+
+The limitation was used to prevent resource conflict in multiple wiphys
+architecture. It becomes single wiphy and the limitation seems to be
+useless.
+
+Furthermore, legacy APs need to scan due to features like ACS, so remove
+the limitations
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/mac.c | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index fc83cea1..bba16975 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2968,13 +2968,6 @@ void mt7996_scan_work(struct work_struct *work)
+ bool has_sta = false, active_scan = false;
+
+ mutex_lock(&phy->dev->mt76.mutex);
+- /* don't let non-MLD AP scan other bands */
+- if (vif->type != NL80211_IFTYPE_STATION && !ieee80211_vif_is_mld(vif) &&
+- phy != mt7996_hw_phy(hw)) {
+- mt7996_scan_complete(phy, false);
+- mutex_unlock(&phy->dev->mt76.mutex);
+- return;
+- }
+
+ if (phy->scan_chan_idx >= req->n_channels) {
+ mt7996_scan_complete(phy, false);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0126-mtk-mt76-add-support-for-get_survey-in-single-wiphy-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0126-mtk-mt76-add-support-for-get_survey-in-single-wiphy-.patch
new file mode 100644
index 0000000..34d5ad6
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0126-mtk-mt76-add-support-for-get_survey-in-single-wiphy-.patch
@@ -0,0 +1,72 @@
+From 749af4a20ff5d2fb111346a1251fc2aab471986c Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Thu, 2 May 2024 15:22:22 +0800
+Subject: [PATCH 126/199] mtk: mt76: add support for get_survey in single wiphy
+ architecture
+
+---
+ mac80211.c | 45 +++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 35 insertions(+), 10 deletions(-)
+
+diff --git a/mac80211.c b/mac80211.c
+index dc91e827..589c37af 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -912,19 +912,44 @@ int mt76_get_survey(struct ieee80211_hw *hw, int idx,
+ if (idx == 0 && dev->drv->update_survey)
+ mt76_update_survey(phy);
+
+- if (idx >= phy->sband_2g.sband.n_channels +
+- phy->sband_5g.sband.n_channels) {
+- idx -= (phy->sband_2g.sband.n_channels +
+- phy->sband_5g.sband.n_channels);
+- sband = &phy->sband_6g;
+- } else if (idx >= phy->sband_2g.sband.n_channels) {
+- idx -= phy->sband_2g.sband.n_channels;
+- sband = &phy->sband_5g;
++ if (phy->hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) {
++ struct mt76_phy *phy0, *phy1, *phy2;
++
++ phy0 = dev->phys[MT_BAND0];
++ phy1 = dev->phys[MT_BAND1];
++ phy2 = dev->phys[MT_BAND2];
++
++ /* TODO: mlo: temporarily hardcode */
++ /* FIXME only works on Eagle & Kite */
++ if (idx >= phy0->sband_2g.sband.n_channels +
++ phy1->sband_5g.sband.n_channels) {
++ idx -= (phy0->sband_2g.sband.n_channels +
++ phy1->sband_5g.sband.n_channels);
++ sband = phy2 ? &phy2->sband_6g : NULL;
++ phy = phy2;
++ } else if (idx >= phy0->sband_2g.sband.n_channels) {
++ idx -= phy0->sband_2g.sband.n_channels;
++ sband = &phy1->sband_5g;
++ phy = phy1;
++ } else {
++ sband = &phy0->sband_2g;
++ phy = phy0;
++ }
+ } else {
+- sband = &phy->sband_2g;
++ if (idx >= phy->sband_2g.sband.n_channels +
++ phy->sband_5g.sband.n_channels) {
++ idx -= (phy->sband_2g.sband.n_channels +
++ phy->sband_5g.sband.n_channels);
++ sband = &phy->sband_6g;
++ } else if (idx >= phy->sband_2g.sband.n_channels) {
++ idx -= phy->sband_2g.sband.n_channels;
++ sband = &phy->sband_5g;
++ } else {
++ sband = &phy->sband_2g;
++ }
+ }
+
+- if (idx >= sband->sband.n_channels) {
++ if (!sband || idx >= sband->sband.n_channels) {
+ ret = -ENOENT;
+ goto out;
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0127-mtk-mt76-mt7996-add-critical-update-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0127-mtk-mt76-mt7996-add-critical-update-support.patch
new file mode 100644
index 0000000..66e1603
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0127-mtk-mt76-mt7996-add-critical-update-support.patch
@@ -0,0 +1,395 @@
+From 8a5fc9a07ebf08ffdd31d05beaa2d399b67f6a10 Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Tue, 23 Apr 2024 15:22:24 +0800
+Subject: [PATCH 127/199] mtk: mt76: mt7996: add critical update support
+
+Add critical update support
+modification: wmm configuration
+inclusion: channel switch
+(affiliated link's per-STA profile CSA/eCSA countdown is included)
+
+Fix the CU flag countdown issue of the non-CU link as reported from cert.
+1. Avoid setting the CSA beacon twice during channel switch.
+2. Raise the bypass_seq_bitmap up for the non-CU link.
+
+Reset the beacon when switching channels during CAC
+Otherwise, the FW will not be able to perform the CSA countdown.
+Also, modify the bpcc check since channel switch will add the bpcc twice
+(before CSA and after CSA).
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt76_connac_mcu.h | 2 +
+ mt7996/main.c | 107 +++++++++++++++++++++++++++++++++-------------
+ mt7996/mcu.c | 99 ++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mcu.h | 26 ++++++++++-
+ mt7996/mt7996.h | 4 ++
+ 5 files changed, 208 insertions(+), 30 deletions(-)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 870417f3..57cae8ae 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1380,6 +1380,8 @@ enum {
+ UNI_BSS_INFO_OFFLOAD = 25,
+ UNI_BSS_INFO_MLD = 26,
+ UNI_BSS_INFO_PM_DISABLE = 27,
++ UNI_BSS_INFO_BCN_CRIT_UPDATE = 32,
++ UNI_BSS_INFO_BCN_STA_PROF_CSA = 37,
+ };
+
+ enum {
+diff --git a/mt7996/main.c b/mt7996/main.c
+index f52bb2f9..0d25d763 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -370,6 +370,7 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
+ mconf->mt76.band_idx = band_idx;
+ mconf->mt76.wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
+ mconf->link_id = link_id;
++ mconf->bpcc = 0;
+
+ ret = mt7996_mcu_add_dev_info(phy, conf, mconf, true);
+ if (ret)
+@@ -979,7 +980,9 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
+ mconf->mt76.beacon_rates_idx =
+ mt7996_get_rates_table(hw, info, mconf, true, false);
+
+- mt7996_mcu_add_beacon(hw, info, mconf, info->enable_beacon);
++ /* The CSA beacon will be set in channel_switch_beacon */
++ if (!info->csa_active)
++ mt7996_mcu_add_beacon(hw, info, mconf, info->enable_beacon);
+ }
+
+ if (changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
+@@ -1030,21 +1033,45 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_phy *phy = mt7996_band_phy(hw, chandef->chan->band);
+- unsigned long valid_links = vif->valid_links ?: BIT(0);
++ struct ieee80211_bss_conf *conf;
++ struct mt7996_bss_conf *mconf;
++ u16 valid_links = vif->valid_links ?: BIT(0);
+ unsigned int link_id;
+
+ mutex_lock(&dev->mt76.mutex);
+- for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+- struct mt7996_bss_conf *mconf =
+- mconf_dereference_protected(mvif, link_id);
+- struct ieee80211_bss_conf *conf =
+- link_conf_dereference_protected(vif, link_id);
++ link_id = mvif->band_to_link[phy->mt76->band_idx];
+
+- if (!mconf || phy != mconf->phy)
+- continue;
++ if (!mvif->cs_ready_links)
++ mvif->cs_link_id = link_id;
++
++ mvif->cs_ready_links |= BIT(link_id);
++ if (mvif->cs_ready_links != valid_links)
++ goto out;
++
++ link_id = mvif->cs_link_id;
++ do {
++ valid_links &= ~BIT(link_id);
++ mconf = mconf_dereference_protected(mvif, link_id);
++ conf = link_conf_dereference_protected(vif, link_id);
++ if (!conf || !mconf)
++ goto fail;
++
++ /* Reset the beacon when switching channels during CAC */
++ if (link_id == mvif->cs_link_id &&
++ !cfg80211_reg_can_beacon(hw->wiphy, &phy->mt76->chandef, vif->type))
++ mt7996_mcu_add_beacon(hw, conf, mconf, false);
+
+ mt7996_mcu_add_beacon(hw, conf, mconf, true);
+- }
++ link_id = ffs(valid_links) - 1;
++ } while (valid_links);
++
++out:
++ mutex_unlock(&dev->mt76.mutex);
++ return;
++fail:
++ mvif->cs_ready_links = 0;
++ mvif->cs_link_id = IEEE80211_LINK_UNSPECIFIED;
++ dev_err(dev->mt76.dev, "link %d: failed to switch beacon\n", link_id);
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
+@@ -2534,32 +2561,54 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+ int n_vifs,
+ enum ieee80211_chanctx_switch_mode mode)
+ {
+- struct mt7996_chanctx *old_ctx = mt7996_chanctx_get(vifs->old_ctx);
+- struct mt7996_chanctx *new_ctx = mt7996_chanctx_get(vifs->new_ctx);
+- struct mt7996_phy *phy = old_ctx->phy;
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct mt7996_chanctx *old_ctx;
++ struct mt7996_chanctx *new_ctx;
++ struct mt7996_phy *phy;
++ int i, ret = 0;
+
+- wiphy_info(hw->wiphy, "%s: old=%d, new=%d\n", __func__, vifs->old_ctx->def.chan->hw_value, vifs->new_ctx->def.chan->hw_value);
++ for (i = 0; i < n_vifs; i++) {
++ if (vifs[i].old_ctx == vifs[i].new_ctx)
++ continue;
+
+- if (new_ctx->nbss_assigned && phy->chanctx == new_ctx) {
+- new_ctx->nbss_assigned += n_vifs;
+- return 0;
+- }
++ wiphy_info(hw->wiphy, "%s: old=%d, new=%d\n",
++ __func__, vifs[i].old_ctx->def.chan->hw_value,
++ vifs[i].new_ctx->def.chan->hw_value);
+
+- if (WARN_ON(old_ctx != phy->chanctx))
+- return -EINVAL;
++ mutex_lock(&dev->mt76.mutex);
+
+- mutex_lock(&phy->dev->mt76.mutex);
++ old_ctx = mt7996_chanctx_get(vifs[i].old_ctx);
++ new_ctx = mt7996_chanctx_get(vifs[i].new_ctx);
++ phy = old_ctx->phy;
+
+- phy->chanctx = new_ctx;
+- phy->mt76->radar_enabled = vifs->new_ctx->radar_enabled;
+- new_ctx->assigned = true;
+- new_ctx->chandef = vifs->new_ctx->def;
+- new_ctx->phy = phy;
+- new_ctx->nbss_assigned += n_vifs;
++ if (new_ctx->nbss_assigned && phy->chanctx == new_ctx) {
++ new_ctx->nbss_assigned++;
++ mutex_unlock(&dev->mt76.mutex);
++ continue;
++ }
+
+- mutex_unlock(&phy->dev->mt76.mutex);
++ if (WARN_ON(old_ctx != phy->chanctx)) {
++ ret = -EINVAL;
++ mutex_unlock(&dev->mt76.mutex);
++ goto out;
++ }
++
++ phy->chanctx = new_ctx;
++ phy->mt76->radar_enabled = vifs[i].new_ctx->radar_enabled;
++ new_ctx->assigned = true;
++ new_ctx->chandef = vifs[i].new_ctx->def;
++ new_ctx->phy = phy;
++ new_ctx->nbss_assigned++;
++
++ mutex_unlock(&dev->mt76.mutex);
++
++ ret = mt7996_set_channel(phy, &new_ctx->chandef);
++ if (ret)
++ goto out;
++ }
+
+- return mt7996_set_channel(phy, &new_ctx->chandef);
++out:
++ return ret;
+ }
+
+ static int
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 28123fb7..ea69b66f 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -370,6 +370,7 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ struct mt76_phy *mphy = (struct mt76_phy *)priv;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct ieee80211_bss_conf *link_conf;
++ unsigned long valid_links = vif->valid_links ?: BIT(0);
+ int link_id, band_idx = mphy->band_idx;
+
+ link_id = mvif->band_to_link[band_idx];
+@@ -378,7 +379,16 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ if (!link_conf || !link_conf->csa_active || vif->type == NL80211_IFTYPE_STATION)
+ return;
+
++ pr_info("%s: link_id=%d\n", __func__, link_id);
++ mvif->cs_ready_links = 0;
++ mvif->cs_link_id = IEEE80211_LINK_UNSPECIFIED;
+ ieee80211_csa_finish(vif, link_id);
++ /* remove CSA for affiliated links */
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ if (link_id == link_conf->link_id)
++ continue;
++ ieee80211_csa_finish(vif, link_id);
++ }
+ }
+
+ static void
+@@ -3235,6 +3245,93 @@ mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
+ }
+ }
+
++static bool
++mt7996_mcu_beacon_is_cu_link(struct sk_buff *skb, struct mt7996_bss_conf *mconf,
++ u16 tail_offset)
++{
++ const struct element *elem;
++ u8 *beacon_tail = skb->data + tail_offset;
++ bool has_ml_ie = false;
++ int bpcc;
++
++ for_each_element_extid(elem, WLAN_EID_EXT_EHT_MULTI_LINK,
++ beacon_tail, skb->len - tail_offset)
++ if (ieee80211_mle_type_ok(elem->data + 1,
++ IEEE80211_ML_CONTROL_TYPE_BASIC,
++ elem->datalen - 1)) {
++ has_ml_ie = true;
++ break;
++ }
++
++ if (!has_ml_ie)
++ return false;
++
++ bpcc = ieee80211_mle_get_bss_param_ch_cnt(elem->data + 1);
++ if (bpcc < 0 || bpcc == mconf->bpcc)
++ return false;
++
++ mconf->bpcc = bpcc;
++
++ return true;
++}
++
++static void
++mt7996_mcu_beacon_crit_update(struct sk_buff *rskb, struct sk_buff *skb,
++ struct ieee80211_bss_conf *conf,
++ struct mt7996_bss_conf *mconf,
++ struct ieee80211_mutable_offsets *offs)
++{
++ struct ieee80211_mgmt *mgmt = (void *)skb->data;
++ struct bss_bcn_crit_update_tlv *crit;
++ struct tlv *tlv;
++
++ if (!ieee80211_vif_is_mld(conf->vif) ||
++ !(mgmt->u.beacon.capab_info & WLAN_CAPABILITY_PBCC))
++ return;
++
++ tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_CRIT_UPDATE, sizeof(*crit));
++
++ /* TODO: Support 11vMBSS */
++ crit = (struct bss_bcn_crit_update_tlv *)tlv;
++ crit->bss_bitmap = cpu_to_le32(BIT(0));
++ /* The beacon of the CU link should be set in sequence
++ * to ensure it appears in the air before the beacon of
++ * the non-CU link.
++ */
++ if (!mt7996_mcu_beacon_is_cu_link(skb, mconf, offs->tim_offset))
++ crit->bypass_seq_bitmap = cpu_to_le32(BIT(0));
++ else
++ crit->bypass_seq_bitmap = cpu_to_le32(0);
++ crit->tim_ie_pos[0] = cpu_to_le16(offs->tim_offset);
++ crit->cap_info_ie_pos[0] = cpu_to_le16(offsetof(struct ieee80211_mgmt,
++ u.beacon.capab_info));
++}
++
++static void
++mt7996_mcu_beacon_sta_prof_csa(struct sk_buff *rskb,
++ struct ieee80211_bss_conf *conf,
++ struct ieee80211_mutable_offsets *offs)
++{
++ struct ieee80211_vif *vif = conf->vif;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_bss_conf *cs_mconf;
++ struct bss_bcn_sta_prof_cntdwn_tlv *sta_prof;
++ struct tlv *tlv;
++
++ if (!ieee80211_vif_is_mld(vif) || !offs->sta_prof_cntdwn_offs[0])
++ return;
++
++ cs_mconf = mconf_dereference_protected(mvif, mvif->cs_link_id);
++ if (!cs_mconf)
++ return;
++
++ tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_STA_PROF_CSA, sizeof(*sta_prof));
++
++ sta_prof = (struct bss_bcn_sta_prof_cntdwn_tlv *)tlv;
++ sta_prof->sta_prof_csa_offs = cpu_to_le16(offs->sta_prof_cntdwn_offs[0] - 4);
++ sta_prof->cs_bss_idx = cs_mconf->mt76.idx;
++}
++
+ static void
+ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ struct sk_buff *rskb, struct sk_buff *skb,
+@@ -3315,6 +3412,8 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ mt7996_mcu_beacon_cont(dev, conf, rskb, skb, bcn, &offs);
+ mt7996_mcu_beacon_mbss(rskb, skb, conf, bcn, &offs);
+ mt7996_mcu_beacon_cntdwn(conf, rskb, skb, &offs);
++ mt7996_mcu_beacon_sta_prof_csa(rskb, conf, &offs);
++ mt7996_mcu_beacon_crit_update(rskb, skb, conf, mconf, &offs);
+ out:
+ dev_kfree_skb(skb);
+ return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 5e217719..c39dcc3c 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -503,6 +503,27 @@ struct bss_bcn_mbss_tlv {
+ __le16 offset[MAX_BEACON_NUM];
+ } __packed __aligned(4);
+
++struct bss_bcn_crit_update_tlv {
++ __le16 tag;
++ __le16 len;
++ __le32 bss_bitmap;
++ /* Bypass the beacon sequence handling in firmware for the
++ * BSSes in the bitmap. If the flag is set for a BSS, then the
++ * firmware will not set the beacon of the BSS in sequence.
++ */
++ __le32 bypass_seq_bitmap;
++ __le16 tim_ie_pos[32];
++ __le16 cap_info_ie_pos[32];
++} __packed;
++
++struct bss_bcn_sta_prof_cntdwn_tlv {
++ __le16 tag;
++ __le16 len;
++ __le16 sta_prof_csa_offs;
++ u8 cs_bss_idx;
++ u8 pkt_content[9];
++} __packed;
++
+ struct bss_txcmd_tlv {
+ __le16 tag;
+ __le16 len;
+@@ -954,7 +975,10 @@ enum {
+ sizeof(struct bss_bcn_content_tlv) + \
+ 4 + MT_TXD_SIZE + \
+ sizeof(struct bss_bcn_cntdwn_tlv) + \
+- sizeof(struct bss_bcn_mbss_tlv))
++ sizeof(struct bss_bcn_mbss_tlv) + \
++ sizeof(struct bss_bcn_crit_update_tlv) + \
++ sizeof(struct bss_bcn_sta_prof_cntdwn_tlv)) \
++
+ #define MT7996_MAX_BSS_OFFLOAD_SIZE (MT7996_MAX_BEACON_SIZE + \
+ MT7996_BEACON_UPDATE_SIZE)
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 827c24bf..78226f7b 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -351,6 +351,7 @@ struct mt7996_bss_conf {
+
+ u8 link_id;
+ u8 own_mld_id;
++ u8 bpcc;
+ };
+
+ struct mt7996_vif {
+@@ -365,6 +366,9 @@ struct mt7996_vif {
+ u8 group_mld_id;
+ u8 mld_remap_id;
+
++ u8 cs_link_id;
++ u16 cs_ready_links;
++
+ u8 band_to_link[__MT_MAX_BAND];
+
+ /* for beacon monitoring */
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0128-mtk-mt76-mt7996-Add-support-for-EMLSR.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0128-mtk-mt76-mt7996-Add-support-for-EMLSR.patch
new file mode 100644
index 0000000..8c0318f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0128-mtk-mt76-mt7996-Add-support-for-EMLSR.patch
@@ -0,0 +1,299 @@
+From 060df153443363c797ddfe40e3190c931bc4879a Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
+Date: Tue, 7 May 2024 15:47:23 +0800
+Subject: [PATCH 128/199] mtk: mt76: mt7996: Add support for EMLSR
+
+1. Register the EMLSR capability
+2. Set the EML capability of the station to firmware
+3. Process the EML Operating Mode Notification frame
+
+Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
+---
+ mt76_connac_mcu.h | 8 ++++++
+ mt7996/init.c | 1 +
+ mt7996/mcu.c | 60 +++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/mt7996.h | 19 ++++++++++++++
+ mt7996/vendor.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++
+ mt7996/vendor.h | 15 +++++++++++
+ 6 files changed, 166 insertions(+), 1 deletion(-)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 57cae8ae..d72337d4 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -624,6 +624,13 @@ struct sta_rec_tx_proc {
+ __le32 flag;
+ } __packed;
+
++struct sta_rec_eml_op {
++ __le16 tag;
++ __le16 len;
++ u8 bitmap;
++ u8 link_ant_num[3];
++} __packed;
++
+ /* wtbl_rec */
+
+ struct wtbl_req_hdr {
+@@ -828,6 +835,7 @@ enum {
+ STA_REC_PN_INFO = 0x26,
+ STA_REC_KEY_V3 = 0x27,
+ STA_REC_HDRT = 0x28,
++ STA_REC_EML_OP = 0x29,
+ STA_REC_HDR_TRANS = 0x2B,
+ STA_REC_TX_CAP = 0x2f,
+ STA_REC_MAX_NUM
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 9da12f07..2e624def 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -64,6 +64,7 @@ static const struct wiphy_iftype_ext_capab mt7996_iftypes_ext_capa[] = {
+ .extended_capabilities = mt7996_if_types_ext_capa,
+ .extended_capabilities_mask = mt7996_if_types_ext_capa,
+ .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa),
++ .eml_capabilities = IEEE80211_EML_CAP_EMLSR_SUPP,
+ .mld_capa_and_ops = 2,
+ /* the max number of simultaneous links is defined as the
+ * maximum number of affiliated APs minus 1.
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index ea69b66f..2a2e6116 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -2919,9 +2919,10 @@ mt7996_mcu_sta_eht_mld_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+
+ for (i = 0; i < ARRAY_SIZE(eht_mld->str_cap); i++)
+ eht_mld->str_cap[i] = 0x7;
++
++ eht_mld->eml_cap = cpu_to_le16(sta->eml_capa);
+ /* TODO:
+ eht_mld->nsep = ;
+- eht_mld->eml_cap = cpu_to_le16()
+ */
+ }
+
+@@ -6326,6 +6327,63 @@ int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy)
+ &req, sizeof(req), true);
+ }
+
++int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif,
++ u8 link_id,
++ struct ieee80211_sta *sta,
++ struct mt7996_eml_omn *eml_omn)
++{
++#define EML_OMN_CONTROL_EMLSR_MODE 0x01
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct mt7996_link_sta *mlink;
++ struct mt7996_bss_conf *mconf, *mconf_link;
++ struct sta_rec_eml_op *eml_op;
++ struct sk_buff *skb;
++ struct tlv *tlv;
++
++ mlink = mlink_dereference_protected(msta, link_id);
++ mconf = mconf_dereference_protected(mvif, link_id);
++
++ if (!mlink || !mconf)
++ return -EINVAL;
++
++ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76,
++ &mconf->mt76,
++ &mlink->wcid,
++ MT7996_STA_UPDATE_MAX_SIZE);
++
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++
++ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EML_OP, sizeof(*eml_op));
++ eml_op = (struct sta_rec_eml_op *) tlv;
++ eml_op->bitmap = 0;
++
++ if (eml_omn->control & EML_OMN_CONTROL_EMLSR_MODE) {
++ unsigned long bitmap = (unsigned long) le16_to_cpu(eml_omn->bitmap);
++ unsigned int linkid;
++
++ for_each_set_bit(linkid, &bitmap, IEEE80211_MLD_MAX_NUM_LINKS) {
++ mconf_link = mconf_dereference_protected(mvif, linkid);
++
++ if (!mconf_link)
++ continue;
++
++ eml_op->bitmap |= BIT(mconf_link->phy->mt76->band_idx);
++ }
++ }
++
++ mlo_dbg(mconf->phy, "link:%u, wcid:%d, control:%x, mode:%d, bmp:%x\n",
++ mlink->wcid.link_id, mlink->wcid.idx, eml_omn->control,
++ !!(eml_omn->control & EML_OMN_CONTROL_EMLSR_MODE),
++ eml_op->bitmap);
++
++ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
++ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
++}
++
+ #ifdef CONFIG_MTK_VENDOR
+ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+ {
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 78226f7b..c60262ec 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -410,6 +410,23 @@ enum {
+ SCS_ENABLE,
+ };
+
++struct mt7996_eml_omn {
++ u8 dialog_token;
++ u8 control;
++ __le16 bitmap;
++ union {
++ struct {
++ u8 emlsr_para_update;
++ } emlsr_info;
++ struct {
++ u8 mcs_map_count_control;
++ u8 mcs_map_bw80[3];
++ u8 mcs_map_bw160[3];
++ u8 mcs_map_bw320[3];
++ } emlmr_info;
++ } u;
++} __packed;
++
+ struct mt7996_wed_rro_addr {
+ u32 head_low;
+ u32 head_high : 4;
+@@ -1226,6 +1243,8 @@ int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
+ struct mt7996_link_sta *mlink);
+ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
+ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
++int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u8 link_id,
++ struct ieee80211_sta *sta, struct mt7996_eml_omn *eml_omn);
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, struct dentry *dir);
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index 84b50ab2..585c4e28 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -119,6 +119,13 @@ beacon_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BEACON_CTRL] = {
+ [MTK_VENDOR_ATTR_BEACON_CTRL_MODE] = { .type = NLA_U8 },
+ };
+
++static const struct nla_policy
++eml_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EML_CTRL] = {
++ [MTK_VENDOR_ATTR_EML_LINK_ID] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_EML_STA_ADDR] = { .type = NLA_BINARY },
++ [MTK_VENDOR_ATTR_EML_CTRL_STRUCT] = { .type = NLA_BINARY },
++};
++
+ static const struct nla_policy
+ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
+ [MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX] = { .type = NLA_U8 },
+@@ -1013,6 +1020,52 @@ static int mt7996_vendor_beacon_ctrl(struct wiphy *wiphy,
+
+ return 0;
+ }
++
++static int mt7996_vendor_eml_ctrl(struct wiphy *wiphy, struct wireless_dev *wdev,
++ const void *data, int data_len)
++{
++ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
++ struct ieee80211_sta *sta;
++ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_EML_CTRL];
++ struct mt7996_eml_omn *eml_omn;
++ u8 sta_addr[ETH_ALEN], link_id;
++ int err;
++
++ if (!ieee80211_vif_is_mld(vif))
++ return -EINVAL;
++
++ err = nla_parse(tb, MTK_VENDOR_ATTR_EML_CTRL_MAX, data, data_len,
++ eml_ctrl_policy, NULL);
++ if (err)
++ return err;
++
++ if (!tb[MTK_VENDOR_ATTR_EML_LINK_ID] || !tb[MTK_VENDOR_ATTR_EML_STA_ADDR])
++ return -EINVAL;
++
++ link_id = nla_get_u8(tb[MTK_VENDOR_ATTR_EML_LINK_ID]);
++
++ if (link_id >= IEEE80211_LINK_UNSPECIFIED)
++ return -EINVAL;
++
++ nla_memcpy(sta_addr, tb[MTK_VENDOR_ATTR_EML_STA_ADDR], ETH_ALEN);
++ sta = ieee80211_find_sta_by_ifaddr(hw, sta_addr, NULL);
++
++ if (!sta)
++ return -EINVAL;
++
++ if (tb[MTK_VENDOR_ATTR_EML_CTRL_STRUCT]) {
++ eml_omn = kzalloc(sizeof(struct mt7996_eml_omn), GFP_KERNEL);
++ nla_memcpy(eml_omn, tb[MTK_VENDOR_ATTR_EML_CTRL_STRUCT],
++ sizeof(struct mt7996_eml_omn));
++
++ err = mt7996_mcu_set_eml_omn(hw, vif, link_id, sta, eml_omn);
++ kfree(eml_omn);
++ }
++
++ return err;
++}
++
+ static int mt7996_vendor_csi_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data,
+@@ -1373,6 +1426,17 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+ .policy = csi_ctrl_policy,
+ .maxattr = MTK_VENDOR_ATTR_CSI_CTRL_MAX,
+ },
++ {
++ .info = {
++ .vendor_id = MTK_NL80211_VENDOR_ID,
++ .subcmd = MTK_NL80211_VENDOR_SUBCMD_EML_CTRL,
++ },
++ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
++ WIPHY_VENDOR_CMD_NEED_RUNNING,
++ .doit = mt7996_vendor_eml_ctrl,
++ .policy = eml_ctrl_policy,
++ .maxattr = MTK_VENDOR_ATTR_EML_CTRL_MAX,
++ },
+ };
+
+ void mt7996_vendor_register(struct mt7996_phy *phy)
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index 834b3d08..f6fcb623 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -18,6 +18,7 @@ enum mtk_nl80211_vendor_subcmds {
+ MTK_NL80211_VENDOR_SUBCMD_BACKGROUND_RADAR_CTRL = 0xcb,
+ MTK_NL80211_VENDOR_SUBCMD_PP_CTRL = 0xcc,
+ MTK_NL80211_VENDOR_SUBCMD_BEACON_CTRL = 0xcd,
++ MTK_NL80211_VENDOR_SUBCMD_EML_CTRL = 0xd3,
+ };
+
+ enum mtk_vendor_attr_edcca_ctrl {
+@@ -241,6 +242,20 @@ enum mtk_vendor_attr_beacon_ctrl {
+ NUM_MTK_VENDOR_ATTRS_BEACON_CTRL - 1
+ };
+
++enum mtk_vendor_attr_eml_ctrl {
++
++ MTK_VENDOR_ATTR_EML_CTRL_UNSPEC,
++
++ MTK_VENDOR_ATTR_EML_LINK_ID,
++ MTK_VENDOR_ATTR_EML_STA_ADDR,
++ MTK_VENDOR_ATTR_EML_CTRL_STRUCT,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_EML_CTRL,
++ MTK_VENDOR_ATTR_EML_CTRL_MAX =
++ NUM_MTK_VENDOR_ATTRS_EML_CTRL - 1
++};
++
+ enum mtk_vendor_attr_csi_ctrl {
+ MTK_VENDOR_ATTR_CSI_CTRL_UNSPEC,
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0129-mtk-mt76-mt7996-add-max-mpdu-len-capability.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0129-mtk-mt76-mt7996-add-max-mpdu-len-capability.patch
new file mode 100644
index 0000000..36cbb69
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0129-mtk-mt76-mt7996-add-max-mpdu-len-capability.patch
@@ -0,0 +1,31 @@
+From 77894f28fb40126d8ffa927787e4258cac597191 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Thu, 9 May 2024 11:16:10 +0800
+Subject: [PATCH 129/199] mtk: mt76: mt7996: add max mpdu len capability
+
+Set max mpdu len to 11454 according to hardware capability.
+Without this patch, the max ampdu length would be 3895 and hurt performance.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/init.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 2e624def..6e20a174 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -1519,7 +1519,9 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+
+ eht_cap_elem->mac_cap_info[0] =
+ IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
+- IEEE80211_EHT_MAC_CAP0_OM_CONTROL;
++ IEEE80211_EHT_MAC_CAP0_OM_CONTROL |
++ u8_encode_bits(IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454,
++ IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK);
+
+ eht_cap_elem->phy_cap_info[0] =
+ IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI |
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0130-mtk-mt76-mt7996-add-correct-bss_conf-for-legacy-AP-s.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0130-mtk-mt76-mt7996-add-correct-bss_conf-for-legacy-AP-s.patch
new file mode 100644
index 0000000..14ff6d2
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0130-mtk-mt76-mt7996-add-correct-bss_conf-for-legacy-AP-s.patch
@@ -0,0 +1,63 @@
+From ee730e834f37a0fa3a70bdce358ef3a163b46399 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 10 May 2024 13:35:56 +0800
+Subject: [PATCH 130/199] mtk: mt76: mt7996: add correct bss_conf for legacy AP
+ scan
+
+If the legacy AP interface is added but not yet started, its bss_conf
+wlould be phy0. Problem happens when scan is triggered with scan request
+contining channels not belong to phy0. In other word, it is invalid to
+set channel that does not belong to current bss_conf.
+
+This commit adds correct bss_conf for legacy AP so that setting channel
+can be successful.
+
+Now AP's bss_conf is not added until chanctx being assigned, so legacy AP
+might receive scan request without bss_conf being assigned. (such as ACS)
+
+This commit changes the way bss_conf being checked before scan. If the
+bss_conf exists but belongs to a different phy than the scanning one, it's
+removed. And if the bss_conf is not exist, or it just be removed, it's
+added and assigned to the scanning phy.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/main.c | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 0d25d763..990a38a7 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2363,15 +2363,20 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ phy->scan_vif = vif;
+ phy->scan_chan_idx = 0;
+
+- if (vif->type == NL80211_IFTYPE_STATION && !ieee80211_vif_is_mld(vif) &&
+- (phy->mt76 != mvif->deflink.phy->mt76)) {
+- // phy->mt76->main_phy = hw->priv;
+- mt7996_remove_bss_conf(vif, &vif->bss_conf, &mvif->deflink);
++ if (!ieee80211_vif_is_mld(vif)) {
++ struct mt7996_bss_conf *mconf = mconf_dereference_protected(mvif, 0);
+
+- ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
+- if (ret) {
+- mutex_unlock(&phy->dev->mt76.mutex);
+- return ret;
++ if (mconf && mconf->phy != phy) {
++ mt7996_remove_bss_conf(vif, &vif->bss_conf, &mvif->deflink);
++ mconf = NULL;
++ }
++
++ if (!mconf) {
++ ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
++ if (ret) {
++ mutex_unlock(&phy->dev->mt76.mutex);
++ return ret;
++ }
+ }
+ }
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0131-mtk-mt76-mt7996-fix-set-beacon-mcu-command.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0131-mtk-mt76-mt7996-fix-set-beacon-mcu-command.patch
new file mode 100644
index 0000000..b35ad4b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0131-mtk-mt76-mt7996-fix-set-beacon-mcu-command.patch
@@ -0,0 +1,78 @@
+From d3c4bfceae589098cb6cba5a3bb9125144df29fb Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Tue, 14 May 2024 10:52:43 +0800
+Subject: [PATCH 131/199] mtk: mt76: mt7996: fix set beacon mcu command
+
+When stopping AP, mac80211 frees beacon template before it calls
+driver's stop_ap operation. In other words, on the path of stopping
+AP, ieee80211_beacon_get_template() must returns NULL in
+mt7996_mcu_add_beacon(). In such case mt7996 immediately returns
+-EINVAL without telling FW to disable the beacon.
+
+This commit refactors mt7996_mcu_add_beacon() so that FW can be
+correctly informed when disabling AP interface.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/mcu.c | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 2a2e6116..0a0df745 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -3377,7 +3377,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ struct sk_buff *skb, *rskb;
+ struct tlv *tlv;
+ struct bss_bcn_content_tlv *bcn;
+- int len;
++ int len, extra_len = 0;
+
+ if (conf->nontransmitted)
+ return 0;
+@@ -3388,28 +3388,32 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ return PTR_ERR(rskb);
+
+ skb = ieee80211_beacon_get_template(hw, conf->vif, &offs, conf->link_id);
+- if (!skb) {
++ if (en && !skb) {
+ dev_kfree_skb(rskb);
+ return -EINVAL;
+ }
+
+- if (skb->len > MT7996_MAX_BEACON_SIZE) {
+- dev_err(dev->mt76.dev, "Bcn size limit exceed\n");
+- dev_kfree_skb(rskb);
+- dev_kfree_skb(skb);
+- return -EINVAL;
+- }
++ if (skb) {
++ if (skb->len > MT7996_MAX_BEACON_SIZE) {
++ dev_err(dev->mt76.dev, "Bcn size limit exceed\n");
++ dev_kfree_skb(rskb);
++ dev_kfree_skb(skb);
++ return -EINVAL;
++ }
+
+- info = IEEE80211_SKB_CB(skb);
+- info->hw_queue |= FIELD_PREP(MT_TX_HW_QUEUE_PHY, phy->mt76->band_idx);
++ extra_len = skb->len;
++ }
+
+- len = ALIGN(sizeof(*bcn) + MT_TXD_SIZE + skb->len, 4);
++ len = ALIGN(sizeof(*bcn) + MT_TXD_SIZE + extra_len, 4);
+ tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_CONTENT, len);
+ bcn = (struct bss_bcn_content_tlv *)tlv;
+ bcn->enable = en;
+ if (!en)
+ goto out;
+
++ info = IEEE80211_SKB_CB(skb);
++ info->hw_queue |= FIELD_PREP(MT_TX_HW_QUEUE_PHY, phy->mt76->band_idx);
++
+ mt7996_mcu_beacon_cont(dev, conf, rskb, skb, bcn, &offs);
+ mt7996_mcu_beacon_mbss(rskb, skb, conf, bcn, &offs);
+ mt7996_mcu_beacon_cntdwn(conf, rskb, skb, &offs);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0132-mtk-mt76-fix-incorrect-setting-of-antenna-capability.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0132-mtk-mt76-fix-incorrect-setting-of-antenna-capability.patch
new file mode 100644
index 0000000..344d28f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0132-mtk-mt76-fix-incorrect-setting-of-antenna-capability.patch
@@ -0,0 +1,33 @@
+From c7dfcaacdd6ae91fa75d2dc9c9efb7db4254c4a6 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Tue, 14 May 2024 14:12:28 +0800
+Subject: [PATCH 132/199] mtk: mt76: fix incorrect setting of antenna
+ capability
+
+Due to current implementation of single-wiphy architecture, only one antenna capability can be set for all PHYs via mt7996_set_antenna().
+Therefore, if antenna capabilities of PHYs are different, some may be set wrong.
+Thus, temporarily make mt7996_set_antenna() dummy.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/main.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 990a38a7..0a87cfad 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1670,6 +1670,10 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ int band, max_nss = hweight8(hw->wiphy->available_antennas_tx);
+
++ /* TODO: set antenna based on capability of each band. */
++ dev_warn(dev->mt76.dev, "%s: temporarily not supported.\n", __func__);
++ return 0;
++
+ /* only allow settings from hw0 */
+ if (hw != dev->phy.mt76->hw)
+ return 0;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0133-mtk-mt76-mt7996-fix-stop_tx_ba_session-warning.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0133-mtk-mt76-mt7996-fix-stop_tx_ba_session-warning.patch
new file mode 100644
index 0000000..f58b151
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0133-mtk-mt76-mt7996-fix-stop_tx_ba_session-warning.patch
@@ -0,0 +1,81 @@
+From 8bb932b534480f0025fdbd57270b194ed7738e2d Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 15 May 2024 11:10:17 +0800
+Subject: [PATCH 133/199] mtk: mt76: mt7996: fix stop_tx_ba_session warning
+
+---
+ mt7996/main.c | 11 +++++++----
+ mt7996/mcu.c | 6 ++++++
+ 2 files changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 0a87cfad..c7ec01f2 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1079,7 +1079,8 @@ static void mt7996_remove_link_sta(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_link_sta *link_sta,
+- struct mt7996_link_sta *mlink)
++ struct mt7996_link_sta *mlink,
++ bool last_link)
+ {
+ struct ieee80211_sta *sta = link_sta->sta;
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+@@ -1091,7 +1092,7 @@ static void mt7996_remove_link_sta(struct mt7996_dev *dev,
+ for (i = 0; i < ARRAY_SIZE(mlink->wcid.aggr); i++)
+ mt76_rx_aggr_stop(&dev->mt76, &mlink->wcid, i);
+
+- if (sta->mlo)
++ if (sta->mlo && last_link)
+ mt7996_mcu_teardown_mld_sta(dev, mconf, mlink);
+ else
+ mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, false, false);
+@@ -1205,7 +1206,8 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
+
+ return 0;
+ error:
+- mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink);
++ mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink,
++ hweight16(sta->valid_links) <= 1);
+ return ret;
+ }
+
+@@ -1230,8 +1232,9 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ link_conf_dereference_protected(vif, link_id);
+ struct ieee80211_link_sta *link_sta =
+ link_sta_dereference_protected(sta, link_id);
++ bool last_link = rem == sta->valid_links && link_id == __fls(rem);
+
+- mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink);
++ mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink, last_link);
+ }
+ }
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 0a0df745..48ff11d9 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -1735,6 +1735,9 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
+ mconf_dereference_protected(msta->vif, link_id);
+ int ret;
+
++ if (!mlink || !mconf)
++ continue;
++
+ if (enable && !params->amsdu)
+ mlink->wcid.amsdu = false;
+
+@@ -1769,6 +1772,9 @@ int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
+ mconf_dereference_protected(msta->vif, link_id);
+ int ret;
+
++ if (!mlink || !mconf)
++ continue;
++
+ ret = mt7996_mcu_sta_ba(dev, &mconf->mt76, params, &mlink->wcid,
+ enable, false);
+ if (ret)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0134-mtk-mt76-mt7996-do-software-link-addr-translation-fo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0134-mtk-mt76-mt7996-do-software-link-addr-translation-fo.patch
new file mode 100644
index 0000000..746cedc
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0134-mtk-mt76-mt7996-do-software-link-addr-translation-fo.patch
@@ -0,0 +1,96 @@
+From 17651c073f135c837ca0b8d0b3e9ab8c4beef67f Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 15 May 2024 17:47:33 +0800
+Subject: [PATCH 134/199] mtk: mt76: mt7996: do software link addr translation
+ for EAPOL
+
+Previously, we do HW link address translation for EAPOL addr1 and addr2,
+but SW link address translation for EAPOL addr3 due to incompatibility
+between HW converting rules and 802.11 EAPOL frames.
+
+This patch adds support for doing pure SW link address translation for
+EAPOL, to get rid of ambiguity and could also help on debugging EAPOL
+timeout issues.
+
+Note that dma_sync_single_for_cpu/dma_sync_single_for_device is
+necessary to sync the changes of address to DMA.
+
+Assign EAPOL's SA/DA to MLD address.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7996/mac.c | 46 +++++++++++++++++++++++++++++++---------------
+ 1 file changed, 31 insertions(+), 15 deletions(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index bba16975..020203ec 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -831,7 +831,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+ txwi[5] = cpu_to_le32(val);
+
+ val = MT_TXD6_DAS;
+- if ((q_idx >= MT_LMAC_ALTX0 && q_idx <= MT_LMAC_BCN0))
++ if ((q_idx >= MT_LMAC_ALTX0 && q_idx <= MT_LMAC_BCN0) ||
++ unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)))
+ val |= MT_TXD6_DIS_MAT;
+
+ if (is_mt7996(&dev->mt76))
+@@ -939,23 +940,38 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, key,
+ pid, qid, 0);
+
+- /* translate addr3 of EAPOL by driver */
++ /* Since the rules of HW MLD address translation are not fully compatible
++ * with 802.11 EAPOL frame, we do the translation by software
++ */
+ if (unlikely(tx_info->skb->protocol == cpu_to_be16(ETH_P_PAE)) && sta->mlo) {
+- if (ether_addr_equal(vif->addr, hdr->addr3)) {
+- struct ieee80211_bss_conf *conf;
+-
+- conf = rcu_dereference(vif->link_conf[wcid->link_id]);
+- if (unlikely(!conf))
+- return -ENOLINK;
+-
+- memcpy(hdr->addr3, conf->addr, ETH_ALEN);
+- } else if (ether_addr_equal(sta->addr, hdr->addr3)) {
+- struct ieee80211_link_sta *link_sta;
+-
+- link_sta = rcu_dereference(sta->link[wcid->link_id]);
+- memcpy(hdr->addr3, link_sta->addr, ETH_ALEN);
++ struct ieee80211_bss_conf *conf;
++ struct ieee80211_link_sta *link_sta;
++ __le16 fc = hdr->frame_control;
++
++ conf = rcu_dereference(vif->link_conf[wcid->link_id]);
++ link_sta = rcu_dereference(sta->link[wcid->link_id]);
++ if (!conf || !link_sta)
++ return -ENOLINK;
++
++ dma_sync_single_for_cpu(mdev->dma_dev, tx_info->buf[1].addr,
++ tx_info->buf[1].len, DMA_TO_DEVICE);
++
++ memcpy(hdr->addr1, link_sta->addr, ETH_ALEN);
++ memcpy(hdr->addr2, conf->addr, ETH_ALEN);
++
++ /* EAPOL's SA/DA need to be MLD address in MLO */
++ if (ieee80211_has_a4(fc)) {
++ memcpy(hdr->addr3, sta->addr, ETH_ALEN);
++ memcpy(hdr->addr4, vif->addr, ETH_ALEN);
++ } else if (ieee80211_has_tods(fc)) {
++ memcpy(hdr->addr3, sta->addr, ETH_ALEN);
++ } else if (ieee80211_has_fromds(fc)) {
++ memcpy(hdr->addr3, vif->addr, ETH_ALEN);
+ }
+
++ dma_sync_single_for_device(mdev->dma_dev, tx_info->buf[1].addr,
++ tx_info->buf[1].len, DMA_TO_DEVICE);
++
+ pr_info("EAPOL: a1=%pM, a2=%pM, a3=%pM\n", hdr->addr1, hdr->addr2, hdr->addr3);
+ }
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0135-mtk-mt76-mt7996-add-per-band-debugfs-folder.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0135-mtk-mt76-mt7996-add-per-band-debugfs-folder.patch
new file mode 100644
index 0000000..d82f9b3
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0135-mtk-mt76-mt7996-add-per-band-debugfs-folder.patch
@@ -0,0 +1,146 @@
+From 84c119a7ad5969f445513f9c5759f8b041620e1f Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Thu, 16 May 2024 18:03:19 +0800
+Subject: [PATCH 135/199] mtk: mt76: mt7996: add per-band debugfs folder
+
+Add per-band debugfs folder and move upstream debugfs knob to it.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/debugfs.c | 43 +++++++++++++++++++++++++++++++------------
+ mt7996/init.c | 14 +++++++++-----
+ mt7996/mt7996.h | 3 ++-
+ 3 files changed, 42 insertions(+), 18 deletions(-)
+
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 2c553cf3..9d74f659 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1073,21 +1073,49 @@ mt7996_airtime_read(struct seq_file *s, void *data)
+ return 0;
+ }
+
+-int mt7996_init_debugfs(struct mt7996_phy *phy)
++int mt7996_init_band_debugfs(struct mt7996_phy *phy)
+ {
+ struct mt7996_dev *dev = phy->dev;
+ struct dentry *dir;
++ char dir_name[10];
+
+- dir = mt76_register_debugfs_fops(phy->mt76, NULL);
++ if (!dev->debugfs_dir)
++ return -EINVAL;
++
++ snprintf(dir_name, sizeof(dir_name), "band%d", phy->mt76->band_idx);
++
++ dir = debugfs_create_dir(dir_name, dev->debugfs_dir);
+ if (!dir)
+ return -ENOMEM;
++
+ debugfs_create_file("hw-queues", 0400, dir, phy,
+ &mt7996_hw_queues_fops);
+ debugfs_create_file("xmit-queues", 0400, dir, phy,
+ &mt7996_xmit_queues_fops);
+- debugfs_create_file("tx_stats", 0400, dir, phy, &mt7996_tx_stats_fops);
+ debugfs_create_file("sys_recovery", 0600, dir, phy,
+ &mt7996_sys_recovery_ops);
++ debugfs_create_file("atf_enable", 0600, dir, phy, &fops_atf_enable);
++ debugfs_create_file("tx_stats", 0400, dir, phy, &mt7996_tx_stats_fops);
++ if (phy->mt76->cap.has_5ghz) {
++ debugfs_create_u32("dfs_hw_pattern", 0400, dir,
++ &dev->hw_pattern);
++ debugfs_create_file("radar_trigger", 0200, dir, dev,
++ &fops_radar_trigger);
++ debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
++ mt7996_rdd_monitor);
++ }
++
++ return 0;
++}
++
++int mt7996_init_dev_debugfs(struct mt7996_phy *phy)
++{
++ struct mt7996_dev *dev = phy->dev;
++ struct dentry *dir;
++
++ dir = mt76_register_debugfs_fops(phy->mt76, NULL);
++ if (!dir)
++ return -ENOMEM;
+ debugfs_create_file("fw_debug_wm", 0600, dir, dev, &fops_fw_debug_wm);
+ debugfs_create_file("fw_debug_wa", 0600, dir, dev, &fops_fw_debug_wa);
+ debugfs_create_file("fw_debug_bin", 0600, dir, dev, &fops_fw_debug_bin);
+@@ -1103,18 +1131,9 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
+ debugfs_create_file("otp", 0400, dir, dev, &mt7996_efuse_ops);
+ debugfs_create_devm_seqfile(dev->mt76.dev, "vow_info", dir,
+ mt7996_vow_info_read);
+- debugfs_create_file("atf_enable", 0600, dir, phy, &fops_atf_enable);
+ debugfs_create_devm_seqfile(dev->mt76.dev, "airtime", dir,
+ mt7996_airtime_read);
+
+- if (phy->mt76->cap.has_5ghz) {
+- debugfs_create_u32("dfs_hw_pattern", 0400, dir,
+- &dev->hw_pattern);
+- debugfs_create_file("radar_trigger", 0200, dir, dev,
+- &fops_radar_trigger);
+- debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
+- mt7996_rdd_monitor);
+- }
+ debugfs_create_file("fw_debug_muru_disable", 0600, dir, dev,
+ &fops_fw_debug_muru_disable);
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 6e20a174..01795404 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -787,7 +787,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+ goto error;
+ }
+
+- ret = mt7996_init_debugfs(phy);
++ ret = mt7996_init_band_debugfs(phy);
+ if (ret)
+ goto error;
+
+@@ -1708,6 +1708,14 @@ int mt7996_register_device(struct mt7996_dev *dev)
+ if (ret)
+ return ret;
+
++ ret = mt7996_init_dev_debugfs(&dev->phy);
++ if (ret)
++ goto error;
++
++ ret = mt7996_init_band_debugfs(&dev->phy);
++ if (ret)
++ goto error;
++
+ ret = mt7996_register_phy(dev, mt7996_phy2(dev), MT_BAND1);
+ if (ret)
+ return ret;
+@@ -1732,10 +1740,6 @@ int mt7996_register_device(struct mt7996_dev *dev)
+ goto error;
+ }
+
+- ret = mt7996_init_debugfs(&dev->phy);
+- if (ret)
+- goto error;
+-
+ ret = mt7996_coredump_register(dev);
+ if (ret)
+ goto error;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index c60262ec..08a43e61 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1226,7 +1226,8 @@ int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy);
+ void mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy);
+ void mt7996_set_stream_vht_txbf_caps(struct mt7996_phy *phy);
+ void mt7996_update_channel(struct mt76_phy *mphy);
+-int mt7996_init_debugfs(struct mt7996_phy *phy);
++int mt7996_init_dev_debugfs(struct mt7996_phy *phy);
++int mt7996_init_band_debugfs(struct mt7996_phy *phy);
+ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int len);
+ bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len);
+ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0136-mtk-mt76-mt7996-move-internal-debugfs-knob-to-per-ba.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0136-mtk-mt76-mt7996-move-internal-debugfs-knob-to-per-ba.patch
new file mode 100644
index 0000000..b8a705e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0136-mtk-mt76-mt7996-move-internal-debugfs-knob-to-per-ba.patch
@@ -0,0 +1,270 @@
+From 729686d815e03189a23d2f0a987289eb34ac7676 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Thu, 16 May 2024 18:04:28 +0800
+Subject: [PATCH 136/199] mtk: mt76: mt7996: move internal debugfs knob to
+ per-band folder
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/debugfs.c | 5 +-
+ mt7996/mt7996.h | 3 +-
+ mt7996/mtk_debugfs.c | 117 ++++++++++++++-----------------------------
+ 3 files changed, 44 insertions(+), 81 deletions(-)
+
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 9d74f659..71dc0449 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1105,6 +1105,9 @@ int mt7996_init_band_debugfs(struct mt7996_phy *phy)
+ mt7996_rdd_monitor);
+ }
+
++#ifdef CONFIG_MTK_DEBUG
++ mt7996_mtk_init_band_debugfs(phy, dir);
++#endif
+ return 0;
+ }
+
+@@ -1146,7 +1149,7 @@ int mt7996_init_dev_debugfs(struct mt7996_phy *phy)
+
+ #ifdef CONFIG_MTK_DEBUG
+ debugfs_create_u16("wlan_idx", 0600, dir, &dev->wlan_idx);
+- mt7996_mtk_init_debugfs(phy, dir);
++ mt7996_mtk_init_dev_debugfs(dev, dir);
+ #endif
+
+ return 0;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 08a43e61..cb35a927 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1286,7 +1286,8 @@ enum edcca_bw_id {
+ };
+
+ #ifdef CONFIG_MTK_DEBUG
+-int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir);
++void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir);
++void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir);
+ int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val);
+ int mt7996_mcu_set_sr_enable(struct mt7996_phy *phy, u8 action, u64 val, bool set);
+ void mt7996_mcu_rx_sr_event(struct mt7996_dev *dev, struct sk_buff *skb);
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index 0820e0d0..59c6db73 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -14,13 +14,14 @@
+ #ifdef CONFIG_MTK_DEBUG
+
+ /* AGG INFO */
+-static int
+-mt7996_agginfo_read_per_band(struct seq_file *s, int band_idx)
++static int mt7996_agginfo_show(struct seq_file *s, void *data)
+ {
+- struct mt7996_dev *dev = dev_get_drvdata(s->private);
++ struct mt7996_phy *phy = s->private;
++ struct mt7996_dev *dev = phy->dev;
+ u64 total_burst, total_ampdu, ampdu_cnt[16];
+ u32 value, idx, row_idx, col_idx, start_range, agg_rang_sel[16], burst_cnt[16], band_offset = 0;
+ u8 partial_str[16] = {}, full_str[64] = {};
++ u8 band_idx = phy->mt76->band_idx;
+
+ switch (band_idx) {
+ case 0:
+@@ -204,24 +205,7 @@ mt7996_agginfo_read_per_band(struct seq_file *s, int band_idx)
+
+ return 0;
+ }
+-
+-static int mt7996_agginfo_read_band0(struct seq_file *s, void *data)
+-{
+- mt7996_agginfo_read_per_band(s, MT_BAND0);
+- return 0;
+-}
+-
+-static int mt7996_agginfo_read_band1(struct seq_file *s, void *data)
+-{
+- mt7996_agginfo_read_per_band(s, MT_BAND1);
+- return 0;
+-}
+-
+-static int mt7996_agginfo_read_band2(struct seq_file *s, void *data)
+-{
+- mt7996_agginfo_read_per_band(s, MT_BAND2);
+- return 0;
+-}
++DEFINE_SHOW_ATTRIBUTE(mt7996_agginfo);
+
+ /* AMSDU INFO */
+ static int mt7996_amsdu_result_read(struct seq_file *s, void *data)
+@@ -704,10 +688,12 @@ static int mt7996_trinfo_read(struct seq_file *s, void *data)
+ }
+
+ /* MIB INFO */
+-static int mt7996_mibinfo_read_per_band(struct seq_file *s, int band_idx)
++static int mt7996_mibinfo_show(struct seq_file *s, void *data)
+ {
+ #define BSS_NUM 4
+- struct mt7996_dev *dev = dev_get_drvdata(s->private);
++ struct mt7996_phy *phy = s->private;
++ struct mt7996_dev *dev = phy->dev;
++ u8 band_idx = phy->mt76->band_idx;
+ u8 bss_nums = BSS_NUM;
+ u32 idx;
+ u32 mac_val, band_offset = 0, band_offset_umib = 0;
+@@ -920,24 +906,7 @@ static int mt7996_mibinfo_read_per_band(struct seq_file *s, int band_idx)
+
+ return 0;
+ }
+-
+-static int mt7996_mibinfo_band0(struct seq_file *s, void *data)
+-{
+- mt7996_mibinfo_read_per_band(s, MT_BAND0);
+- return 0;
+-}
+-
+-static int mt7996_mibinfo_band1(struct seq_file *s, void *data)
+-{
+- mt7996_mibinfo_read_per_band(s, MT_BAND1);
+- return 0;
+-}
+-
+-static int mt7996_mibinfo_band2(struct seq_file *s, void *data)
+-{
+- mt7996_mibinfo_read_per_band(s, MT_BAND2);
+- return 0;
+-}
++DEFINE_SHOW_ATTRIBUTE(mt7996_mibinfo);
+
+ /* WTBL INFO */
+ static int
+@@ -3036,9 +3005,9 @@ static const struct file_operations fops_muru_fixed_group_rate = {
+
+ static int mt7996_muru_prot_thr_set(void *data, u64 val)
+ {
+- struct mt7996_phy *phy = data;
++ struct mt7996_dev *dev = data;
+
+- return mt7996_mcu_muru_set_prot_frame_thr(phy->dev, (u32)val);
++ return mt7996_mcu_muru_set_prot_frame_thr(dev, (u32)val);
+ }
+
+ DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_prot_thr, NULL,
+@@ -4219,9 +4188,32 @@ mt7996_drr_info(struct seq_file *s, void *data)
+ return 0;
+ }
+
+-int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
++void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
++{
++ /* agg */
++ debugfs_create_file("agginfo", 0400, dir, phy, &mt7996_agginfo_fops);
++ debugfs_create_file("mibinfo", 0400, dir, phy, &mt7996_mibinfo_fops);
++ debugfs_create_file("txpower_level", 0600, dir, phy, &fops_txpower_level);
++ debugfs_create_file("txpower_info", 0600, dir, phy, &mt7996_txpower_info_fops);
++ debugfs_create_file("txpower_sku", 0600, dir, phy, &mt7996_txpower_sku_fops);
++ debugfs_create_file("txpower_path", 0600, dir, phy, &mt7996_txpower_path_fops);
++
++ debugfs_create_file("sr_enable", 0600, dir, phy, &fops_sr_enable);
++ debugfs_create_file("sr_enhanced_enable", 0600, dir, phy, &fops_sr_enhanced_enable);
++ debugfs_create_file("sr_stats", 0400, dir, phy, &mt7996_sr_stats_fops);
++ debugfs_create_file("sr_scene_cond", 0400, dir, phy, &mt7996_sr_scene_cond_fops);
++
++ debugfs_create_file("bf_txsnd_info", 0600, dir, phy, &fops_bf_txsnd_info);
++ debugfs_create_file("bf_starec_read", 0600, dir, phy, &fops_starec_bf_read);
++ debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt);
++ debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read);
++
++ debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
++ debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
++}
++
++void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+ {
+- struct mt7996_dev *dev = phy->dev;
+ u32 device_id = (dev->mt76.rev) >> 16;
+ int i = 0;
+ static const struct mt7996_dbg_reg_desc dbg_reg_s[] = {
+@@ -4246,13 +4238,6 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ WTBL_LMAC_DW9 = WTBL_LMAC_DW9_7992;
+ }
+
+- /* agg */
+- debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info0", dir,
+- mt7996_agginfo_read_band0);
+- debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info1", dir,
+- mt7996_agginfo_read_band1);
+- debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info2", dir,
+- mt7996_agginfo_read_band2);
+ /* amsdu */
+ debugfs_create_devm_seqfile(dev->mt76.dev, "amsdu_info", dir,
+ mt7996_amsdu_result_read);
+@@ -4270,24 +4255,12 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ debugfs_create_devm_seqfile(dev->mt76.dev, "fw_wm_info", dir,
+ mt7996_fw_wm_info_read);
+
+- debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info0", dir,
+- mt7996_mibinfo_band0);
+- debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info1", dir,
+- mt7996_mibinfo_band1);
+- debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info2", dir,
+- mt7996_mibinfo_band2);
+-
+ debugfs_create_devm_seqfile(dev->mt76.dev, "sta_info", dir,
+ mt7996_sta_info);
+
+ debugfs_create_devm_seqfile(dev->mt76.dev, "tr_info", dir,
+ mt7996_trinfo_read);
+
+- debugfs_create_file("txpower_level", 0600, dir, phy, &fops_txpower_level);
+- debugfs_create_file("txpower_info", 0600, dir, phy, &mt7996_txpower_info_fops);
+- debugfs_create_file("txpower_sku", 0600, dir, phy, &mt7996_txpower_sku_fops);
+- debugfs_create_file("txpower_path", 0600, dir, phy, &mt7996_txpower_path_fops);
+-
+ debugfs_create_devm_seqfile(dev->mt76.dev, "eeprom_mode", dir,
+ mt7996_show_eeprom_mode);
+
+@@ -4300,23 +4273,12 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+
+ dev->dbg.sku_disable = true; /* For SQC */
+ debugfs_create_u8("sku_disable", 0600, dir, &dev->dbg.sku_disable);
+- debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
+-
+- debugfs_create_file("sr_enable", 0600, dir, phy, &fops_sr_enable);
+- debugfs_create_file("sr_enhanced_enable", 0600, dir, phy, &fops_sr_enhanced_enable);
+- debugfs_create_file("sr_stats", 0400, dir, phy, &mt7996_sr_stats_fops);
+- debugfs_create_file("sr_scene_cond", 0400, dir, phy, &mt7996_sr_scene_cond_fops);
+
++ debugfs_create_file("muru_prot_thr", 0200, dir, dev, &fops_muru_prot_thr);
+ debugfs_create_file("muru_fixed_rate_enable", 0600, dir, dev,
+ &fops_muru_fixed_rate_enable);
+ debugfs_create_file("muru_fixed_group_rate", 0600, dir, dev,
+ &fops_muru_fixed_group_rate);
+- debugfs_create_file("bf_txsnd_info", 0600, dir, phy, &fops_bf_txsnd_info);
+- debugfs_create_file("bf_starec_read", 0600, dir, phy, &fops_starec_bf_read);
+- debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt);
+- debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read);
+-
+- debugfs_create_file("muru_prot_thr", 0200, dir, phy, &fops_muru_prot_thr);
+
+ if (dev->has_rro) {
+ debugfs_create_u32("rro_sid", 0600, dir, &dev->dbg.sid);
+@@ -4326,7 +4288,6 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ mt7996_show_rro_mib);
+ }
+
+- debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
+ debugfs_create_file("thermal_recal", 0200, dir, dev, &fops_thermal_recal);
+ debugfs_create_file("reset_counter", 0200, dir, dev, &fops_reset_counter);
+
+@@ -4346,8 +4307,6 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ debugfs_create_file("amsdu_para", 0600, dir, dev, &fops_amsdu_para);
+ debugfs_create_devm_seqfile(dev->mt76.dev, "hw_amsdu_info", dir,
+ mt7996_hw_amsdu_info_read);
+-
+- return 0;
+ }
+
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0137-mtk-mt76-mt7996-refactor-amsdu-debugfs.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0137-mtk-mt76-mt7996-refactor-amsdu-debugfs.patch
new file mode 100644
index 0000000..a05b8ca
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0137-mtk-mt76-mt7996-refactor-amsdu-debugfs.patch
@@ -0,0 +1,114 @@
+From 48926fde96602e41c02879d7a020f4b24d332f75 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 17 May 2024 17:34:03 +0800
+Subject: [PATCH 137/199] mtk: mt76: mt7996: refactor amsdu debugfs
+
+1. Remove hw_amsdu_info which is duplicated with amsdu_info.
+
+2. The amsdu_info cannot read CR directly because the CR is read-clear.
+ If amsdu_info read CR directly, the CR would be cleared and the
+ mt7996_mac_work cannot get correct value.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/mtk_debugfs.c | 63 ++++++++++++++++----------------------------
+ 1 file changed, 22 insertions(+), 41 deletions(-)
+
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index 59c6db73..a7cbde3e 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -210,28 +210,35 @@ DEFINE_SHOW_ATTRIBUTE(mt7996_agginfo);
+ /* AMSDU INFO */
+ static int mt7996_amsdu_result_read(struct seq_file *s, void *data)
+ {
+-#define HW_MSDU_CNT_ADDR 0xf400
+-#define HW_MSDU_NUM_MAX 33
+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
+- u32 ple_stat[HW_MSDU_NUM_MAX] = {0}, total_amsdu = 0;
+- u8 i;
++ struct mt7996_phy *phy = &dev->phy;
++ struct mt76_mib_stats *mib = &phy->mib;
++ static u32 tx_amsdu_last[MT76_MAX_AMSDU_NUM] = {0};
++ static u32 tx_amsdu_cnt_last = 0;
++ u32 tx_amsdu, tx_amsdu_cnt, ratio;
++ int i;
+
+- for (i = 0; i < HW_MSDU_NUM_MAX; i++)
+- ple_stat[i] = mt76_rr(dev, HW_MSDU_CNT_ADDR + i * 0x04);
++ mutex_lock(&dev->mt76.mutex);
+
+- seq_printf(s, "TXD counter status of MSDU:\n");
++ mt7996_mac_update_stats(phy);
+
+- for (i = 0; i < HW_MSDU_NUM_MAX; i++)
+- total_amsdu += ple_stat[i];
++ tx_amsdu_cnt = mib->tx_amsdu_cnt - tx_amsdu_cnt_last;
+
+- for (i = 0; i < HW_MSDU_NUM_MAX; i++) {
+- seq_printf(s, "AMSDU pack count of %d MSDU in TXD: 0x%x ", i, ple_stat[i]);
+- if (total_amsdu != 0)
+- seq_printf(s, "(%d%%)\n", ple_stat[i] * 100 / total_amsdu);
+- else
+- seq_printf(s, "\n");
++ seq_puts(s, "Tx MSDU statistics:\n");
++ for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
++ tx_amsdu = mib->tx_amsdu[i] - tx_amsdu_last[i];
++ ratio = tx_amsdu_cnt ? tx_amsdu * 100 / tx_amsdu_cnt : 0;
++
++ seq_printf(s, "AMSDU pack count of %d MSDU in TXD: %8d (%3d%%)\n",
++ i + 1, tx_amsdu, ratio);
++
++ tx_amsdu_last[i] = mib->tx_amsdu[i];
+ }
+
++ tx_amsdu_cnt_last = mib->tx_amsdu_cnt;
++
++ mutex_unlock(&dev->mt76.mutex);
++
+ return 0;
+ }
+
+@@ -3342,30 +3349,6 @@ static const struct file_operations fops_amsdu_para = {
+ .llseek = default_llseek,
+ };
+
+-static int mt7996_hw_amsdu_info_read(struct seq_file *s, void *data)
+-{
+- struct mt7996_dev *dev = dev_get_drvdata(s->private);
+- u32 amsdu_cnt[WF_PLE_TOP_AMSDU_PACK_NUM] = {0}, total_cnt;
+- u8 i;
+-
+- seq_printf(s, "HW A-MSDU Information:\n");
+-
+- for (total_cnt = 0, i = 0; i < WF_PLE_TOP_AMSDU_PACK_NUM; ++i) {
+- amsdu_cnt[i] = mt76_rr(dev, WF_PLE_TOP_AMSDU_PACK_1_MSDU_CNT_ADDR + i * 4);
+- total_cnt += amsdu_cnt[i];
+- }
+-
+- for (i = 0; i < WF_PLE_TOP_AMSDU_PACK_NUM; ++i) {
+- seq_printf(s, "# of HW A-MSDU containing %hhu MSDU: 0x%x",
+- i + 1, amsdu_cnt[i]);
+- seq_printf(s, "\t(%u.%u%%)\n",
+- total_cnt ? amsdu_cnt[i] * 1000 / total_cnt / 10 : 0,
+- total_cnt ? amsdu_cnt[i] * 1000 / total_cnt % 10 : 0);
+- }
+-
+- return 0;
+-}
+-
+ /* PSE INFO */
+ static struct bmac_queue_info_t pse_queue_empty_info[] = {
+ {"CPU Q0", ENUM_UMAC_CPU_PORT_1, ENUM_UMAC_CTX_Q_0},
+@@ -4305,8 +4288,6 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+ /* amsdu */
+ debugfs_create_file("amsdu_algo", 0600, dir, dev, &fops_amsdu_algo);
+ debugfs_create_file("amsdu_para", 0600, dir, dev, &fops_amsdu_para);
+- debugfs_create_devm_seqfile(dev->mt76.dev, "hw_amsdu_info", dir,
+- mt7996_hw_amsdu_info_read);
+ }
+
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0138-mtk-mt76-mt7996-trigger-channel-calibration-for-DFS-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0138-mtk-mt76-mt7996-trigger-channel-calibration-for-DFS-.patch
new file mode 100644
index 0000000..6160525
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0138-mtk-mt76-mt7996-trigger-channel-calibration-for-DFS-.patch
@@ -0,0 +1,135 @@
+From 29f282a0ca7e594da0b23db9429c0588408a708e Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Fri, 17 May 2024 14:49:50 +0800
+Subject: [PATCH 138/199] mtk: mt76: mt7996: trigger channel calibration for
+ DFS link after sta is associated
+
+Trigger channel calibration (set channel with switch reason = NORMAL)
+for DFS link after STA is associated.
+Without this patch, 5G link might have high PER during T.P. test
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7996/main.c | 15 +++++++++++----
+ mt7996/mcu.c | 7 ++++---
+ mt7996/mt7996.h | 2 +-
+ mt7996/testmode.c | 4 ++--
+ 4 files changed, 18 insertions(+), 10 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index c7ec01f2..40418f7e 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -82,12 +82,12 @@ int mt7996_run(struct ieee80211_hw *hw)
+ if (ret)
+ goto out;
+
+- ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_RX_PATH);
++ ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_RX_PATH, false);
+ if (ret)
+ goto out;
+
+ /* set a parking channel */
+- ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH);
++ ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH, false);
+ if (ret)
+ goto out;
+
+@@ -554,11 +554,11 @@ static int __mt7996_set_channel(struct mt7996_phy *phy,
+ goto out;
+ }
+
+- ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH);
++ ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH, false);
+ if (ret)
+ goto out;
+
+- ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_RX_PATH);
++ ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_RX_PATH, false);
+ if (ret)
+ goto out;
+
+@@ -2732,6 +2732,13 @@ mt7996_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ next_time = min(next_time,
+ MT7996_MAX_BEACON_LOSS *
+ conf->beacon_int);
++
++ /* trigger calibration for DFS link */
++ if (!cfg80211_reg_can_beacon(hw->wiphy,
++ &mconf->chanctx->chandef,
++ NL80211_IFTYPE_AP))
++ mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH,
++ true);
+ }
+
+ ieee80211_queue_delayed_work(hw, &mvif->beacon_mon_work,
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 48ff11d9..3a950a90 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -4397,7 +4397,7 @@ int mt7996_mcu_rdd_background_enable(struct mt7996_phy *phy,
+ 0, region);
+ }
+
+-int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
++int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag, bool sta)
+ {
+ static const u8 ch_band[] = {
+ [NL80211_BAND_2GHZ] = 0,
+@@ -4408,6 +4408,8 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
+ struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
+ int freq1 = chandef->center_freq1;
+ u8 band_idx = phy->mt76->band_idx;
++ enum nl80211_iftype iftype = sta ? NL80211_IFTYPE_STATION :
++ NL80211_IFTYPE_AP;
+ struct {
+ /* fixed field */
+ u8 __rsv[4];
+@@ -4448,8 +4450,7 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag)
+ phy->mt76->hw->conf.flags & IEEE80211_CONF_IDLE ||
+ phy->scan_chan)
+ req.switch_reason = CH_SWITCH_SCAN_BYPASS_DPD;
+- else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef,
+- NL80211_IFTYPE_AP))
++ else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef, iftype))
+ req.switch_reason = CH_SWITCH_DFS;
+ else
+ req.switch_reason = CH_SWITCH_NORMAL;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index cb35a927..259845a1 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1054,7 +1054,7 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, unsigned long add);
+ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef);
+-int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag);
++int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag, bool sta);
+ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf);
+ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
+ void *data, u16 version);
+diff --git a/mt7996/testmode.c b/mt7996/testmode.c
+index 0565ebc9..8b35d125 100644
+--- a/mt7996/testmode.c
++++ b/mt7996/testmode.c
+@@ -544,7 +544,7 @@ mt7996_tm_dpd_prek_send_req(struct mt7996_phy *phy, struct mt7996_tm_req *req,
+
+ /* set channel switch reason */
+ mphy->hw->conf.flags |= IEEE80211_CONF_OFFCHANNEL;
+- mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH);
++ mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH, false);
+
+ ret = mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(TESTMODE_CTRL), req,
+ sizeof(*req), false);
+@@ -558,7 +558,7 @@ out:
+ mphy->hw->conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
+ memcpy(chandef, &chandef_backup, sizeof(struct cfg80211_chan_def));
+ memcpy(chandef->chan, &chan_backup, sizeof(struct ieee80211_channel));
+- mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH);
++ mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH, false);
+
+ return ret;
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0139-mtk-mt76-mt7996-do-not-remove-bss_info-and-starec-wh.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0139-mtk-mt76-mt7996-do-not-remove-bss_info-and-starec-wh.patch
new file mode 100644
index 0000000..30c8b37
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0139-mtk-mt76-mt7996-do-not-remove-bss_info-and-starec-wh.patch
@@ -0,0 +1,55 @@
+From 525b850e3140488b346601070adbeb5fd163af67 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Wed, 22 May 2024 18:22:51 +0800
+Subject: [PATCH 139/199] mtk: mt76: mt7996: do not remove bss_info and starec
+ when assign_vif_chanctx
+
+When STA interface re-connect from rootAP, it would unsign/assign vif
+chanctx for both AP and station interface. If remove/re-allocate
+bss_info and starec for AP interface, the WTBL and GTK of AP would
+be cleared. But the hostapd does not remove interface so it would not
+set key again.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/main.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 40418f7e..2a2112f1 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -338,6 +338,9 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
+ u8 link_id = conf->link_id;
+ int idx, ret;
+
++ if (rcu_access_pointer(mvif->link[link_id]))
++ return 0;
++
+ if (conf != &vif->bss_conf) {
+ mconf = kzalloc(sizeof(*mconf), GFP_KERNEL);
+ if (!mconf)
+@@ -2516,10 +2519,16 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+
+ mutex_lock(&phy->dev->mt76.mutex);
+
+- /* remove first */
+- if (rcu_access_pointer(mvif->link[link_id]))
+- mt7996_remove_bss_conf(vif, link_conf,
+- mconf_dereference_protected(mvif, link_id));
++ mconf = mconf_dereference_protected(mvif, link_id);
++
++ /* Remove bss conf when change non-MLO interface to MLO interface */
++ if (ieee80211_vif_is_mld(vif) && mconf == &mvif->deflink)
++ mt7996_remove_bss_conf(vif, link_conf, mconf);
++ else if (mconf && phy != mconf->phy)
++ dev_err(phy->dev->mt76.dev,
++ "%s: error: change link[%d] from phy%d to phy%d",
++ __func__, link_id, mconf->phy->mt76->band_idx,
++ phy->mt76->band_idx);
+
+ ret = mt7996_add_bss_conf(phy, vif, link_conf);
+ if (ret) {
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0140-mtk-mt76-mt7996-remove-chanctx-in-mt7996_bss_conf.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0140-mtk-mt76-mt7996-remove-chanctx-in-mt7996_bss_conf.patch
new file mode 100644
index 0000000..d7ff224
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0140-mtk-mt76-mt7996-remove-chanctx-in-mt7996_bss_conf.patch
@@ -0,0 +1,71 @@
+From c684d5b236f67ffb278ffe9c0836df16a5c0eeb7 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Tue, 28 May 2024 09:33:11 +0800
+Subject: [PATCH 140/199] mtk: mt76: mt7996: remove chanctx in mt7996_bss_conf
+
+Different vif under the same phy cannot use different chanctx.
+So it is better to maintain the chanctx in mt7996_phy.
+Instead of mconf->chanctx, get the chanctx by mconf->phy->chanctx.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/main.c | 8 +-------
+ mt7996/mt7996.h | 2 --
+ 2 files changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 2a2112f1..4f3b0070 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2536,8 +2536,6 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ return ret;
+ }
+
+- mconf = mconf_dereference_protected(mvif, link_id);
+- mconf->chanctx = ctx;
+ ctx->nbss_assigned++;
+ mvif->band_to_link[phy->mt76->band_idx] = link_id;
+
+@@ -2556,8 +2554,6 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ {
+ struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
+ struct mt7996_phy *phy = ctx->phy;
+- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- struct mt7996_bss_conf *mconf;
+
+ wiphy_info(hw->wiphy, "Remove VIF (addr: %pM, type: %d, link_id: %d) from channel context: %d MHz\n",
+ vif->addr, vif->type, link_conf->link_id,
+@@ -2569,8 +2565,6 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ if (test_bit(MT76_SCANNING, &phy->mt76->state))
+ mt7996_scan_complete(phy, true);
+
+- mconf = mconf_dereference_protected(mvif, link_conf->link_id);
+- mconf->chanctx = NULL;
+ ctx->nbss_assigned--;
+
+ mutex_unlock(&phy->dev->mt76.mutex);
+@@ -2744,7 +2738,7 @@ mt7996_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+
+ /* trigger calibration for DFS link */
+ if (!cfg80211_reg_can_beacon(hw->wiphy,
+- &mconf->chanctx->chandef,
++ &phy->chanctx->chandef,
+ NL80211_IFTYPE_AP))
+ mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_SWITCH,
+ true);
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 259845a1..8f084651 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -347,8 +347,6 @@ struct mt7996_bss_conf {
+ struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
+ struct cfg80211_bitrate_mask bitrate_mask;
+
+- struct mt7996_chanctx *chanctx;
+-
+ u8 link_id;
+ u8 own_mld_id;
+ u8 bpcc;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0141-mtk-mt76-mt7996-temporarily-disable-EPCS.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0141-mtk-mt76-mt7996-temporarily-disable-EPCS.patch
new file mode 100644
index 0000000..98d1f3a
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0141-mtk-mt76-mt7996-temporarily-disable-EPCS.patch
@@ -0,0 +1,28 @@
+From 268b885a43ad602ac8166ba9464d6b2673045ae1 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Tue, 28 May 2024 15:58:57 +0800
+Subject: [PATCH 141/199] mtk: mt76: mt7996: temporarily disable EPCS
+
+EPCS is not yet ready, so do not claim to support it.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/init.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 01795404..7cf3a37e 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -1518,7 +1518,7 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+ eht_cap->has_eht = true;
+
+ eht_cap_elem->mac_cap_info[0] =
+- IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
++ // IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
+ IEEE80211_EHT_MAC_CAP0_OM_CONTROL |
+ u8_encode_bits(IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454,
+ IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0142-mtk-mt76-mt7996-fix-kite-can-t-handle-11v-beacon-on-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0142-mtk-mt76-mt7996-fix-kite-can-t-handle-11v-beacon-on-.patch
new file mode 100644
index 0000000..8aabd07
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0142-mtk-mt76-mt7996-fix-kite-can-t-handle-11v-beacon-on-.patch
@@ -0,0 +1,37 @@
+From ab5d7deb92a8180b4d236da52863bfe9b7327dca Mon Sep 17 00:00:00 2001
+From: Rex Lu <rex.lu@mediatek.com>
+Date: Thu, 30 May 2024 17:39:38 +0800
+Subject: [PATCH 142/199] mtk: mt76: mt7996: fix kite can't handle 11v beacon
+ on sta side
+
+this hw flag SUPPORTS_MULTI_BSSID need to set. otherwise cfg80211_parse_mbssid_data will not handle 11v mbss beacon
+
+Signed-off-by: Rex Lu <rex.lu@mediatek.com>
+---
+ mt7996/init.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 7cf3a37e..cc696a69 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -48,6 +48,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
+
+ static const u8 mt7996_if_types_ext_capa[] = {
+ [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
++ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
+ [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
+ };
+
+@@ -447,7 +448,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+ ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
+ ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
+ ieee80211_hw_set(hw, WANT_MONITOR_VIF);
+- // ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
++ ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
+ ieee80211_hw_set(hw, CHANCTX_STA_CSA);
+ ieee80211_hw_set(hw, CONNECTION_MONITOR);
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0143-mtk-mt76-mt7996-add-post-channel-switch-for-DFS-chan.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0143-mtk-mt76-mt7996-add-post-channel-switch-for-DFS-chan.patch
new file mode 100644
index 0000000..cd106e8
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0143-mtk-mt76-mt7996-add-post-channel-switch-for-DFS-chan.patch
@@ -0,0 +1,67 @@
+From 7b2e80bf62f10469992b8e08c801e9b64f7c775d Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Wed, 21 Feb 2024 13:41:23 +0800
+Subject: [PATCH 143/199] mtk: mt76: mt7996: add post channel switch for DFS
+ channel switching
+
+Add post channel switch callback for DFS channel switch support
+After CAC, we need to set channel again for DFS RDD (notify to change
+state from cac to active)
+Add IEEE80211_HW_HANDLE_QUIET_CSA flag to avoid stopping the entire vif TX
+queue when csa_blocked_tx is raised especially for DFS channel switch.
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7996/init.c | 1 +
+ mt7996/main.c | 16 ++++++++++++++++
+ 2 files changed, 17 insertions(+)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index cc696a69..0ee2acfb 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -451,6 +451,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+ ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
+ ieee80211_hw_set(hw, CHANCTX_STA_CSA);
+ ieee80211_hw_set(hw, CONNECTION_MONITOR);
++ ieee80211_hw_set(hw, HANDLES_QUIET_CSA);
+
+ hw->max_tx_fragments = 4;
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 4f3b0070..c8259b86 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1078,6 +1078,21 @@ fail:
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
++static int
++mt7996_post_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_bss_conf *link_conf)
++{
++ struct cfg80211_chan_def *chandef = &link_conf->chanreq.oper;
++ struct mt7996_phy *phy = mt7996_band_phy(hw, chandef->chan->band);
++ int ret;
++
++ ret = cfg80211_chandef_dfs_required(hw->wiphy, chandef, NL80211_IFTYPE_AP);
++ if (ret <= 0)
++ return ret;
++
++ return mt7996_set_channel(phy, chandef);
++}
++
+ static void mt7996_remove_link_sta(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
+@@ -2791,6 +2806,7 @@ const struct ieee80211_ops mt7996_ops = {
+ .release_buffered_frames = mt76_release_buffered_frames,
+ .get_txpower = mt7996_get_txpower,
+ .channel_switch_beacon = mt7996_channel_switch_beacon,
++ .post_channel_switch = mt7996_post_channel_switch,
+ .get_stats = mt7996_get_stats,
+ .get_et_sset_count = mt7996_get_et_sset_count,
+ .get_et_stats = mt7996_get_et_stats,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0144-mtk-mt76-mt7996-update-testmode-bf-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0144-mtk-mt76-mt7996-update-testmode-bf-support.patch
new file mode 100644
index 0000000..e6b3a8c
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0144-mtk-mt76-mt7996-update-testmode-bf-support.patch
@@ -0,0 +1,342 @@
+From 90a87564fc0a2fd18c73b290548e6ad299f4b3c9 Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Mon, 3 Jun 2024 16:40:38 +0800
+Subject: [PATCH 144/199] mtk: mt76: mt7996: update testmode bf support
+
+Fix bssid & omac idx to band idx when testmode is enabled
+
+Add support for per-packet bw & primary channel selection index configuration
+This is used for ibf calibaration of group 9 ~ 13 in Kite
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt76.h | 3 +++
+ mt7996/main.c | 29 +++++++++++++++-------
+ mt7996/testmode.c | 63 ++++++++++++++++++++++++++++++++---------------
+ testmode.c | 15 ++++++++---
+ testmode.h | 6 +++++
+ tools/fields.c | 16 ++++++++++--
+ 6 files changed, 98 insertions(+), 34 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index c6dda4a8..f544814e 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -782,6 +782,9 @@ struct mt76_testmode_data {
+ bool ibf;
+ bool ebf;
+
++ u8 tx_pkt_bw;
++ u8 tx_pri_sel;
++
+ u32 freq_offset;
+
+ u8 tx_power[4];
+diff --git a/mt7996/main.c b/mt7996/main.c
+index c8259b86..21457a61 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -349,16 +349,27 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
+ mconf = &mvif->deflink;
+ }
+
+- mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask);
+- if (mconf->mt76.idx >= mt7996_max_interface_num(dev)) {
+- ret = -ENOSPC;
+- goto error;
+- }
++ if (!dev->testmode_enable) {
++ mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask);
++ if (mconf->mt76.idx >= mt7996_max_interface_num(dev)) {
++ ret = -ENOSPC;
++ goto error;
++ }
+
+- idx = get_omac_idx(vif->type, phy->omac_mask);
+- if (idx < 0) {
+- ret = -ENOSPC;
+- goto error;
++ idx = get_omac_idx(vif->type, phy->omac_mask);
++ if (idx < 0) {
++ ret = -ENOSPC;
++ goto error;
++ }
++ } else {
++ /* bss idx & omac idx should be set to band idx for ibf cal */
++ if (dev->mt76.vif_mask & BIT_ULL(band_idx) ||
++ phy->omac_mask & BIT_ULL(band_idx)) {
++ ret = -ENOSPC;
++ goto error;
++ }
++ mconf->mt76.idx = band_idx;
++ idx = band_idx;
+ }
+
+ mconf->own_mld_id = get_own_mld_idx(dev->mld_id_mask, false);
+diff --git a/mt7996/testmode.c b/mt7996/testmode.c
+index 8b35d125..b956915e 100644
+--- a/mt7996/testmode.c
++++ b/mt7996/testmode.c
+@@ -235,8 +235,10 @@ mt7996_tm_init(struct mt7996_phy *phy, bool en)
+
+ mt7996_tm_rf_switch_mode(dev, rf_test_mode);
+
+- mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, &mvif->sta.deflink, en);
+- mt7996_mcu_add_sta(dev, &phy->monitor_vif->bss_conf, &mvif->deflink, NULL, &mvif->sta.deflink, en, false);
++ mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf,
++ &mvif->deflink, &mvif->sta.deflink, en);
++ mt7996_mcu_add_sta(dev, &phy->monitor_vif->bss_conf, &mvif->deflink,
++ NULL, &mvif->sta.deflink, en, false);
+
+ mt7996_tm_set(dev, SET_ID(BAND_IDX), phy->mt76->band_idx);
+
+@@ -252,9 +254,11 @@ mt7996_tm_update_channel(struct mt7996_phy *phy)
+ {
+ #define CHAN_FREQ_BW_80P80_TAG (SET_ID(CHAN_FREQ) | BIT(16))
+ struct mt7996_dev *dev = phy->dev;
++ struct mt76_testmode_data *td = &phy->mt76->test;
+ struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
+ struct ieee80211_channel *chan = chandef->chan;
+- u8 width = chandef->width;
++ u8 dbw, width = chandef->width, pri_sel = 0;
++ int width_mhz;
+ static const u8 ch_band[] = {
+ [NL80211_BAND_2GHZ] = 0,
+ [NL80211_BAND_5GHZ] = 1,
+@@ -274,18 +278,37 @@ mt7996_tm_update_channel(struct mt7996_phy *phy)
+ mt7996_tm_set(dev, CHAN_FREQ_BW_80P80_TAG, chandef->center_freq2 * 1000);
+ }
+
+- /* TODO: define per-packet bw */
+- /* per-packet bw */
+- mt7996_tm_set(dev, SET_ID(DBW), mt7996_tm_bw_mapping(width, BW_MAP_NL_TO_FW));
++ width_mhz = mt7996_tm_bw_mapping(width, BW_MAP_NL_TO_MHZ);
++
++ /* data (per-packet) bw */
++ dbw = width;
++ if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_PKT_BW)) {
++ int pkt_bw_mhz = mt7996_tm_bw_mapping(td->tx_pkt_bw, BW_MAP_NL_TO_MHZ);
++
++ if (pkt_bw_mhz > width_mhz) {
++ dev_info(dev->mt76.dev,
++ "per-packet bw cannot exceed system bw, use %d MHz instead\n",
++ width_mhz);
++ td->tx_pkt_bw = width;
++ }
++ dbw = td->tx_pkt_bw;
++ }
++ mt7996_tm_set(dev, SET_ID(DBW), mt7996_tm_bw_mapping(dbw, BW_MAP_NL_TO_FW));
+
+ /* control channel selection index */
+- mt7996_tm_set(dev, SET_ID(PRIMARY_CH), 0);
++ if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_PRI_SEL)) {
++ if (td->tx_pri_sel > width_mhz / 20 - 1) {
++ dev_info(dev->mt76.dev,
++ "Invalid primary channel selection index, use 0 instead\n");
++ td->tx_pri_sel = 0;
++ }
++ pri_sel = td->tx_pri_sel;
++ }
++ mt7996_tm_set(dev, SET_ID(PRIMARY_CH), pri_sel);
+ mt7996_tm_set(dev, SET_ID(BAND), ch_band[chan->band]);
+
+ /* trigger switch channel calibration */
+ mt7996_tm_set(dev, SET_ID(CHAN_FREQ), chandef->center_freq1 * 1000);
+-
+- // TODO: update power limit table
+ }
+
+ static void
+@@ -1179,14 +1202,9 @@ mt7996_tm_txbf_init(struct mt7996_phy *phy, u16 *val)
+ mt7996_tm_set_mac_addr(dev, td->addr[1], SET_ID(SA));
+ mt7996_tm_set_mac_addr(dev, td->addr[2], SET_ID(BSSID));
+
+- /* bss idx & omac idx should be set to band idx for ibf cal */
+- mvif->deflink.mt76.idx = band_idx;
+- dev->mt76.vif_mask |= BIT_ULL(mvif->deflink.mt76.idx);
+- mvif->deflink.mt76.omac_idx = band_idx;
+- phy->omac_mask |= BIT_ULL(mvif->deflink.mt76.omac_idx);
+-
+ mt7996_mcu_add_dev_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, true);
+- mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, &mvif->sta.deflink, true);
++ mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf,
++ &mvif->deflink, &mvif->sta.deflink, true);
+
+ if (td->ibf) {
+ if (td->is_txbf_dut) {
+@@ -1360,7 +1378,8 @@ mt7996_tm_add_txbf_sta(struct mt7996_phy *phy, u8 pfmu_idx, u8 nr, u8 nc, bool e
+ .tx_mode = mt7996_tm_rate_mapping(td->tx_rate_mode, RATE_MODE_TO_PHY),
+ },
+ };
+- u8 ndp_rate, ndpa_rate, rept_poll_rate, bf_bw;
++ u8 ndp_rate, ndpa_rate, rept_poll_rate;
++ u8 bf_bw = phy->mt76->chandef.width;
+
+ if ((td->tx_rate_mode == MT76_TM_TX_MODE_HE_SU ||
+ td->tx_rate_mode == MT76_TM_TX_MODE_EHT_SU) && !td->ibf) {
+@@ -1390,11 +1409,12 @@ mt7996_tm_add_txbf_sta(struct mt7996_phy *phy, u8 pfmu_idx, u8 nr, u8 nc, bool e
+ }
+ }
+
+- bf_bw = mt7996_tm_bw_mapping(phy->mt76->chandef.width, BW_MAP_NL_TO_BF);
+ req.bf.ndp_rate = ndp_rate;
+ req.bf.ndpa_rate = ndpa_rate;
+ req.bf.rept_poll_rate = rept_poll_rate;
+- req.bf.bw = bf_bw;
++ if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_PKT_BW))
++ bf_bw = td->tx_pkt_bw;
++ req.bf.bw = mt7996_tm_bw_mapping(bf_bw, BW_MAP_NL_TO_BF);
+ req.bf.tx_mode = (td->tx_rate_mode == MT76_TM_TX_MODE_EHT_SU) ? 0xf : req.bf.tx_mode;
+
+ if (ebf) {
+@@ -1421,6 +1441,7 @@ mt7996_tm_txbf_profile_update(struct mt7996_phy *phy, u16 *val, bool ebf)
+ struct mt7996_dev *dev = phy->dev;
+ struct mt7996_pfmu_tag *tag = dev->test.txbf_pfmu_tag;
+ u8 rate, pfmu_idx = val[0], nc = val[2], nr;
++ u8 dbw = phy->mt76->chandef.width;
+ int ret;
+ bool is_atenl = val[5];
+
+@@ -1439,7 +1460,9 @@ mt7996_tm_txbf_profile_update(struct mt7996_phy *phy, u16 *val, bool ebf)
+ tag->t1.nr = nr;
+ tag->t1.nc = nc;
+ tag->t1.invalid_prof = true;
+- tag->t1.data_bw = mt7996_tm_bw_mapping(phy->mt76->chandef.width, BW_MAP_NL_TO_BF);
++ if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_PKT_BW))
++ dbw = td->tx_pkt_bw;
++ tag->t1.data_bw = mt7996_tm_bw_mapping(dbw, BW_MAP_NL_TO_BF);
+ tag->t2.se_idx = td->tx_spe_idx;
+
+ if (ebf) {
+diff --git a/testmode.c b/testmode.c
+index f1d162ce..f7237cc0 100644
+--- a/testmode.c
++++ b/testmode.c
+@@ -25,6 +25,8 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
+ [MT76_TM_ATTR_TX_DUTY_CYCLE] = { .type = NLA_U8 },
+ [MT76_TM_ATTR_TX_IPG] = { .type = NLA_U32 },
+ [MT76_TM_ATTR_TX_TIME] = { .type = NLA_U32 },
++ [MT76_TM_ATTR_TX_PKT_BW] = { .type = NLA_U8 },
++ [MT76_TM_ATTR_TX_PRI_SEL] = { .type = NLA_U8 },
+ [MT76_TM_ATTR_FREQ_OFFSET] = { .type = NLA_U32 },
+ [MT76_TM_ATTR_DRV_DATA] = { .type = NLA_NESTED },
+ [MT76_TM_ATTR_OFF_CH_SCAN_CH] = { .type = NLA_U8 },
+@@ -567,12 +569,15 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ &td->tx_duty_cycle, 0, 99) ||
+ mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_POWER_CONTROL],
+ &td->tx_power_control, 0, 1) ||
++ mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_PKT_BW], &td->tx_pkt_bw,
++ NL80211_CHAN_WIDTH_20_NOHT, NL80211_CHAN_WIDTH_320) ||
++ mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_PRI_SEL], &td->tx_pri_sel, 0, 15) ||
+ mt76_tm_get_u8(tb[MT76_TM_ATTR_AID], &td->aid, 0, 16) ||
+ mt76_tm_get_u8(tb[MT76_TM_ATTR_OFF_CH_SCAN_CH], &td->offchan_ch, 36, 196) ||
+ mt76_tm_get_u8(tb[MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH], &td->offchan_center_ch,
+ 36, 196) ||
+- mt76_tm_get_u8(tb[MT76_TM_ATTR_OFF_CH_SCAN_BW],
+- &td->offchan_bw, NL80211_CHAN_WIDTH_20_NOHT, NL80211_CHAN_WIDTH_160) ||
++ mt76_tm_get_u8(tb[MT76_TM_ATTR_OFF_CH_SCAN_BW], &td->offchan_bw,
++ NL80211_CHAN_WIDTH_20_NOHT, NL80211_CHAN_WIDTH_160) ||
+ mt76_tm_get_u8(tb[MT76_TM_ATTR_IPI_THRESHOLD], &td->ipi_threshold, 0, 10) ||
+ mt76_tm_get_u8(tb[MT76_TM_ATTR_IPI_RESET], &td->ipi_reset, 0, 1))
+ goto out;
+@@ -616,7 +621,7 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+
+ err = mt76_tm_get_u8(cur, &td->tx_power[idx++], 0, 63);
+ if (err)
+- return err;
++ goto out;
+ }
+ }
+
+@@ -823,6 +828,10 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
+ nla_put_u32(msg, MT76_TM_ATTR_TX_TIME, td->tx_time)) ||
+ (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER_CONTROL) &&
+ nla_put_u8(msg, MT76_TM_ATTR_TX_POWER_CONTROL, td->tx_power_control)) ||
++ (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_PKT_BW) &&
++ nla_put_u8(msg, MT76_TM_ATTR_TX_PKT_BW, td->tx_pkt_bw)) ||
++ (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_PRI_SEL) &&
++ nla_put_u8(msg, MT76_TM_ATTR_TX_PRI_SEL, td->tx_pri_sel)) ||
+ (mt76_testmode_param_present(td, MT76_TM_ATTR_FREQ_OFFSET) &&
+ nla_put_u32(msg, MT76_TM_ATTR_FREQ_OFFSET, td->freq_offset)))
+ goto out;
+diff --git a/testmode.h b/testmode.h
+index bda7624a..ed2068e5 100644
+--- a/testmode.h
++++ b/testmode.h
+@@ -37,6 +37,9 @@
+ * @MT76_TM_ATTR_TX_POWER_CONTROL: enable tx power control (u8)
+ * @MT76_TM_ATTR_TX_POWER: per-antenna tx power array (nested, u8 attrs)
+ *
++ * @MT76_TM_ATTR_TX_PKT_BW: per-packet data bandwidth (u8)
++ * @MT76_TM_ATTR_TX_PRI_SEL: primary channel selection index (u8)
++ *
+ * @MT76_TM_ATTR_FREQ_OFFSET: RF frequency offset (u32)
+ *
+ * @MT76_TM_ATTR_STATS: statistics (nested, see &enum mt76_testmode_stats_attr)
+@@ -104,6 +107,9 @@ enum mt76_testmode_attr {
+ MT76_TM_ATTR_TX_POWER_CONTROL,
+ MT76_TM_ATTR_TX_POWER,
+
++ MT76_TM_ATTR_TX_PKT_BW,
++ MT76_TM_ATTR_TX_PRI_SEL,
++
+ MT76_TM_ATTR_FREQ_OFFSET,
+
+ MT76_TM_ATTR_STATS,
+diff --git a/tools/fields.c b/tools/fields.c
+index f793d1a5..8b372602 100644
+--- a/tools/fields.c
++++ b/tools/fields.c
+@@ -35,13 +35,21 @@ static const char * const testmode_tx_mode[] = {
+ [MT76_TM_TX_MODE_EHT_MU] = "eht_mu",
+ };
+
+-static const char * const testmode_offchan_bw[] = {
++static const char * const testmode_bw[] = {
+ [NL80211_CHAN_WIDTH_20_NOHT] = "NOHT",
+ [NL80211_CHAN_WIDTH_20] = "20",
+ [NL80211_CHAN_WIDTH_40] = "40",
+ [NL80211_CHAN_WIDTH_80] = "80",
+ [NL80211_CHAN_WIDTH_80P80] = "80p80",
+ [NL80211_CHAN_WIDTH_160] = "160",
++ [NL80211_CHAN_WIDTH_5] = "5",
++ [NL80211_CHAN_WIDTH_10] = "10",
++ [NL80211_CHAN_WIDTH_1] = "1",
++ [NL80211_CHAN_WIDTH_2] = "2",
++ [NL80211_CHAN_WIDTH_4] = "4",
++ [NL80211_CHAN_WIDTH_8] = "8",
++ [NL80211_CHAN_WIDTH_16] = "16",
++ [NL80211_CHAN_WIDTH_320] = "320",
+ };
+
+ static const char * const testmode_txbf_act[] = {
+@@ -430,6 +438,8 @@ static const struct tm_field testdata_fields[NUM_MT76_TM_ATTRS] = {
+ FIELD(u8, TX_POWER_CONTROL, "tx_power_control"),
+ FIELD_ARRAY(u8, TX_POWER, "tx_power"),
+ FIELD(u8, TX_ANTENNA, "tx_antenna"),
++ FIELD_ENUM(TX_PKT_BW, "tx_pkt_bw", testmode_bw),
++ FIELD(u8, TX_PRI_SEL, "tx_pri_sel"),
+ FIELD(u32, FREQ_OFFSET, "freq_offset"),
+ FIELD(u8, AID, "aid"),
+ FIELD(u8, RU_ALLOC, "ru_alloc"),
+@@ -438,7 +448,7 @@ static const struct tm_field testdata_fields[NUM_MT76_TM_ATTRS] = {
+ FIELD_ARRAY(u16_hex, TXBF_PARAM, "txbf_param"),
+ FIELD(u8, OFF_CH_SCAN_CH, "offchan_ch"),
+ FIELD(u8, OFF_CH_SCAN_CENTER_CH, "offchan_center_ch"),
+- FIELD_ENUM(OFF_CH_SCAN_BW, "offchan_bw", testmode_offchan_bw),
++ FIELD_ENUM(OFF_CH_SCAN_BW, "offchan_bw", testmode_bw),
+ FIELD(u8, IPI_THRESHOLD, "ipi_threshold"),
+ FIELD(u32, IPI_PERIOD, "ipi_period"),
+ FIELD(u8, IPI_RESET, "ipi_reset"),
+@@ -469,6 +479,8 @@ static struct nla_policy testdata_policy[NUM_MT76_TM_ATTRS] = {
+ [MT76_TM_ATTR_TX_POWER_CONTROL] = { .type = NLA_U8 },
+ [MT76_TM_ATTR_TX_ANTENNA] = { .type = NLA_U8 },
+ [MT76_TM_ATTR_TX_SPE_IDX] = { .type = NLA_U8 },
++ [MT76_TM_ATTR_TX_PKT_BW] = { .type = NLA_U8 },
++ [MT76_TM_ATTR_TX_PRI_SEL] = { .type = NLA_U8 },
+ [MT76_TM_ATTR_FREQ_OFFSET] = { .type = NLA_U32 },
+ [MT76_TM_ATTR_AID] = { .type = NLA_U8 },
+ [MT76_TM_ATTR_RU_ALLOC] = { .type = NLA_U8 },
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0145-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0145-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch
new file mode 100644
index 0000000..a72a37c
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0145-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch
@@ -0,0 +1,190 @@
+From 37fd1cdf8fb3c77948c858e7bb258cd02b3cac31 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Mon, 27 May 2024 19:06:04 +0800
+Subject: [PATCH 145/199] mtk: mt76: mt7996: add mlo related debugfs knob
+
+Add the following debugfs knob
+Per-bss link info
+ - /sys/kernel/debug/ieee80211/phy0/<interface>/mt76_link_info
+Per-station link info
+ - /sys/kernel/debug/ieee80211/phy0/<interface>/stations/<mac address>/mt76_link_info
+
+Add TX MSDU failed, retried counts, and PER to mt76_links_info DebugFS knob.
+Remove MSDU statistics from link_sta_info DebugFS knob, since MSDUs are MLD-wise, instead of link-wise, handled.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/debugfs.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/main.c | 1 +
+ mt7996/mt7996.h | 1 +
+ 3 files changed, 119 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 71dc0449..6eb395c4 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1330,11 +1330,128 @@ mt7996_queues_show(struct seq_file *s, void *data)
+
+ DEFINE_SHOW_ATTRIBUTE(mt7996_queues);
+
++static int
++mt7996_sta_links_info_show(struct seq_file *s, void *data)
++{
++ struct ieee80211_sta *sta = s->private;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ u64 tx_cnt = 0, tx_fails = 0, tx_retries = 0, rx_cnt = 0;
++ struct mt7996_dev *dev = msta->vif->dev;
++ unsigned long valid_links;
++ u8 link_id;
++
++ seq_printf(s, "primary link, link ID = %d\n", msta->pri_link);
++ seq_printf(s, "secondary link, link ID = %d\n", msta->sec_link);
++ seq_printf(s, "valid links = 0x%x\n", sta->valid_links);
++
++ mutex_lock(&dev->mt76.mutex);
++ valid_links = sta->valid_links ?: BIT(0);
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_link_sta *mlink =
++ mlink_dereference_protected(msta, link_id);
++ struct mt76_wcid *wcid;
++
++ if (!mlink)
++ continue;
++
++ wcid = &mlink->wcid;
++
++ tx_cnt += wcid->stats.tx_packets;
++ tx_fails += wcid->stats.tx_packets_failed;
++ tx_retries += wcid->stats.tx_packets_retried;
++ rx_cnt += wcid->stats.rx_packets;
++
++ seq_printf(s, "link%d: wcid=%d, phy=%d, link_valid=%d\n",
++ wcid->link_id, wcid->idx, wcid->phy_idx, wcid->link_valid);
++ }
++ mutex_unlock(&dev->mt76.mutex);
++
++ /* PER may be imprecise, because MSDU total and failed counts
++ * are updated at different times.
++ */
++ seq_printf(s, "TX MSDU Count: %llu\n", tx_cnt);
++ seq_printf(s, "TX MSDU Fails: %llu (PER: %llu.%llu%%)\n", tx_fails,
++ tx_cnt ? tx_fails * 1000 / tx_cnt / 10 : 0,
++ tx_cnt ? tx_fails * 1000 / tx_cnt % 10 : 0);
++ seq_printf(s, "TX MSDU Retries: %llu\n", tx_retries);
++ seq_printf(s, "RX MSDU Count: %llu\n", rx_cnt);
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_sta_links_info);
++
+ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, struct dentry *dir)
+ {
+ debugfs_create_file("fixed_rate", 0600, dir, sta, &fops_fixed_rate);
+ debugfs_create_file("hw-queues", 0400, dir, sta, &mt7996_queues_fops);
++ debugfs_create_file("mt76_links_info", 0400, dir, sta,
++ &mt7996_sta_links_info_fops);
++}
++
++static int
++mt7996_vif_links_info_show(struct seq_file *s, void *data)
++{
++ struct ieee80211_vif *vif = s->private;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_dev *dev = mvif->dev;
++ struct mt7996_bss_conf *mconf;
++ struct mt7996_link_sta *mlink;
++ unsigned long valid_links;
++ u8 link_id, i;
++
++ static const char* width_to_bw[] = {
++ [NL80211_CHAN_WIDTH_40] = "40",
++ [NL80211_CHAN_WIDTH_80] = "80",
++ [NL80211_CHAN_WIDTH_80P80] = "80+80",
++ [NL80211_CHAN_WIDTH_160] = "160",
++ [NL80211_CHAN_WIDTH_5] = "5",
++ [NL80211_CHAN_WIDTH_10] = "10",
++ [NL80211_CHAN_WIDTH_20] = "20",
++ [NL80211_CHAN_WIDTH_20_NOHT] = "20_NOHT",
++ [NL80211_CHAN_WIDTH_320] = "320",
++ };
++
++ seq_printf(s, "master link id = %d\n", mvif->master_link_id);
++ seq_printf(s, "group mld id = %d\n", mvif->group_mld_id);
++ seq_printf(s, "mld remap id = %d\n", mvif->mld_remap_id);
++
++ seq_printf(s, "valid links = 0x%x\n", vif->valid_links);
++ for (i = 0; i < __MT_MAX_BAND; i++)
++ seq_printf(s, "band%d_link_id = %d\n", i, mvif->band_to_link[i]);
++
++ mutex_lock(&dev->mt76.mutex);
++ valid_links = vif->valid_links ?: BIT(0);
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ mconf = mconf_dereference_protected(mvif, link_id);
++ mlink = mlink_dereference_protected(&mvif->sta, link_id);
++
++ if (!mconf || !mlink)
++ continue;
++
++ seq_printf(s, "- link[%02d]: bss_idx = %d, wcid = %d\n",
++ mconf->link_id, mconf->mt76.idx, mlink->wcid.idx);
++ seq_printf(s, " omac_idx = %d, own_mld_id=%d\n",
++ mconf->mt76.omac_idx, mconf->own_mld_id);
++
++ if (!mconf->phy->chanctx)
++ continue;
++
++ seq_printf(s, " band_idx=%d, channel=%d, bw%s\n",
++ mconf->mt76.band_idx,
++ mconf->phy->chanctx->chandef.chan->hw_value,
++ width_to_bw[mconf->phy->chanctx->chandef.width]);
++ }
++ mutex_unlock(&dev->mt76.mutex);
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_vif_links_info);
++
++void mt7996_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
++{
++ debugfs_create_file("mt76_links_info", 0400, vif->debugfs_dir, vif,
++ &mt7996_vif_links_info_fops);
+ }
+
+ static void
+@@ -1473,7 +1590,6 @@ mt7996_link_sta_info_show(struct seq_file *file, void *data)
+ seq_printf(file, "Statistics:\n");
+ seq_printf(file, "\tTX:\n");
+ seq_printf(file, "\t\tBytes: %llu\n", stats->tx_bytes);
+- seq_printf(file, "\t\tMSDU Count: %u\n", stats->tx_packets);
+ seq_printf(file, "\t\tMPDU Count: %u\n", stats->tx_mpdus);
+ seq_printf(file, "\t\tMPDU Fails: %u (PER: %u.%u%%)\n", stats->tx_failed,
+ stats->tx_mpdus ? stats->tx_failed * 1000 / stats->tx_mpdus / 10 : 0,
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 21457a61..a85fa935 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2841,6 +2841,7 @@ const struct ieee80211_ops mt7996_ops = {
+ .sta_add_debugfs = mt7996_sta_add_debugfs,
+ .link_sta_add_debugfs = mt7996_link_sta_add_debugfs,
+ // .link_add_debugfs = mt7996_link_add_debugfs,
++ .vif_add_debugfs = mt7996_vif_add_debugfs,
+ #endif
+ .set_radar_background = mt7996_set_radar_background,
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 8f084651..b5869bb8 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1247,6 +1247,7 @@ int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, struct dentry *dir);
++void mt7996_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+ void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_link_sta *link_sta,
+ struct dentry *dir);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0146-mtk-mt76-mt7996-add-debugfs-knob-to-show-mlo-related.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0146-mtk-mt76-mt7996-add-debugfs-knob-to-show-mlo-related.patch
new file mode 100644
index 0000000..a116432
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0146-mtk-mt76-mt7996-add-debugfs-knob-to-show-mlo-related.patch
@@ -0,0 +1,203 @@
+From e35c211ac14b2189475f945ca9025e444d825c97 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Wed, 29 May 2024 18:45:50 +0800
+Subject: [PATCH 146/199] mtk: mt76: mt7996: add debugfs knob to show mlo
+ related table
+
+Add the following debugfs knob
+- /sys/kernel/debug/ieee80211/phy0/mt76/mat_table
+- /sys/kernel/debug/ieee80211/phy0/mt76/band0/agg_table
+- /sys/kernel/debug/ieee80211/phy0/mt76/band0/rmac_table
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/debugfs.c | 3 +-
+ mt7996/mt7996.h | 3 +-
+ mt7996/mtk_debug_i.h | 24 +++++++++++
+ mt7996/mtk_debugfs_i.c | 92 +++++++++++++++++++++++++++++++++++++++++-
+ 4 files changed, 119 insertions(+), 3 deletions(-)
+
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 6eb395c4..968174e6 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1107,6 +1107,7 @@ int mt7996_init_band_debugfs(struct mt7996_phy *phy)
+
+ #ifdef CONFIG_MTK_DEBUG
+ mt7996_mtk_init_band_debugfs(phy, dir);
++ mt7996_mtk_init_band_debugfs_internal(phy, dir);
+ #endif
+ return 0;
+ }
+@@ -1143,7 +1144,7 @@ int mt7996_init_dev_debugfs(struct mt7996_phy *phy)
+ if (phy == &dev->phy) {
+ dev->debugfs_dir = dir;
+ #ifdef CONFIG_MTK_DEBUG
+- mt7996_mtk_init_debugfs_internal(phy, dir);
++ mt7996_mtk_init_dev_debugfs_internal(phy, dir);
+ #endif
+ }
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index b5869bb8..96d8aae9 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1322,7 +1322,8 @@ void mt7996_packet_log_to_host(struct mt7996_dev *dev, const void *data, int len
+ void mt7996_dump_bmac_rxd_info(struct mt7996_dev *dev, __le32 *rxd);
+ void mt7996_dump_bmac_txd_info(struct seq_file *s, struct mt7996_dev *dev,
+ __le32 *txd, bool is_hif_txd, bool dump_txp);
+-int mt7996_mtk_init_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
++int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
++int mt7996_mtk_init_band_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
+ #endif
+
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mtk_debug_i.h b/mt7996/mtk_debug_i.h
+index d3756fa2..cec8d57e 100644
+--- a/mt7996/mtk_debug_i.h
++++ b/mt7996/mtk_debug_i.h
+@@ -982,6 +982,30 @@
+ #define HIF_TXP_ML_SHIFT 16
+ #define HIF_TXP_ML_MASK 0xffff0000
+
++/* UWTBL */
++#define MT_WF_UWTBL_BASE 0x820c4000
++#define MT_WF_UWTBL(ofs) (MT_WF_UWTBL_BASE + (ofs))
++
++#define MT_WF_UWTBL_ITCR MT_WF_UWTBL(0x130)
++#define MT_WF_UWTBL_ITCR0 MT_WF_UWTBL(0x138)
++#define MT_WF_UWTBL_ITCR1 MT_WF_UWTBL(0x13c)
++
++#define MT_WF_UWTBL_ITCR_SET BIT(31)
++#define MT_WF_UWTBL_ITCR_INDEX GENMASK(5, 0)
++
++/* RMAC */
++#define MT_WF_RMAC_SRAM_DATA0(_band) MT_WF_RMAC(_band, 0x210)
++#define MT_WF_RMAC_SRAM_DATA1(_band) MT_WF_RMAC(_band, 0x214)
++#define MT_WF_RMAC_SRAM_BITMAP0(_band) MT_WF_RMAC(_band, 0x220)
++#define MT_WF_RMAC_SRAM_BITMAP1(_band) MT_WF_RMAC(_band, 0x224)
++#define MT_WF_RMAC_MEM_CTRL(_band) MT_WF_RMAC(_band, 0x228)
++
++#define MT_WF_RMAC_MEM_CRTL_TRIG BIT(31)
++#define MT_WF_RMAC_MEM_CRTL_TDX GENMASK(7, 0)
++
++/* AGG */
++#define MT_AGG_REMAP_CTRL(_band) MT_WF_AGG(_band, 0x094)
++#define MT_AGG_REMAP_CTRL_OM_REMAP GENMASK(5, 0)
+ #endif
+
+ #endif
+diff --git a/mt7996/mtk_debugfs_i.c b/mt7996/mtk_debugfs_i.c
+index ea412cd5..839c3e31 100644
+--- a/mt7996/mtk_debugfs_i.c
++++ b/mt7996/mtk_debugfs_i.c
+@@ -695,7 +695,86 @@ static int mt7996_rx_msdu_pg_read(struct seq_file *s, void *data)
+ return 0;
+ }
+
+-int mt7996_mtk_init_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
++static int
++mt7996_mat_table_show(struct seq_file *s, void *data)
++{
++#define MT_MAX_MAT_TABLE_SIZE 63
++ struct mt7996_dev *dev = s->private;
++ int i;
++
++ for (i = 0; i < MT_MAX_MAT_TABLE_SIZE; i++) {
++ u32 req = MT_WF_UWTBL_ITCR_SET |
++ u32_encode_bits(i, MT_WF_UWTBL_ITCR_INDEX);
++ u32 dw[2];
++ u8 *addr = (u8 *)dw;
++
++ mt76_wr(dev, MT_WF_UWTBL_ITCR, req);
++ dw[0] = mt76_rr(dev, MT_WF_UWTBL_ITCR0);
++ dw[1] = mt76_rr(dev, MT_WF_UWTBL_ITCR1);
++
++ if (dw[0] || dw[1])
++ seq_printf(s, "own_mld_id%d\tAddr: %pM\n", i, addr);
++ }
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_mat_table);
++
++static int
++mt7996_rmac_table_show(struct seq_file *s, void *data)
++{
++ struct mt7996_phy *phy = s->private;
++ struct mt7996_dev *dev = phy->dev;
++ unsigned long usage_bitmap[2] = {0};
++ int i, j;
++ u8 band = phy->mt76->band_idx;
++
++ usage_bitmap[0] = (unsigned long)mt76_rr(dev, MT_WF_RMAC_SRAM_BITMAP0(band));
++ usage_bitmap[1] = (unsigned long)mt76_rr(dev, MT_WF_RMAC_SRAM_BITMAP1(band));
++
++ for (i = 0; i < 2; i++) {
++ for_each_set_bit(j, &usage_bitmap[i], 32) {
++ u32 req = MT_WF_RMAC_MEM_CRTL_TRIG |
++ u32_encode_bits(i * 32 + j, MT_WF_RMAC_MEM_CRTL_TDX);
++ u32 dw[2];
++ u8 *addr = (u8 *)dw;
++
++ mt76_wr(dev, MT_WF_RMAC_MEM_CTRL(band), req);
++ dw[0] = mt76_rr(dev, MT_WF_RMAC_SRAM_DATA0(band));
++ dw[1] = mt76_rr(dev, MT_WF_RMAC_SRAM_DATA1(band));
++
++ seq_printf(s, "omac_idx%d\tAddr: %pM\n", i * 32 + j, addr);
++ }
++ }
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_rmac_table);
++
++static int
++mt7996_agg_table_show(struct seq_file *s, void *data)
++{
++ struct mt7996_phy *phy = s->private;
++ struct mt7996_dev *dev = phy->dev;
++ int i, j;
++ u8 band = phy->mt76->band_idx;
++
++ for (i = 0; i < 4; i++) {
++ u32 value = mt76_rr(dev, MT_AGG_REMAP_CTRL(band) + 4 * i);
++
++ for (j = 0; j < 4; j++) {
++ u8 shift = 8 * j;
++ u32 mask = MT_AGG_REMAP_CTRL_OM_REMAP << shift;
++
++ seq_printf(s, "idx%d: %d\n", i * 4 + j,
++ (value & mask) >> shift);
++ }
++ }
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_agg_table);
++
++int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ struct mt7996_dev *dev = phy->dev;
+
+@@ -714,7 +793,18 @@ int mt7996_mtk_init_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
+ mt7996_pse_fid_read);
+
+ debugfs_create_u8("dump_ple_txd", 0600, dir, &dev->dbg.dump_ple_txd);
++
++ /* MLO related Table */
++ debugfs_create_file("mat_table", 0400, dir, dev, &mt7996_mat_table_fops);
+ return 0;
+ }
+
++int mt7996_mtk_init_band_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
++{
++ /* MLO related Table */
++ debugfs_create_file("rmac_table", 0400, dir, phy, &mt7996_rmac_table_fops);
++ debugfs_create_file("agg_table", 0400, dir, phy, &mt7996_agg_table_fops);
++
++ return 0;
++}
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0147-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0147-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch
new file mode 100644
index 0000000..41861e6
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0147-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch
@@ -0,0 +1,212 @@
+From 8facea1f5154f7a3d246456e0e9e1d16872779a8 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 31 May 2024 10:55:03 +0800
+Subject: [PATCH 147/199] mtk: mt76: mt7996: add debugfs knob to set agc
+
+Add the following debugfs knob
+- /sys/kernel/debug/ieee80211/phy0/mt76/mlo_agc_tx
+- /sys/kernel/debug/ieee80211/phy0/mt76/mlo_agc_trig
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76_connac_mcu.h | 1 +
+ mt7996/mcu.h | 20 ++++++++
+ mt7996/mt7996.h | 1 +
+ mt7996/mtk_debugfs_i.c | 103 +++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_mcu.c | 6 +++
+ 5 files changed, 131 insertions(+)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index d72337d4..f7b1f0d0 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1312,6 +1312,7 @@ enum {
+ MCU_UNI_CMD_THERMAL_CAL = 0x4c,
+ MCU_UNI_CMD_RRO = 0x57,
+ MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
++ MCU_UNI_CMD_MLO = 0x59,
+ MCU_UNI_CMD_PER_STA_INFO = 0x6d,
+ MCU_UNI_CMD_ALL_STA_INFO = 0x6e,
+ MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index c39dcc3c..389aab63 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1157,6 +1157,26 @@ enum {
+ UNI_CMD_SCS_ENABLE,
+ };
+
++enum {
++ UNI_CMD_MLO_AGC_TX = 4,
++ UNI_CMD_MLO_AGC_TRIG = 5,
++};
++
++struct mt7996_mlo_agc_set {
++ u8 rsv[4];
++
++ __le16 tag;
++ __le16 len;
++
++ u8 mld_id;
++ u8 link_id;
++ u8 ac;
++ u8 disp_pol;
++ u8 ratio;
++ u8 order;
++ __le16 mgf;
++} __packed;
++
+ #define MT7996_PATCH_SEC GENMASK(31, 24)
+ #define MT7996_PATCH_SCRAMBLE_KEY GENMASK(15, 8)
+ #define MT7996_PATCH_AES_KEY GENMASK(7, 0)
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 96d8aae9..cb6a5753 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1324,6 +1324,7 @@ void mt7996_dump_bmac_txd_info(struct seq_file *s, struct mt7996_dev *dev,
+ __le32 *txd, bool is_hif_txd, bool dump_txp);
+ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
+ int mt7996_mtk_init_band_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
++int mt7996_mcu_mlo_agc(struct mt7996_dev *dev, const void *data, int len);
+ #endif
+
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mtk_debugfs_i.c b/mt7996/mtk_debugfs_i.c
+index 839c3e31..852d1b12 100644
+--- a/mt7996/mtk_debugfs_i.c
++++ b/mt7996/mtk_debugfs_i.c
+@@ -774,6 +774,106 @@ mt7996_agg_table_show(struct seq_file *s, void *data)
+ }
+ DEFINE_SHOW_ATTRIBUTE(mt7996_agg_table);
+
++static ssize_t mt7996_mlo_agc_tx_set(struct file *file,
++ const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_dev *dev = file->private_data;
++ struct mt7996_mlo_agc_set req;
++ char buf[100];
++ int ret;
++ u16 mgf;
++
++ memset(&req, 0, sizeof(req));
++
++ if (count >= sizeof(buf))
++ return -EINVAL;
++
++ if (copy_from_user(buf, user_buf, count))
++ return -EFAULT;
++
++ if (count && buf[count - 1] == '\n')
++ buf[count - 1] = '\0';
++ else
++ buf[count] = '\0';
++
++ if (sscanf(buf, "%hhu %hhu %hhu %hhu %hu %hhu %hhu",
++ &req.mld_id, &req.link_id, &req.ac, &req.disp_pol,
++ &mgf, &req.ratio, &req.order) != 7) {
++ dev_warn(dev->mt76.dev,
++ "format: [MldRecIdx] [Link] [Ac] [DispPol] [MGF] [Ratio] [Order]\n");
++ goto out;
++ }
++
++ req.tag = cpu_to_le16(UNI_CMD_MLO_AGC_TX);
++ req.len = cpu_to_le16(sizeof(req) - 4);
++ req.mgf = cpu_to_le16(mgf);
++
++ ret = mt7996_mcu_mlo_agc(dev, &req, sizeof(req));
++ if (ret)
++ return -EFAULT;
++
++out:
++ return count;
++}
++
++static const struct file_operations fops_mlo_agc_tx = {
++ .write = mt7996_mlo_agc_tx_set,
++ .open = simple_open,
++ .owner = THIS_MODULE,
++ .llseek = default_llseek,
++};
++
++static ssize_t mt7996_mlo_agc_trig_set(struct file *file,
++ const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_dev *dev = file->private_data;
++ struct mt7996_mlo_agc_set req;
++ char buf[100];
++ int ret;
++ u16 mgf;
++
++ memset(&req, 0, sizeof(req));
++
++ if (count >= sizeof(buf))
++ return -EINVAL;
++
++ if (copy_from_user(buf, user_buf, count))
++ return -EFAULT;
++
++ if (count && buf[count - 1] == '\n')
++ buf[count - 1] = '\0';
++ else
++ buf[count] = '\0';
++
++ if (sscanf(buf, "%hhu %hhu %hhu %hhu %hu %hhu",
++ &req.mld_id, &req.link_id, &req.ac, &req.disp_pol,
++ &mgf, &req.ratio) != 6) {
++ dev_warn(dev->mt76.dev,
++ "format: [MldRecIdx] [Link] [Ac] [DispPol] [MGF] [Ratio]\n");
++ goto out;
++ }
++
++ req.tag = cpu_to_le16(UNI_CMD_MLO_AGC_TRIG);
++ req.len = cpu_to_le16(sizeof(req) - 4);
++ req.mgf = cpu_to_le16(mgf);
++
++ ret = mt7996_mcu_mlo_agc(dev, &req, sizeof(req));
++ if (ret)
++ return -EFAULT;
++
++out:
++ return count;
++}
++
++static const struct file_operations fops_mlo_agc_trig = {
++ .write = mt7996_mlo_agc_trig_set,
++ .open = simple_open,
++ .owner = THIS_MODULE,
++ .llseek = default_llseek,
++};
++
+ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ struct mt7996_dev *dev = phy->dev;
+@@ -796,6 +896,9 @@ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *
+
+ /* MLO related Table */
+ debugfs_create_file("mat_table", 0400, dir, dev, &mt7996_mat_table_fops);
++ debugfs_create_file("mlo_agc_tx", 0200, dir, dev, &fops_mlo_agc_tx);
++ debugfs_create_file("mlo_agc_trig", 0200, dir, dev, &fops_mlo_agc_trig);
++
+ return 0;
+ }
+
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 809181e0..82e3f721 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -1364,4 +1364,10 @@ int mt7996_mcu_thermal_debug(struct mt7996_dev *dev, u8 mode, u8 action)
+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(THERMAL_CAL), &req,
+ sizeof(req), true);
+ }
++
++int mt7996_mcu_mlo_agc(struct mt7996_dev *dev, const void *data, int len)
++{
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MLO), data,
++ len, true);
++}
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0148-mtk-mt76-mt7996-set-unused-band-to-UNSPECIFIED-in-ba.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0148-mtk-mt76-mt7996-set-unused-band-to-UNSPECIFIED-in-ba.patch
new file mode 100644
index 0000000..1e80e00
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0148-mtk-mt76-mt7996-set-unused-band-to-UNSPECIFIED-in-ba.patch
@@ -0,0 +1,66 @@
+From 946c2a0cd923e411009c541184978747947ebb5a Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Wed, 5 Jun 2024 10:11:13 +0800
+Subject: [PATCH 148/199] mtk: mt76: mt7996: set unused band to UNSPECIFIED in
+ band_to_link
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/main.c | 4 ++++
+ mt7996/mcu.c | 3 +++
+ mt7996/mt7996.h | 3 +++
+ 3 files changed, 10 insertions(+)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index a85fa935..b6231dff 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -482,6 +482,8 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
+ mvif->sta.vif = mvif;
+ /* TODO: temporaily set this to prevent some crashes */
+ mvif->deflink.phy = phy;
++ memset(mvif->band_to_link, IEEE80211_LINK_UNSPECIFIED,
++ sizeof(mvif->band_to_link));
+
+ if (vif->type == NL80211_IFTYPE_STATION)
+ ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
+@@ -1054,6 +1056,8 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
+
+ mutex_lock(&dev->mt76.mutex);
+ link_id = mvif->band_to_link[phy->mt76->band_idx];
++ if (link_id == IEEE80211_LINK_UNSPECIFIED)
++ goto out;
+
+ if (!mvif->cs_ready_links)
+ mvif->cs_link_id = link_id;
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 3a950a90..40ba5b43 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -374,6 +374,9 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ int link_id, band_idx = mphy->band_idx;
+
+ link_id = mvif->band_to_link[band_idx];
++ if (link_id == IEEE80211_LINK_UNSPECIFIED)
++ return;
++
+ link_conf = rcu_dereference(vif->link_conf[link_id]);
+
+ if (!link_conf || !link_conf->csa_active || vif->type == NL80211_IFTYPE_STATION)
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index cb6a5753..dc0209de 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -962,6 +962,9 @@ mt7996_get_link_wcid(struct mt7996_dev *dev, u16 idx, u8 band_idx)
+
+ mlink = wcid_to_mlink(wcid);
+ link_id = mlink->sta->vif->band_to_link[band_idx];
++ if (link_id == IEEE80211_LINK_UNSPECIFIED)
++ return wcid;
++
+ mlink = rcu_dereference(mlink->sta->link[link_id]);
+ if (!mlink)
+ return wcid;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0149-mtk-mt76-mt7996-support-per-link-report-of-bss-color.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0149-mtk-mt76-mt7996-support-per-link-report-of-bss-color.patch
new file mode 100644
index 0000000..9e2f7e6
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0149-mtk-mt76-mt7996-support-per-link-report-of-bss-color.patch
@@ -0,0 +1,53 @@
+From bd2464e8ba51bbb00a1b6aabf12041431d57289b Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 5 Jun 2024 19:11:13 +0800
+Subject: [PATCH 149/199] mtk: mt76: mt7996: support per-link report of bss
+ color change
+
+ieee80211_color_change_finish() has been extended for per-link support.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7996/mcu.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 40ba5b43..db388e66 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -472,10 +472,21 @@ out:
+ static void
+ mt7996_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ {
+- if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION)
++ struct mt76_phy *mphy = (struct mt76_phy *)priv;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct ieee80211_bss_conf *link_conf;
++ u8 link_id;
++
++ link_id = mvif->band_to_link[mphy->band_idx];
++ if (link_id == IEEE80211_LINK_UNSPECIFIED)
++ return;
++
++ link_conf = rcu_dereference(vif->link_conf[link_id]);
++ if (!link_conf || !link_conf->color_change_active ||
++ vif->type == NL80211_IFTYPE_STATION)
+ return;
+
+- ieee80211_color_change_finish(vif);
++ ieee80211_color_change_finish(vif, link_id);
+ }
+
+ static void
+@@ -511,7 +522,7 @@ mt7996_mcu_ie_countdown(struct mt7996_dev *dev, struct sk_buff *skb)
+ case UNI_EVENT_IE_COUNTDOWN_BCC:
+ ieee80211_iterate_active_interfaces_atomic(mphy->hw,
+ IEEE80211_IFACE_ITER_RESUME_ALL,
+- mt7996_mcu_cca_finish, mphy->hw);
++ mt7996_mcu_cca_finish, mphy);
+ break;
+ }
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0150-mtk-mt76-mt7996-Fix-inconsistent-QoS-mapping-between.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0150-mtk-mt76-mt7996-Fix-inconsistent-QoS-mapping-between.patch
new file mode 100644
index 0000000..f185fed
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0150-mtk-mt76-mt7996-Fix-inconsistent-QoS-mapping-between.patch
@@ -0,0 +1,191 @@
+From ac20b6e9a96c45213a2bbccb051d16e4408f2969 Mon Sep 17 00:00:00 2001
+From: Rex Lu <rex.lu@mediatek.com>
+Date: Fri, 7 Jun 2024 13:51:25 +0800
+Subject: [PATCH 150/199] mtk: mt76: mt7996: Fix inconsistent QoS mapping
+ between SW and HW
+
+Fix inconsistent QoS mapping between SW and HW.
+Specifically, the mapping from IP DSCP to IEEE 802.11 user priority may be customized.
+Therefore, driver needs to pass the mapping to HW, so that the QoS type of traffic can be mapped in a consistent manner for both SW and HW paths.
+
+Refactor mt7996_mcu_set_qos_map function.
+1. According to fw logic, it will fill the dscp value 0~63 correspond tid.
+for example:
+The last set is 48-56 in the default qos map from hostapd.
+And it will set tid 7. but 57-63 in original function will not fill any value,
+so it will set zero to fw. Once the value of dscp is 57. mac80211 will correspond to tid 7.
+and fw will correspond to tid 0.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Signed-off-by: Rex Lu <rex.lu@mediatek.com>
+---
+ mt76_connac_mcu.h | 1 +
+ mt7996/main.c | 31 ++++++++++++++++++++++++++
+ mt7996/mcu.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mt7996.h | 8 ++++++-
+ 4 files changed, 94 insertions(+), 1 deletion(-)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index f7b1f0d0..0244b5aa 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1262,6 +1262,7 @@ enum {
+ MCU_EXT_CMD_GROUP_PRE_CAL_INFO = 0xab,
+ MCU_EXT_CMD_DPD_PRE_CAL_INFO = 0xac,
+ MCU_EXT_CMD_PHY_STAT_INFO = 0xad,
++ MCU_EXT_CMD_SET_QOS_MAP = 0xb4,
+ };
+
+ enum {
+diff --git a/mt7996/main.c b/mt7996/main.c
+index b6231dff..3c12bd52 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2365,6 +2365,9 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+
+ ctx->dev = NULL;
+
++ if (path->mtk_wdma.amsdu)
++ path->mtk_wdma.tid = mvif->qos_map[path->mtk_wdma.tid >> 2];
++
+ return 0;
+ }
+
+@@ -2794,6 +2797,33 @@ mt7996_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ }
+ }
+
++static int
++mt7996_set_qos_map(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct cfg80211_qos_map *qos_map)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ unsigned long valid_links = vif->valid_links ?: BIT(0);
++ unsigned int link_id;
++ int ret = 0;
++
++ mutex_lock(&dev->mt76.mutex);
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++
++ if (!mconf)
++ continue;
++
++ ret = mt7996_mcu_set_qos_map(dev, mconf, qos_map);
++ if(ret)
++ break;
++ }
++ mutex_unlock(&dev->mt76.mutex);
++
++ return ret;
++}
++
+ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -2861,4 +2891,5 @@ const struct ieee80211_ops mt7996_ops = {
+ .switch_vif_chanctx = mt7996_switch_vif_chanctx,
+ .change_vif_links = mt7996_change_vif_links,
+ .change_sta_links = mt7996_change_sta_links,
++ .set_qos_map = mt7996_set_qos_map,
+ };
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index db388e66..51f15928 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -6667,4 +6667,59 @@ int mt7996_mcu_set_csi(struct mt7996_phy *phy, u8 mode,
+ return -EINVAL;
+ }
+ }
++
++int mt7996_mcu_set_qos_map(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf,
++ struct cfg80211_qos_map *usr_qos_map)
++{
++ struct {
++ u8 bss_idx;
++ u8 qos_map_enable;
++ u8 __rsv[2];
++ s8 qos_map[IP_DSCP_NUM];
++ } __packed req = {
++ .bss_idx = mconf->mt76.idx,
++ .qos_map_enable = true,
++ };
++ s8 i;
++
++ /* Default QoS map, defined in section 2.3 of RFC8325.
++ * Three most significant bits of DSCP are used as UP.
++ */
++ for (i = 0; i < IP_DSCP_NUM; ++i)
++ req.qos_map[i] = i >> 3;
++
++ /* Recommended QoS map, defined in section 4 of RFC8325.
++ * Used in cfg80211_classify8021d since kernel v6.8.
++ */
++ req.qos_map[10] = req.qos_map[12] = req.qos_map[14] = req.qos_map[16] = 0;
++ req.qos_map[18] = req.qos_map[20] = req.qos_map[22] = 3;
++ req.qos_map[24] = 4;
++ req.qos_map[40] = 5;
++ req.qos_map[44] = req.qos_map[46] = 6;
++ req.qos_map[48] = 7;
++
++ /* User-defined QoS map */
++ if (usr_qos_map) {
++ for (i = 0; i < IEEE80211_NUM_UPS; ++i) {
++ u8 low = usr_qos_map->up[i].low;
++ u8 high = usr_qos_map->up[i].high;
++
++ if (low < IP_DSCP_NUM && high < IP_DSCP_NUM && low <= high)
++ memset(req.qos_map + low, i, high - low + 1);
++ }
++
++ for (i = 0; i < usr_qos_map->num_des; ++i) {
++ u8 dscp = usr_qos_map->dscp_exception[i].dscp;
++ u8 up = usr_qos_map->dscp_exception[i].up;
++
++ if (dscp < IP_DSCP_NUM && up < IEEE80211_NUM_UPS)
++ req.qos_map[dscp] = up;
++ }
++ }
++
++ memcpy(mconf->vif->qos_map, req.qos_map, IP_DSCP_NUM);
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WA_EXT_CMD(SET_QOS_MAP), &req,
++ sizeof(req), false);
++}
+ #endif
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index dc0209de..302ac7bf 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -134,6 +134,8 @@
+ #define MT7996_MAX_PROBE_TIMEOUT 500
+ #define MT7996_MAX_PROBE_TRIES 2
+
++#define IP_DSCP_NUM 64
++
+ struct mt7996_vif;
+ struct mt7996_sta;
+ struct mt7996_dfs_pulse;
+@@ -376,6 +378,9 @@ struct mt7996_vif {
+ void *probe[__MT_MAX_BAND];
+ unsigned long probe_send_time[__MT_MAX_BAND];
+ int probe_send_count[__MT_MAX_BAND];
++
++ /* QoS map support */
++ u8 qos_map[IP_DSCP_NUM];
+ };
+
+ /* crash-dump */
+@@ -1333,5 +1338,6 @@ int mt7996_mcu_mlo_agc(struct mt7996_dev *dev, const void *data, int len);
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ int mt7996_dma_rro_init(struct mt7996_dev *dev);
+ #endif /* CONFIG_NET_MEDIATEK_SOC_WED */
+-
++int mt7996_mcu_set_qos_map(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf,
++ struct cfg80211_qos_map *usr_qos_map);
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0151-mtk-mt76-mt7996-add-support-for-MLD-interface-to-sca.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0151-mtk-mt76-mt7996-add-support-for-MLD-interface-to-sca.patch
new file mode 100644
index 0000000..630fdb9
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0151-mtk-mt76-mt7996-add-support-for-MLD-interface-to-sca.patch
@@ -0,0 +1,144 @@
+From 8a5ed33fbb5d297d74acfc6cc75ee358501aed18 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Thu, 30 May 2024 15:26:34 +0800
+Subject: [PATCH 151/199] mtk: mt76: mt7996: add support for MLD interface to
+ scan
+
+Before queueing a HW scan work, mt7996_hw_scan() should make sure that
+there is mt7996_bss_conf on the scanning phy.
+
+For MLD interface scan, we first iterate all links to find the
+mt7996_bss_conf with target phy. A mt7996_bss_conf not being found
+implies the link is invalid, for which an AP interface should NOT scan
+while a STA interface should. Here we use the default link for STA scan,
+and delete it after the scan is completed.
+
+Note that AP's mt7996_bss_conf is added when the link is assigned to
+a chanctx, meaning that the operating channel is already determined.
+However, if the AP uses ACS to decide link's operating channel,
+hostapd adds the link in mac80211 and triggers a scan, while
+mt7996_bss_conf is not yet allocated. In such a case we also use the
+default link to scan, and delete it once the scan is finished.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/main.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 77 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 3c12bd52..a70fc4d3 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2375,10 +2375,24 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
+
+ void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted)
+ {
+- struct mt7996_vif *mvif = (struct mt7996_vif *)phy->scan_vif->drv_priv;
++ struct ieee80211_vif *vif = phy->scan_vif;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct cfg80211_scan_info info = {
+ .aborted = aborted,
+ };
++ int i;
++
++ if (ieee80211_vif_is_mld(vif)) {
++ struct mt7996_bss_conf *mconf;
++
++ for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
++ mconf = mconf_dereference_protected(mvif, i);
++
++ if (mconf && mconf->phy == phy && mconf == &mvif->deflink)
++ mt7996_remove_bss_conf(vif, &vif->bss_conf,
++ &mvif->deflink);
++ }
++ }
+
+ ieee80211_scan_completed(mvif->hw, &info);
+ phy->scan_chan = NULL;
+@@ -2394,6 +2408,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct cfg80211_scan_request *req = &hw_req->req;
+ struct mt7996_phy *phy = mt7996_band_phy(hw, req->channels[0]->band);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_bss_conf *mconf;
+ int ret;
+
+ mutex_lock(&phy->dev->mt76.mutex);
+@@ -2407,7 +2422,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ phy->scan_chan_idx = 0;
+
+ if (!ieee80211_vif_is_mld(vif)) {
+- struct mt7996_bss_conf *mconf = mconf_dereference_protected(mvif, 0);
++ mconf = mconf_dereference_protected(mvif, 0);
+
+ if (mconf && mconf->phy != phy) {
+ mt7996_remove_bss_conf(vif, &vif->bss_conf, &mvif->deflink);
+@@ -2421,6 +2436,66 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ return ret;
+ }
+ }
++ } else {
++ struct ieee80211_bss_conf *link_conf;
++ unsigned long valid_links = vif->valid_links;
++ unsigned int link_id;
++ bool found = false;
++
++ for_each_set_bit(link_id, &valid_links,
++ IEEE80211_MLD_MAX_NUM_LINKS) {
++ mconf = mconf_dereference_protected(mvif, link_id);
++ if (mconf && mconf->phy == phy) {
++ found = true;
++ break;
++ }
++
++ link_conf = link_conf_dereference_protected(vif, link_id);
++ if (link_conf && !mconf) {
++ /* The link is added in mac80211, but not yet
++ * initialized and assigned to a chanctx.
++ * Here we use the default link to perform scan.
++ */
++ memcpy(&vif->bss_conf, link_conf, sizeof(struct ieee80211_bss_conf));
++ ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
++ found = true;
++ break;
++ }
++ }
++
++ if (!found) {
++ if (vif->type != NL80211_IFTYPE_STATION) {
++ /* Only allowed STA MLD to scan full-band when
++ * there is no valid link on the band.
++ * (For example, when connecting by 2 links
++ * (2+5 GHz), an AP MLD is not allowed to scan
++ * full-band (2+5+6 GHz), while a STA MLD is.)
++ */
++ mutex_unlock(&phy->dev->mt76.mutex);
++ mt7996_scan_complete(phy, 0);
++ return 0;
++ }
++
++ /* Try to find an empty link, which is later used to scan. */
++ for (link_id = 0;
++ link_id < IEEE80211_MLD_MAX_NUM_LINKS;
++ link_id++) {
++ if (!rcu_access_pointer(mvif->link[link_id]))
++ break;
++ }
++
++ if (link_id == IEEE80211_MLD_MAX_NUM_LINKS) {
++ mutex_unlock(&phy->dev->mt76.mutex);
++ return -ENOLINK;
++ }
++
++ vif->bss_conf.link_id = link_id;
++ ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
++ if (ret) {
++ mutex_unlock(&phy->dev->mt76.mutex);
++ return ret;
++ }
++ }
+ }
+
+ set_bit(MT76_SCANNING, &phy->mt76->state);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0152-mtk-mt76-mt7996-add-per-link-txpower-config.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0152-mtk-mt76-mt7996-add-per-link-txpower-config.patch
new file mode 100644
index 0000000..7dc0c24
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0152-mtk-mt76-mt7996-add-per-link-txpower-config.patch
@@ -0,0 +1,35 @@
+From e2fe59ea3398bb2c2b00d2333aaa707aed44b37a Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Tue, 11 Jun 2024 17:04:00 +0800
+Subject: [PATCH 152/199] mtk: mt76: mt7996: add per-link txpower config
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7996/main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index a70fc4d3..19a1c7b3 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1016,7 +1016,7 @@ out:
+ }
+
+ int mt7996_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+- int *dbm)
++ unsigned int link_id, int *dbm)
+ {
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
+@@ -1025,7 +1025,7 @@ int mt7996_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ int delta;
+
+ mutex_lock(&dev->mt76.mutex);
+- mconf = mconf_dereference_protected(mvif, mvif->master_link_id);
++ mconf = mconf_dereference_protected(mvif, link_id);
+ if (!mconf || !mconf->phy) {
+ *dbm = 0;
+ goto out;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0153-mtk-mt76-mt7996-update-TX-RX-rates-via-MCU-command.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0153-mtk-mt76-mt7996-update-TX-RX-rates-via-MCU-command.patch
new file mode 100644
index 0000000..343129f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0153-mtk-mt76-mt7996-update-TX-RX-rates-via-MCU-command.patch
@@ -0,0 +1,414 @@
+From 06c0ba03cc9ed39bee42b10a1e22f9aceeb57ecd Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Fri, 7 Jun 2024 10:44:45 +0800
+Subject: [PATCH 153/199] mtk: mt76: mt7996: update TX/RX rates via MCU command
+
+Update TX/RX rates via MCU command to address following issues:
+1. TX rate was originally updated via TXS. However in MLO connection, WCID from TXS may not represent the actually used link.
+2. RX rate was originally updated via RXD. However, there is no RXD when HW path is taken.
+
+Original TX-rate update via TXS is removed.
+Still, RX-rate update via RXD is not removed, because mac80211 requires driver to provide such information for each received frame.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt76.h | 1 +
+ mt7996/mac.c | 117 ++++++----------------------------------
+ mt7996/main.c | 28 ++++------
+ mt7996/mcu.c | 146 +++++++++++++++++++++++++++++++++++++++++++++-----
+ 4 files changed, 161 insertions(+), 131 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index f544814e..a0fc8b1a 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -370,6 +370,7 @@ struct mt76_wcid {
+ int inactive_count;
+
+ struct rate_info rate;
++ struct rate_info rx_rate;
+ unsigned long ampdu_state;
+
+ u16 idx;
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 020203ec..484b679b 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1242,15 +1242,12 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+ int pid, __le32 *txs_data)
+ {
+ struct mt76_sta_stats *stats = &wcid->stats;
+- struct ieee80211_supported_band *sband;
+ struct mt76_dev *mdev = &dev->mt76;
+- struct mt76_phy *mphy;
+ struct ieee80211_tx_info *info;
+ struct sk_buff_head list;
+- struct rate_info rate = {};
+ struct sk_buff *skb = NULL;
+- bool cck = false;
+- u32 txrate, txs, mode, stbc;
++ u32 txrate, txs;
++ u8 mode, bw, mcs, nss;
+
+ txs = le32_to_cpu(txs_data[0]);
+
+@@ -1298,105 +1295,23 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+ }
+
+ txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
+-
+- rate.mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
+- rate.nss = FIELD_GET(MT_TX_RATE_NSS, txrate) + 1;
+- stbc = le32_get_bits(txs_data[3], MT_TXS3_RATE_STBC);
+-
+- if (stbc && rate.nss > 1)
+- rate.nss >>= 1;
+-
+- if (rate.nss - 1 < ARRAY_SIZE(stats->tx_nss))
+- stats->tx_nss[rate.nss - 1]++;
+- if (rate.mcs < ARRAY_SIZE(stats->tx_mcs))
+- stats->tx_mcs[rate.mcs]++;
++ bw = FIELD_GET(MT_TXS0_BW, txs);
+
+ mode = FIELD_GET(MT_TX_RATE_MODE, txrate);
+- switch (mode) {
+- case MT_PHY_TYPE_CCK:
+- cck = true;
+- fallthrough;
+- case MT_PHY_TYPE_OFDM:
+- mphy = mt76_dev_phy(mdev, wcid->phy_idx);
+-
+- if (mphy->chandef.chan->band == NL80211_BAND_5GHZ)
+- sband = &mphy->sband_5g.sband;
+- else if (mphy->chandef.chan->band == NL80211_BAND_6GHZ)
+- sband = &mphy->sband_6g.sband;
+- else
+- sband = &mphy->sband_2g.sband;
+-
+- rate.mcs = mt76_get_rate(mphy->dev, sband, rate.mcs, cck);
+- rate.legacy = sband->bitrates[rate.mcs].bitrate;
+- break;
+- case MT_PHY_TYPE_HT:
+- case MT_PHY_TYPE_HT_GF:
+- if (rate.mcs > 31)
+- goto out;
+-
+- rate.flags = RATE_INFO_FLAGS_MCS;
+- if (wcid->rate.flags & RATE_INFO_FLAGS_SHORT_GI)
+- rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
+- break;
+- case MT_PHY_TYPE_VHT:
+- if (rate.mcs > 9)
+- goto out;
+-
+- rate.flags = RATE_INFO_FLAGS_VHT_MCS;
+- if (wcid->rate.flags & RATE_INFO_FLAGS_SHORT_GI)
+- rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
+- break;
+- case MT_PHY_TYPE_HE_SU:
+- case MT_PHY_TYPE_HE_EXT_SU:
+- case MT_PHY_TYPE_HE_TB:
+- case MT_PHY_TYPE_HE_MU:
+- if (rate.mcs > 11)
+- goto out;
+-
+- rate.he_gi = wcid->rate.he_gi;
+- rate.he_dcm = FIELD_GET(MT_TX_RATE_DCM, txrate);
+- rate.flags = RATE_INFO_FLAGS_HE_MCS;
+- break;
+- case MT_PHY_TYPE_EHT_SU:
+- case MT_PHY_TYPE_EHT_TRIG:
+- case MT_PHY_TYPE_EHT_MU:
+- if (rate.mcs > 13)
+- goto out;
+-
+- rate.eht_gi = wcid->rate.eht_gi;
+- rate.flags = RATE_INFO_FLAGS_EHT_MCS;
+- break;
+- default:
+- goto out;
+- }
+-
+- stats->tx_mode[mode]++;
++ mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
++ nss = FIELD_GET(MT_TX_RATE_NSS, txrate) + 1;
++ if (le32_get_bits(txs_data[3], MT_TXS3_RATE_STBC) && nss > 1)
++ nss >>= 1;
++
++ if (nss - 1 < ARRAY_SIZE(stats->tx_nss))
++ stats->tx_nss[nss - 1]++;
++ if (mcs < ARRAY_SIZE(stats->tx_mcs))
++ stats->tx_mcs[mcs]++;
++ if (mode < ARRAY_SIZE(stats->tx_mode))
++ stats->tx_mode[mode]++;
++ if (bw < ARRAY_SIZE(stats->tx_bw))
++ stats->tx_bw[bw]++;
+
+- switch (FIELD_GET(MT_TXS0_BW, txs)) {
+- case IEEE80211_STA_RX_BW_320:
+- rate.bw = RATE_INFO_BW_320;
+- stats->tx_bw[4]++;
+- break;
+- case IEEE80211_STA_RX_BW_160:
+- rate.bw = RATE_INFO_BW_160;
+- stats->tx_bw[3]++;
+- break;
+- case IEEE80211_STA_RX_BW_80:
+- rate.bw = RATE_INFO_BW_80;
+- stats->tx_bw[2]++;
+- break;
+- case IEEE80211_STA_RX_BW_40:
+- rate.bw = RATE_INFO_BW_40;
+- stats->tx_bw[1]++;
+- break;
+- default:
+- rate.bw = RATE_INFO_BW_20;
+- stats->tx_bw[0]++;
+- break;
+- }
+- wcid->rate = rate;
+-
+-out:
+ if (skb)
+ mt76_tx_status_skb_done(mdev, skb, &list);
+ mt76_tx_status_unlock(mdev, &list);
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 19a1c7b3..fa60b889 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1765,32 +1765,24 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_link_sta *mlink;
+- struct rate_info *txrate;
++ struct rate_info *rate;
+
+- /* TODO: support per-link rate report */
+ mutex_lock(&dev->mt76.mutex);
+ mlink = mlink_dereference_protected(msta, msta->pri_link);
+ if (!mlink)
+ goto out;
+
+- txrate = &mlink->wcid.rate;
+- if (txrate->legacy || txrate->flags) {
+- if (txrate->legacy) {
+- sinfo->txrate.legacy = txrate->legacy;
+- } else {
+- sinfo->txrate.mcs = txrate->mcs;
+- sinfo->txrate.nss = txrate->nss;
+- sinfo->txrate.bw = txrate->bw;
+- sinfo->txrate.he_gi = txrate->he_gi;
+- sinfo->txrate.he_dcm = txrate->he_dcm;
+- sinfo->txrate.he_ru_alloc = txrate->he_ru_alloc;
+- sinfo->txrate.eht_gi = txrate->eht_gi;
+- }
+- sinfo->txrate.flags = txrate->flags;
++ rate = &mlink->wcid.rate;
++ if (rate->legacy || rate->flags) {
++ sinfo->txrate = *rate;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
+ }
+- sinfo->txrate.flags = txrate->flags;
+- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
++
++ rate = &mlink->wcid.rx_rate;
++ if (rate->legacy || rate->flags) {
++ sinfo->rxrate = *rate;
++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE);
++ }
+
+ sinfo->tx_failed = mlink->wcid.stats.tx_failed;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 51f15928..8fd9d450 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -532,42 +532,164 @@ mt7996_mcu_ie_countdown(struct mt7996_dev *dev, struct sk_buff *skb)
+ }
+
+ static int
+-mt7996_mcu_update_tx_gi(struct rate_info *rate, struct all_sta_trx_rate *mcu_rate)
++mt7996_mcu_update_rate(struct rate_info *rate, struct ieee80211_supported_band *sband,
++ u8 mode, u8 bw, u8 mcs, u8 nss, u8 stbc, u8 gi)
+ {
+- switch (mcu_rate->tx_mode) {
++ struct rate_info tmp_rate = {};
++
++ tmp_rate.mcs = mcs;
++ tmp_rate.nss = (stbc && nss > 1) ? nss / 2 : nss;
++
++ switch (mode) {
+ case MT_PHY_TYPE_CCK:
+ case MT_PHY_TYPE_OFDM:
++ if (mcs >= sband->n_bitrates)
++ return -EINVAL;
++
++ tmp_rate.legacy = sband->bitrates[mcs].bitrate;
+ break;
+ case MT_PHY_TYPE_HT:
+ case MT_PHY_TYPE_HT_GF:
++ if (mcs > 31)
++ return -EINVAL;
++
++ tmp_rate.flags |= RATE_INFO_FLAGS_MCS;
++ if (gi)
++ tmp_rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
++ break;
+ case MT_PHY_TYPE_VHT:
+- if (mcu_rate->tx_gi)
+- rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
+- else
+- rate->flags &= ~RATE_INFO_FLAGS_SHORT_GI;
++ if (mcs > 9)
++ return -EINVAL;
++
++ tmp_rate.flags |= RATE_INFO_FLAGS_VHT_MCS;
++ if (gi)
++ tmp_rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
+ break;
+ case MT_PHY_TYPE_HE_SU:
+ case MT_PHY_TYPE_HE_EXT_SU:
+ case MT_PHY_TYPE_HE_TB:
+ case MT_PHY_TYPE_HE_MU:
+- if (mcu_rate->tx_gi > NL80211_RATE_INFO_HE_GI_3_2)
++ tmp_rate.mcs = mcs & GENMASK(3, 0);
++ if (tmp_rate.mcs > 11 || gi > NL80211_RATE_INFO_HE_GI_3_2)
+ return -EINVAL;
+- rate->he_gi = mcu_rate->tx_gi;
++
++ tmp_rate.flags |= RATE_INFO_FLAGS_HE_MCS;
++ tmp_rate.he_gi = gi;
++ tmp_rate.he_dcm = mcs & MT_PRXV_TX_DCM;
+ break;
+ case MT_PHY_TYPE_EHT_SU:
+ case MT_PHY_TYPE_EHT_TRIG:
+ case MT_PHY_TYPE_EHT_MU:
+- if (mcu_rate->tx_gi > NL80211_RATE_INFO_EHT_GI_3_2)
++ tmp_rate.mcs = mcs & GENMASK(3, 0);
++ if (tmp_rate.mcs > 13 || gi > NL80211_RATE_INFO_EHT_GI_3_2)
+ return -EINVAL;
+- rate->eht_gi = mcu_rate->tx_gi;
++
++ tmp_rate.flags |= RATE_INFO_FLAGS_EHT_MCS;
++ tmp_rate.eht_gi = gi;
+ break;
+ default:
+ return -EINVAL;
+ }
+
++ switch (bw) {
++ case IEEE80211_STA_RX_BW_20:
++ tmp_rate.bw = RATE_INFO_BW_20;
++ break;
++ case IEEE80211_STA_RX_BW_40:
++ tmp_rate.bw = RATE_INFO_BW_40;
++ break;
++ case IEEE80211_STA_RX_BW_80:
++ tmp_rate.bw = RATE_INFO_BW_80;
++ break;
++ case IEEE80211_STA_RX_BW_160:
++ tmp_rate.bw = RATE_INFO_BW_160;
++ break;
++ case IEEE80211_STA_RX_BW_320:
++ tmp_rate.bw = RATE_INFO_BW_320;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ if (mode == MT_PHY_TYPE_HE_EXT_SU && mcs & MT_PRXV_TX_ER_SU_106T) {
++ tmp_rate.bw = RATE_INFO_BW_HE_RU;
++ tmp_rate.he_ru_alloc = NL80211_RATE_INFO_HE_RU_ALLOC_106;
++ }
++ *rate = tmp_rate;
++
+ return 0;
+ }
+
++static int
++mt7996_mcu_update_trx_rates(struct mt76_wcid *wcid, struct all_sta_trx_rate *mcu_rate)
++{
++ struct mt7996_link_sta *mlink = container_of(wcid, struct mt7996_link_sta, wcid);
++ struct mt76_dev *dev = &mlink->sta->vif->dev->mt76;
++ struct mt76_phy *phy = mt76_dev_phy(dev, wcid->phy_idx);
++ struct ieee80211_supported_band *sband = NULL;
++ bool cck;
++ int ret;
++
++ /* TX rate */
++ cck = false;
++
++ switch (mcu_rate->tx_mode) {
++ case MT_PHY_TYPE_CCK:
++ cck = true;
++ fallthrough;
++ case MT_PHY_TYPE_OFDM:
++ if (phy->chandef.chan->band == NL80211_BAND_2GHZ) {
++ sband = &phy->sband_2g.sband;
++ if (!cck)
++ mcu_rate->tx_mcs += 4;
++ } else if (phy->chandef.chan->band == NL80211_BAND_5GHZ)
++ sband = &phy->sband_5g.sband;
++ else
++ sband = &phy->sband_6g.sband;
++ break;
++ case MT_PHY_TYPE_HT:
++ case MT_PHY_TYPE_HT_GF:
++ mcu_rate->tx_mcs += ((mcu_rate->tx_nss - 1) << 3);
++ break;
++ default:
++ break;
++ }
++
++ ret = mt7996_mcu_update_rate(&wcid->rate, sband, mcu_rate->tx_mode,
++ mcu_rate->tx_bw, mcu_rate->tx_mcs,
++ mcu_rate->tx_nss, mcu_rate->tx_stbc,
++ mcu_rate->tx_gi);
++ if (ret)
++ return ret;
++
++ /* RX rate */
++ cck = false;
++
++ switch (mcu_rate->rx_mode) {
++ case MT_PHY_TYPE_CCK:
++ cck = true;
++ fallthrough;
++ case MT_PHY_TYPE_OFDM:
++ if (phy->chandef.chan->band == NL80211_BAND_2GHZ)
++ sband = &phy->sband_2g.sband;
++ else if (phy->chandef.chan->band == NL80211_BAND_5GHZ)
++ sband = &phy->sband_5g.sband;
++ else
++ sband = &phy->sband_6g.sband;
++
++ mcu_rate->rx_rate = mt76_get_rate(dev, sband, mcu_rate->rx_rate, cck);
++ break;
++ default:
++ break;
++ }
++
++ ret = mt7996_mcu_update_rate(&wcid->rx_rate, sband, mcu_rate->rx_mode,
++ mcu_rate->rx_bw, mcu_rate->rx_rate,
++ mcu_rate->rx_nsts + 1, mcu_rate->rx_stbc,
++ mcu_rate->rx_gi);
++ return ret;
++}
++
+ static inline void __mt7996_stat_to_netdev(struct mt76_phy *mphy,
+ struct mt76_wcid *wcid,
+ u32 tx_bytes, u32 rx_bytes,
+@@ -618,8 +740,8 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ if (!wcid)
+ break;
+
+- if (mt7996_mcu_update_tx_gi(&wcid->rate, &res->rate[i]))
+- dev_err(dev->mt76.dev, "Failed to update TX GI\n");
++ if (mt7996_mcu_update_trx_rates(wcid, &res->rate[i]))
++ dev_err(dev->mt76.dev, "Failed to update TX/RX rates.\n");
+ break;
+ case UNI_ALL_STA_TXRX_ADM_STAT:
+ wlan_idx = le16_to_cpu(res->adm_stat[i].wlan_idx);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0154-mtk-mt76-mt7996-add-link-information-when-dump-stati.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0154-mtk-mt76-mt7996-add-link-information-when-dump-stati.patch
new file mode 100644
index 0000000..057f0c4
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0154-mtk-mt76-mt7996-add-link-information-when-dump-stati.patch
@@ -0,0 +1,119 @@
+From 4eda4a37c2d5fee71c5f7b4d4a3b5baa57252c14 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Tue, 11 Jun 2024 18:09:57 +0800
+Subject: [PATCH 154/199] mtk: mt76: mt7996: add link information when dump
+ station
+
+Report following per-link information to mac80211:
+- RSSI
+- RX rate
+- TX/RX byte counts
+- TX MPDU failed/retried counts
+- TX/RX airtime
+- per-link per-antenna average data-frame RSSI to mac80211.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/main.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 78 insertions(+)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index fa60b889..8c162987 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1813,6 +1813,83 @@ out:
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
++static void mt7996_sta_link_statistics(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta,
++ unsigned int link_id,
++ struct station_link_info *linfo)
++{
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_link_sta *mlink;
++ struct mt7996_bss_conf *mconf;
++ struct mt76_sta_stats *stats;
++ int i;
++
++ mutex_lock(&dev->mt76.mutex);
++ mlink = mlink_dereference_protected(msta, link_id);
++ if (!mlink)
++ goto out;
++ stats = &mlink->wcid.stats;
++
++ mconf = mconf_dereference_protected(mvif, link_id);
++ if (!mconf)
++ goto out;
++
++ linfo->signal = (s8)mlink->signal;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
++
++ linfo->chains = mconf->phy->mt76->antenna_mask;
++ memcpy(linfo->chain_signal, mlink->chain_signal, IEEE80211_MAX_CHAINS);
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
++
++ linfo->signal_avg = -(s8)ewma_avg_signal_read(&mlink->signal_avg);
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG);
++
++ for (i = 0; i < IEEE80211_MAX_CHAINS; ++i)
++ linfo->chain_signal_avg[i] = -(s8)ewma_avg_signal_read(mlink->chain_signal_avg + i);
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG);
++
++ linfo->ack_signal = (s8)mlink->ack_signal;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
++
++ linfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&mlink->avg_ack_signal);
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
++
++ linfo->txrate = mlink->wcid.rate;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
++
++ linfo->rxrate = mlink->wcid.rx_rate;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE);
++
++ linfo->tx_bytes = stats->tx_bytes;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64);
++
++ linfo->rx_bytes = stats->rx_bytes;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64);
++
++ linfo->tx_failed = stats->tx_failed;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
++
++ linfo->tx_retries = stats->tx_retries;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
++
++ linfo->rx_mpdu_count = stats->rx_mpdus;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_MPDUS);
++
++ linfo->fcs_err_count = stats->rx_fcs_err;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_FCS_ERROR_COUNT);
++
++ linfo->tx_duration = stats->tx_airtime;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION);
++
++ linfo->rx_duration = stats->rx_airtime;
++ linfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION);
++out:
++ mutex_unlock(&dev->mt76.mutex);
++}
++
+ static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta)
+ {
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+@@ -2932,6 +3009,7 @@ const struct ieee80211_ops mt7996_ops = {
+ .set_bitrate_mask = mt7996_set_bitrate_mask,
+ .set_coverage_class = mt7996_set_coverage_class,
+ .sta_statistics = mt7996_sta_statistics,
++ .sta_link_statistics = mt7996_sta_link_statistics,
+ .sta_set_4addr = mt7996_sta_set_4addr,
+ .sta_set_decap_offload = mt7996_sta_set_decap_offload,
+ .add_twt_setup = mt7996_mac_add_twt_setup,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0155-mtk-mt76-mt7996-add-per-link-RX-MPDU-statistics.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0155-mtk-mt76-mt7996-add-per-link-RX-MPDU-statistics.patch
new file mode 100644
index 0000000..e35f69e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0155-mtk-mt76-mt7996-add-per-link-RX-MPDU-statistics.patch
@@ -0,0 +1,96 @@
+From c7dcf0304c6cd1d73b1caf2ce0b35f7913d2b69e Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Tue, 23 Jul 2024 16:37:57 +0800
+Subject: [PATCH 155/199] mtk: mt76: mt7996: add per-link RX MPDU statistics
+
+Add per-link RX MPDU total/failed counts.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt76.h | 2 ++
+ mt76_connac_mcu.h | 2 ++
+ mt7996/mac.c | 1 +
+ mt7996/mcu.c | 10 ++++++++++
+ mt7996/mcu.h | 7 +++++++
+ 5 files changed, 22 insertions(+)
+
+diff --git a/mt76.h b/mt76.h
+index a0fc8b1a..f67f0658 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -336,6 +336,8 @@ struct mt76_sta_stats {
+ /* WED RX */
+ u64 rx_bytes;
+ u32 rx_packets;
++ u32 rx_mpdus;
++ u32 rx_fcs_err;
+ u32 rx_errors;
+ u32 rx_drops;
+ u64 rx_airtime;
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 0244b5aa..8de91f62 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1421,6 +1421,8 @@ enum UNI_ALL_STA_INFO_TAG {
+ UNI_ALL_STA_DATA_TX_RETRY_COUNT,
+ UNI_ALL_STA_GI_MODE,
+ UNI_ALL_STA_TXRX_MSDU_COUNT,
++ UNI_ALL_STA_TXOP_ACCESS_DELAY,
++ UNI_ALL_STA_RX_MPDU_COUNT,
+ UNI_ALL_STA_MAX_NUM
+ };
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 484b679b..a0406700 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2408,6 +2408,7 @@ void mt7996_mac_work(struct work_struct *work)
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
+ // }
++ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_RX_MPDU_COUNT);
+
+ if (mt7996_mcu_wa_cmd(phy->dev, MCU_WA_PARAM_CMD(QUERY), MCU_WA_PARAM_BSS_ACQ_PKT_CNT,
+ BSS_ACQ_PKT_CNT_BSS_BITMAP_ALL | BSS_ACQ_PKT_CNT_READ_CLR, 0))
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 8fd9d450..be6b985f 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -803,6 +803,16 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ tx_airtime, rx_airtime);
+ }
+ break;
++ case UNI_ALL_STA_RX_MPDU_COUNT:
++ wlan_idx = le16_to_cpu(res->rx_mpdu_cnt[i].wlan_idx);
++ wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
++ if (!wcid)
++ break;
++
++ wcid->stats.rx_mpdus += le32_to_cpu(res->rx_mpdu_cnt[i].total);
++ wcid->stats.rx_fcs_err += le32_to_cpu(res->rx_mpdu_cnt[i].total) -
++ le32_to_cpu(res->rx_mpdu_cnt[i].success);
++ break;
+ default:
+ break;
+ }
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 389aab63..737f426d 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -268,6 +268,13 @@ struct mt7996_mcu_all_sta_info_event {
+ __le32 tx[IEEE80211_NUM_ACS];
+ __le32 rx[IEEE80211_NUM_ACS];
+ } __packed, airtime);
++
++ DECLARE_FLEX_ARRAY(struct {
++ __le16 wlan_idx;
++ u8 rsv[2];
++ __le32 total;
++ __le32 success;
++ } __packed, rx_mpdu_cnt);
+ } __packed;
+ } __packed;
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0156-mtk-mt76-mt7996-support-link_id-for-mt7996_set_bitra.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0156-mtk-mt76-mt7996-support-link_id-for-mt7996_set_bitra.patch
new file mode 100644
index 0000000..476fb7b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0156-mtk-mt76-mt7996-support-link_id-for-mt7996_set_bitra.patch
@@ -0,0 +1,120 @@
+From c310822a0a28c43c4bf4234e76d82e4d1fb47a96 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 7 Jun 2024 13:23:55 +0800
+Subject: [PATCH 156/199] mtk: mt76: mt7996: support link_id for
+ mt7996_set_bitrate_mask
+
+Add support new argument link_id for set_bitrate_mask within
+ieee80211_ops.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/main.c | 34 ++++++++++++++++++++++++++--------
+ mt7996/mt7996.h | 5 +++++
+ 2 files changed, 31 insertions(+), 8 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 8c162987..71a42199 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1895,17 +1895,21 @@ static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta)
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_link_sta *mlink;
+ struct mt7996_dev *dev = msta->vif->dev;
+- u32 *changed = data;
++ struct mt7996_sta_rc_work_data *wd = data;
+
+ rcu_read_lock();
+- mlink = rcu_dereference(msta->link[msta->pri_link]);
++ mlink = rcu_dereference(msta->link[wd->link_id]);
++
++ if (!mlink)
++ goto unlock;
+
+ spin_lock_bh(&dev->mt76.sta_poll_lock);
+- mlink->changed |= *changed;
++ mlink->changed |= wd->changed;
+ if (list_empty(&mlink->rc_list))
+ list_add_tail(&mlink->rc_list, &dev->sta_rc_list);
+ spin_unlock_bh(&dev->mt76.sta_poll_lock);
+
++unlock:
+ rcu_read_unlock();
+ }
+
+@@ -1917,6 +1921,10 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_dev *dev = phy->dev;
++ struct mt7996_sta_rc_work_data data = {
++ .link_id = msta->pri_link,
++ .changed = changed,
++ };
+
+ if (!msta->vif) {
+ dev_warn(dev->mt76.dev, "Un-initialized STA %pM wcid %d in rc_work\n",
+@@ -1924,22 +1932,32 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
+ return;
+ }
+
+- mt7996_sta_rc_work(&changed, sta);
++ mt7996_sta_rc_work(&data, sta);
+ ieee80211_queue_work(hw, &dev->rc_work);
+ }
+
+ static int
+ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+- const struct cfg80211_bitrate_mask *mask)
++ const struct cfg80211_bitrate_mask *mask,
++ unsigned int link_id)
+ {
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_dev *dev = phy->dev;
+ struct mt7996_bss_conf *mconf;
+- u32 changed = IEEE80211_RC_SUPP_RATES_CHANGED;
++ struct mt7996_sta_rc_work_data data = {
++ .link_id = link_id,
++ .changed = IEEE80211_RC_SUPP_RATES_CHANGED,
++ };
+
+ mutex_lock(&dev->mt76.mutex);
+- mconf = mconf_dereference_protected(mvif, mvif->master_link_id);
++ mconf = mconf_dereference_protected(mvif, link_id);
++
++ if (!mconf) {
++ mutex_unlock(&dev->mt76.mutex);
++ return -EINVAL;
++ }
++
+ mconf->bitrate_mask = *mask;
+ mutex_unlock(&dev->mt76.mutex);
+
+@@ -1951,7 +1969,7 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ * - multiple rates: if it's not in range format i.e 0-{7,8,9} for VHT
+ * then multiple MCS setting (MCS 4,5,6) is not supported.
+ */
+- ieee80211_iterate_stations_atomic(hw, mt7996_sta_rc_work, &changed);
++ ieee80211_iterate_stations_atomic(hw, mt7996_sta_rc_work, &data);
+ ieee80211_queue_work(hw, &dev->rc_work);
+
+ return 0;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 302ac7bf..49789441 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -444,6 +444,11 @@ struct mt7996_wed_rro_session_id {
+ u16 id;
+ };
+
++struct mt7996_sta_rc_work_data {
++ unsigned int link_id;
++ u32 changed;
++};
++
+ #ifdef CONFIG_MTK_VENDOR
+ #define MT7996_AIR_MONITOR_MAX_ENTRY 16
+ #define MT7996_AIR_MONITOR_MAX_GROUP (MT7996_AIR_MONITOR_MAX_ENTRY >> 1)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0157-mtk-mt76-mt7996-add-per-radio-antenna-config.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0157-mtk-mt76-mt7996-add-per-radio-antenna-config.patch
new file mode 100644
index 0000000..5e3b87a
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0157-mtk-mt76-mt7996-add-per-radio-antenna-config.patch
@@ -0,0 +1,254 @@
+From 467122289f7c31285d68ae819f22a8bf7b2272ae Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Tue, 11 Jun 2024 17:04:22 +0800
+Subject: [PATCH 157/199] mtk: mt76: mt7996: add per-radio antenna config
+
+Add per-radio antenna config
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mac80211.c | 19 ++++++++++++++++---
+ mt76.h | 3 ++-
+ mt7996/eeprom.c | 3 +++
+ mt7996/init.c | 26 ++++++++++++++------------
+ mt7996/main.c | 15 ++++++---------
+ mt7996/mcu.c | 3 ++-
+ mt7996/mt7996.h | 7 ++++---
+ 7 files changed, 47 insertions(+), 29 deletions(-)
+
+diff --git a/mac80211.c b/mac80211.c
+index 589c37af..10267019 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -431,8 +431,8 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw)
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AQL);
+
+- wiphy->available_antennas_tx = phy->antenna_mask;
+- wiphy->available_antennas_rx = phy->antenna_mask;
++ wiphy->available_antennas_tx[phy->cur_band] = phy->antenna_mask;
++ wiphy->available_antennas_rx[phy->cur_band] = phy->antenna_mask;
+
+ wiphy->sar_capa = &mt76_sar_capa;
+ phy->frp = devm_kcalloc(dev->dev, wiphy->sar_capa->num_freq_ranges,
+@@ -1710,12 +1710,25 @@ void mt76_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+ }
+ EXPORT_SYMBOL_GPL(mt76_sw_scan_complete);
+
+-int mt76_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
++int mt76_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant, int band)
+ {
+ struct mt76_phy *phy = hw->priv;
+ struct mt76_dev *dev = phy->dev;
++ int band_idx;
+
+ mutex_lock(&dev->mutex);
++ phy = NULL;
++ for (band_idx = 0; band_idx < __MT_MAX_BAND; band_idx++)
++ if (dev->phys[band_idx] && dev->phys[band_idx]->cur_band == band) {
++ phy = dev->phys[band_idx];
++ break;
++ }
++
++ if (!phy) {
++ mutex_unlock(&dev->mutex);
++ return -EINVAL;
++ }
++
+ *tx_ant = phy->antenna_mask;
+ *rx_ant = phy->antenna_mask;
+ mutex_unlock(&dev->mutex);
+diff --git a/mt76.h b/mt76.h
+index f67f0658..728740ef 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -862,6 +862,7 @@ struct mt76_phy {
+ struct mt76_sband sband_2g;
+ struct mt76_sband sband_5g;
+ struct mt76_sband sband_6g;
++ enum nl80211_band cur_band;
+
+ u8 macaddr[ETH_ALEN];
+
+@@ -1540,7 +1541,7 @@ int mt76_get_sar_power(struct mt76_phy *phy,
+ void mt76_csa_check(struct mt76_dev *dev);
+ void mt76_csa_finish(struct mt76_dev *dev);
+
+-int mt76_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
++int mt76_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant, int band);
+ int mt76_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set);
+ void mt76_insert_ccmp_hdr(struct sk_buff *skb, u8 key_id);
+ int mt76_get_rate(struct mt76_dev *dev,
+diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
+index c4714982..e8e1d85a 100644
+--- a/mt7996/eeprom.c
++++ b/mt7996/eeprom.c
+@@ -378,12 +378,15 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
+ switch (val) {
+ case MT_EE_BAND_SEL_2GHZ:
+ phy->mt76->cap.has_2ghz = true;
++ phy->mt76->cur_band = NL80211_BAND_2GHZ;
+ break;
+ case MT_EE_BAND_SEL_5GHZ:
+ phy->mt76->cap.has_5ghz = true;
++ phy->mt76->cur_band = NL80211_BAND_5GHZ;
+ break;
+ case MT_EE_BAND_SEL_6GHZ:
+ phy->mt76->cap.has_6ghz = true;
++ phy->mt76->cur_band = NL80211_BAND_6GHZ;
+ break;
+ default:
+ ret = -EINVAL;
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 0ee2acfb..55eb32cb 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -392,8 +392,10 @@ static void
+ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+ {
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
++ struct mt76_phy *mphy = phy->mt76;
+ struct mt76_dev *mdev = &phy->dev->mt76;
+ struct wiphy *wiphy = hw->wiphy;
++ struct wiphy *single_wiphy = mdev->phy.hw->wiphy;
+ u16 max_subframes = phy->dev->has_eht ? IEEE80211_MAX_AMPDU_BUF_EHT :
+ IEEE80211_MAX_AMPDU_BUF_HE;
+
+@@ -455,25 +457,25 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+
+ hw->max_tx_fragments = 4;
+
+- if (phy->mt76->cap.has_2ghz) {
+- phy->mt76->sband_2g.sband.ht_cap.cap |=
++ if (mphy->cap.has_2ghz) {
++ mphy->sband_2g.sband.ht_cap.cap |=
+ IEEE80211_HT_CAP_LDPC_CODING |
+ IEEE80211_HT_CAP_MAX_AMSDU;
+- phy->mt76->sband_2g.sband.ht_cap.ampdu_density =
++ mphy->sband_2g.sband.ht_cap.ampdu_density =
+ IEEE80211_HT_MPDU_DENSITY_2;
+ }
+
+- if (phy->mt76->cap.has_5ghz) {
+- phy->mt76->sband_5g.sband.ht_cap.cap |=
++ if (mphy->cap.has_5ghz) {
++ mphy->sband_5g.sband.ht_cap.cap |=
+ IEEE80211_HT_CAP_LDPC_CODING |
+ IEEE80211_HT_CAP_MAX_AMSDU;
+
+- phy->mt76->sband_5g.sband.vht_cap.cap |=
++ mphy->sband_5g.sband.vht_cap.cap |=
+ IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
+ IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
+ IEEE80211_VHT_CAP_SHORT_GI_160 |
+ IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
+- phy->mt76->sband_5g.sband.ht_cap.ampdu_density =
++ mphy->sband_5g.sband.ht_cap.ampdu_density =
+ IEEE80211_HT_MPDU_DENSITY_1;
+
+ ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
+@@ -481,17 +483,17 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+
+ /* init led callbacks */
+ if (IS_ENABLED(CONFIG_MT76_LEDS)) {
+- phy->mt76->leds.cdev.brightness_set = mt7996_led_set_brightness;
+- phy->mt76->leds.cdev.blink_set = mt7996_led_set_blink;
++ mphy->leds.cdev.brightness_set = mt7996_led_set_brightness;
++ mphy->leds.cdev.blink_set = mt7996_led_set_blink;
+ }
+
+- mt76_set_stream_caps(phy->mt76, true);
++ mt76_set_stream_caps(mphy, true);
+ mt7996_set_stream_vht_txbf_caps(phy);
+ mt7996_set_stream_he_eht_caps(phy);
+ mt7996_init_txpower(phy);
+
+- wiphy->available_antennas_rx = phy->mt76->antenna_mask;
+- wiphy->available_antennas_tx = phy->mt76->antenna_mask;
++ single_wiphy->available_antennas_rx[mphy->cur_band] = mphy->antenna_mask;
++ single_wiphy->available_antennas_tx[mphy->cur_band] = mphy->antenna_mask;
+
+ wiphy->max_scan_ssids = 4;
+ wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 71a42199..b59f72d0 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1701,14 +1701,11 @@ mt7996_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
+ }
+
+ static int
+-mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
++mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant, int band)
+ {
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+- int band, max_nss = hweight8(hw->wiphy->available_antennas_tx);
+-
+- /* TODO: set antenna based on capability of each band. */
+- dev_warn(dev->mt76.dev, "%s: temporarily not supported.\n", __func__);
+- return 0;
++ int max_nss = hweight8(hw->wiphy->available_antennas_tx[band]);
++ enum nl80211_band bandid;
+
+ /* only allow settings from hw0 */
+ if (hw != dev->phy.mt76->hw)
+@@ -1722,14 +1719,14 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+
+ mutex_lock(&dev->mt76.mutex);
+
+- for (band = 0; band < NUM_NL80211_BANDS; band++) {
++ for (bandid = 0; bandid < NUM_NL80211_BANDS; bandid++) {
+ struct mt7996_phy *phy;
+ u8 band_idx, shift;
+
+- if (!hw->wiphy->bands[band])
++ if (band != bandid || !hw->wiphy->bands[bandid])
+ continue;
+
+- phy = mt7996_band_phy(hw, band);
++ phy = mt7996_band_phy(hw, bandid);
+ if (!phy)
+ continue;
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index be6b985f..6af45467 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -2430,6 +2430,7 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+ #define EBF_MODE BIT(0)
+ #define IBF_MODE BIT(1)
+ struct mt7996_phy *phy = mconf->phy;
++ struct wiphy *wiphy = phy->mt76->hw->wiphy;
+ int tx_ant = hweight16(phy->mt76->chainmask) - 1;
+ struct sta_rec_bf *bf;
+ struct tlv *tlv;
+@@ -2468,7 +2469,7 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+
+ bf->bf_cap = ebf ? EBF_MODE : (dev->ibf ? IBF_MODE : 0);
+ if (is_mt7992(&dev->mt76) &&
+- tx_ant == hweight8(phy->mt76->hw->wiphy->available_antennas_tx))
++ tx_ant == hweight8(wiphy->available_antennas_tx[phy->mt76->cur_band]))
+ bf->bf_cap |= IBF_MODE;
+ bf->bw = link_sta->bandwidth;
+ bf->ibf_dbw = link_sta->bandwidth;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 49789441..05bdc437 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1173,9 +1173,10 @@ void mt7996_memcpy_fromio(struct mt7996_dev *dev, void *buf, u32 offset,
+
+ static inline u16 mt7996_rx_chainmask(struct mt7996_phy *phy)
+ {
+- int max_nss = hweight8(phy->mt76->hw->wiphy->available_antennas_tx);
+- int cur_nss = hweight8(phy->mt76->antenna_mask);
+- u16 tx_chainmask = phy->mt76->chainmask;
++ struct mt76_phy *mphy = phy->mt76;
++ int cur_nss = hweight8(mphy->antenna_mask);
++ int max_nss = hweight8(mphy->hw->wiphy->available_antennas_rx[mphy->cur_band]);
++ u16 tx_chainmask = mphy->chainmask;
+
+ if (cur_nss != max_nss)
+ return tx_chainmask;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0158-mtk-mt76-mt7996-rework-debug-prints.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0158-mtk-mt76-mt7996-rework-debug-prints.patch
new file mode 100644
index 0000000..8ed1049
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0158-mtk-mt76-mt7996-rework-debug-prints.patch
@@ -0,0 +1,375 @@
+From 4a9819d5ac8cef5b85c089698467053713619f86 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 19 Jun 2024 12:04:46 +0800
+Subject: [PATCH 158/199] mtk: mt76: mt7996: rework debug prints
+
+Trim debug messages, and move some of them (especially mcu cmd) into
+tracing log.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt76_connac_mcu.c | 1 -
+ mt7996/mac.c | 3 ---
+ mt7996/main.c | 66 ++++++++++++++++++++++++++++-------------------
+ mt7996/mcu.c | 36 +++++++++++++-------------
+ mt7996/mt7996.h | 10 ++++++-
+ 5 files changed, 67 insertions(+), 49 deletions(-)
+
+diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
+index 8d1036e1..ab7cf4a6 100644
+--- a/mt76_connac_mcu.c
++++ b/mt76_connac_mcu.c
+@@ -432,7 +432,6 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
+ }
+
+ memcpy(basic->peer_addr, link_sta->addr, ETH_ALEN);
+- pr_info("%s: link %u addr [%pM]\n", __func__, link_sta->link_id, basic->peer_addr);
+ basic->qos = link_sta->sta->wme;
+ }
+ EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv);
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index a0406700..960b02dd 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2930,9 +2930,6 @@ void mt7996_scan_work(struct work_struct *work)
+ return;
+ }
+
+- wiphy_info(hw->wiphy, "hw scan %d MHz\n",
+- req->channels[phy->scan_chan_idx]->center_freq);
+-
+ phy->scan_chan = req->channels[phy->scan_chan_idx++];
+
+ if (!req->n_ssids ||
+diff --git a/mt7996/main.c b/mt7996/main.c
+index b59f72d0..cff2c527 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -297,6 +297,9 @@ static void mt7996_remove_bss_conf(struct ieee80211_vif *vif,
+ if (!mlink || !mconf)
+ return;
+
++ mt76_vif_dbg(vif, "band=%u, bss_idx=%u, link_id=%u, wcid=%u\n",
++ mconf->phy->mt76->band_idx, mconf->mt76.idx, mconf->link_id, mlink->wcid.idx);
++
+ phy = mconf->phy;
+ dev = phy->dev;
+ mt7996_mcu_add_sta(dev, conf, mconf, NULL, mlink, false, false);
+@@ -448,8 +451,8 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
+ rcu_assign_pointer(mvif->link[link_id], mconf);
+ rcu_assign_pointer(mvif->sta.link[link_id], mlink);
+
+- mlo_dbg(phy, "bss_idx=%u, link_id=%u, wcid=%u\n",
+- mconf->mt76.idx, mconf->link_id, mlink->wcid.idx);
++ mt76_vif_dbg(vif, "band=%u, bss_idx=%u, link_id=%u, wcid=%u\n",
++ phy->mt76->band_idx, mconf->mt76.idx, mconf->link_id, mlink->wcid.idx);
+
+ return 0;
+ error:
+@@ -636,10 +639,11 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+ add = vif->valid_links ?: BIT(0);
+ }
+
+- mlo_dbg(mt7996_hw_phy(hw), "cipher = 0x%x, icv_len = %u, iv_len = %u, hw_key_idx = %u, keyidx = %d, flags = 0x%x, link_id = %d, keylen = %u\n",
+- key->cipher, key->icv_len, key->iv_len, key->hw_key_idx, key->keyidx, key->flags, key->link_id, key->keylen);
+- // print_hex_dump(KERN_INFO , "", DUMP_PREFIX_OFFSET, 16, 1, key->key, key->keylen, false);
+- mlo_dbg(mt7996_hw_phy(hw), "add=%lx, valid_links=%x, active_links=%x\n", add, vif->valid_links, vif->active_links);
++ if (sta)
++ mt76_trace(vif, "keyidx=%d, link_bitmap=0x%lx (STA %pM)\n",
++ key->keyidx, add, sta->addr);
++ else
++ mt76_trace(vif, "keyidx=%d, link_bitmap=0x%lx\n", key->keyidx, add);
+
+ mutex_lock(&dev->mt76.mutex);
+
+@@ -1216,7 +1220,8 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
+ rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->wcid);
+ mt76_wcid_init(&mlink->wcid);
+
+- mlo_dbg(mconf->phy, "wcid=%u, link_id=%u, link_addr=%pM, pri_link=%u, sec_link=%u\n", mlink->wcid.idx, link_id, link_sta->addr, msta->pri_link, msta->sec_link);
++ mt76_vif_dbg(conf->vif, "STA %pM, wcid=%u, link_id=%u (%pM), pri_link=%u, sec_link=%u\n",
++ sta->addr, mlink->wcid.idx, link_id, link_sta->addr, msta->pri_link, msta->sec_link);
+ }
+
+ if (!assoc)
+@@ -1255,7 +1260,7 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ if (!ieee80211_vif_is_mld(vif) || rem == sta->valid_links)
+ cancel_delayed_work(&mvif->beacon_mon_work);
+
+- mlo_dbg(mt7996_hw_phy(mvif->hw), "rem=%lu\n", rem);
++ mt76_vif_dbg(vif, "removed_links=0x%lx\n", rem);
+ for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct mt7996_bss_conf *mconf =
+ mconf_dereference_protected(mvif, link_id);
+@@ -1282,7 +1287,7 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ unsigned int link_id;
+ int i, ret;
+
+- mlo_dbg(mt7996_hw_phy(mvif->hw), "add=%lu, assoc=%d\n", add, assoc);
++ mt76_vif_dbg(vif, "added_links=0x%lx, assoc=%d\n", add, assoc);
+ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct mt7996_bss_conf *mconf =
+ mconf_dereference_protected(mvif, link_id);
+@@ -1291,6 +1296,9 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ struct ieee80211_link_sta *link_sta =
+ link_sta_dereference_protected(sta, link_id);
+
++ if (!mconf || !conf || !link_sta)
++ continue;
++
+ ret = mt7996_add_link_sta(dev, conf, mconf, link_sta, assoc);
+ if (ret)
+ goto error;
+@@ -1457,13 +1465,13 @@ static void mt7996_tx(struct ieee80211_hw *hw,
+ rcu_dereference(sta->link[link_id]);
+
+ if (!link_sta) {
+- mlo_dbg(mt7996_hw_phy(mvif->hw), "request TX on invalid link_id=%u, use primary link (id=%u) instead.\n",
+- link_id, msta->pri_link);
++ mt76_vif_dbg(vif, "request TX on invalid link_id=%u, use primary link (id=%u) instead.\n",
++ link_id, msta->pri_link);
+ link_id = msta->pri_link;
+ link_sta = rcu_dereference(sta->link[link_id]);
+
+ if (!link_sta) {
+- mlo_dbg(mt7996_hw_phy(mvif->hw), "primary link became invalid, give up the TX\n");
++ mt76_vif_dbg(vif, "primary link became invalid, give up the TX\n");
+ goto unlock;
+ }
+ }
+@@ -2495,6 +2503,7 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct mt7996_bss_conf *mconf;
+ int ret;
+
++ mt76_vif_dbg(vif, "trigger scan on mt76 band %u\n", phy->mt76->band_idx);
+ mutex_lock(&phy->dev->mt76.mutex);
+ if (WARN_ON(phy->scan_req || phy->scan_chan)) {
+ mutex_unlock(&phy->dev->mt76.mutex);
+@@ -2624,7 +2633,7 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+ struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
+ int ret;
+
+- wiphy_info(hw->wiphy, "%s: add %u\n", __func__, conf->def.chan->hw_value);
++ mt76_dbg(hw, "add %u on mt76 band %d\n", conf->def.chan->hw_value, phy->mt76->band_idx);
+ mutex_lock(&phy->dev->mt76.mutex);
+
+ if (ctx->assigned) {
+@@ -2663,7 +2672,7 @@ mt7996_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+ struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
+ struct mt7996_phy *phy = ctx->phy;
+
+- wiphy_info(hw->wiphy, "%s: remove %u\n", __func__, conf->def.chan->hw_value);
++ mt76_dbg(hw, "remove %u\n", conf->def.chan->hw_value);
+ cancel_delayed_work_sync(&phy->scan_work);
+ cancel_delayed_work_sync(&phy->mt76->mac_work);
+
+@@ -2683,13 +2692,14 @@ mt7996_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+ struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
+ struct mt7996_phy *phy = ctx->phy;
+
+- wiphy_info(hw->wiphy, "%s: change %u, 0x%x\n", __func__, conf->def.chan->hw_value, changed);
+ if (changed & IEEE80211_CHANCTX_CHANGE_WIDTH ||
+ changed & IEEE80211_CHANCTX_CHANGE_RADAR) {
+ ctx->chandef = conf->def;
+ phy->mt76->radar_enabled = conf->radar_enabled;
+
+ mt7996_set_channel(phy, &ctx->chandef);
++
++ mt76_dbg(hw, "change to %u, 0x%x\n", conf->def.chan->hw_value, changed);
+ }
+ }
+
+@@ -2705,9 +2715,8 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ u8 link_id = link_conf->link_id;
+ int ret;
+
+- wiphy_info(hw->wiphy, "Assign VIF (addr: %pM, type: %d, link_id: %d) to channel context: %d MHz\n",
+- vif->addr, vif->type, link_conf->link_id,
+- conf->def.chan->center_freq);
++ mt76_vif_dbg(vif, "assign link_id %u to %d MHz\n", link_conf->link_id,
++ conf->def.chan->center_freq);
+
+ mutex_lock(&phy->dev->mt76.mutex);
+
+@@ -2747,9 +2756,8 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
+ struct mt7996_phy *phy = ctx->phy;
+
+- wiphy_info(hw->wiphy, "Remove VIF (addr: %pM, type: %d, link_id: %d) from channel context: %d MHz\n",
+- vif->addr, vif->type, link_conf->link_id,
+- conf->def.chan->center_freq);
++ mt76_vif_dbg(vif, "remove link %u from %d MHz\n",
++ link_conf->link_id, conf->def.chan->center_freq);
+ cancel_delayed_work_sync(&phy->scan_work);
+
+ mutex_lock(&phy->dev->mt76.mutex);
+@@ -2778,9 +2786,15 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+ if (vifs[i].old_ctx == vifs[i].new_ctx)
+ continue;
+
+- wiphy_info(hw->wiphy, "%s: old=%d, new=%d\n",
+- __func__, vifs[i].old_ctx->def.chan->hw_value,
+- vifs[i].new_ctx->def.chan->hw_value);
++ mt76_vif_dbg(vifs[i].vif,
++ "chan=%d->%d, width=%d->%d, punct_bitmap=0x%04x->0x%04x, link=%u\n",
++ vifs[i].old_ctx->def.chan->hw_value,
++ vifs[i].new_ctx->def.chan->hw_value,
++ vifs[i].old_ctx->def.width,
++ vifs[i].new_ctx->def.width,
++ vifs[i].old_ctx->def.punctured,
++ vifs[i].new_ctx->def.punctured,
++ vifs[i].link_conf->link_id);
+
+ mutex_lock(&dev->mt76.mutex);
+
+@@ -2830,7 +2844,7 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ unsigned int link_id;
+ int ret = 0;
+
+- mlo_dbg(phy, "old=%u, new=%u\n", old_links, new_links);
++ mt76_vif_dbg(vif, "old=0x%x, new=0x%x\n", old_links, new_links);
+ if (old_links == new_links)
+ return 0;
+
+@@ -2876,7 +2890,7 @@ mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ unsigned long rem = old_links & ~new_links;
+ int ret = 0;
+
+- mlo_dbg(mt7996_hw_phy(hw), "old=%u, new=%u\n", old_links, new_links);
++ mt76_vif_dbg(vif, "STA %pM old=0x%x, new=0x%x\n", sta->addr, old_links, new_links);
+ mutex_lock(&dev->mt76.mutex);
+
+ if (rem)
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 6af45467..f848e3b7 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -382,7 +382,6 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ if (!link_conf || !link_conf->csa_active || vif->type == NL80211_IFTYPE_STATION)
+ return;
+
+- pr_info("%s: link_id=%d\n", __func__, link_id);
+ mvif->cs_ready_links = 0;
+ mvif->cs_link_id = IEEE80211_LINK_UNSPECIFIED;
+ ieee80211_csa_finish(vif, link_id);
+@@ -1508,8 +1507,8 @@ mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
+ }
+
+ mld->own_mld_id = mconf->own_mld_id;
+- pr_info("%s: group_mld_id=%d own_mld_id=%d remap_idx=%d mld->addr[%pM]\n",
+- __func__, mld->group_mld_id, mld->own_mld_id, mld->remap_idx, mld->mac_addr);
++ mt76_trace(vif, "group_mld_id=%d, own_mld_id=%d, remap_idx=%d, mld->addr[%pM]\n",
++ mld->group_mld_id, mld->own_mld_id, mld->remap_idx, mld->mac_addr);
+ }
+
+ static void
+@@ -1662,8 +1661,8 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
+
+ memcpy(bss->bssid, conf->bssid, ETH_ALEN);
+
+- mlo_dbg(mconf->phy, "omac_idx=%d band_idx=%d wmm_idx=%d bss->bssid=%pM enable=%d\n",
+- bss->omac_idx, bss->band_idx, bss->wmm_idx, bss->bssid, enable);
++ mt76_trace(vif, "band=%d, omac=%d, wmm_idx=%d, bssid=%pM, link=%d, en=%d\n",
++ bss->band_idx, bss->omac_idx, bss->wmm_idx, bss->bssid, conf->link_id, enable);
+
+ bss->bcn_interval = cpu_to_le16(conf->beacon_int);
+ bss->dtim_period = conf->dtim_period;
+@@ -1802,8 +1801,6 @@ mt7996_mcu_sta_tx_cap(struct mt7996_dev *dev, struct mt76_vif *mvif,
+ tx_cap = (struct sta_rec_tx_cap *)tlv;
+ tx_cap->ampdu_limit_en = true;
+
+- dev_info(dev->mt76.dev, "%s: limit wcid %d ampdu to 512\n", __func__, wcid->idx);
+-
+ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+ }
+@@ -2961,8 +2958,8 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ /* starec basic */
+ mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, conf, link_sta,
+ enable, newly);
+- mlo_dbg(mconf->phy, "link=%u, newly=%d, en=%d\n",
+- mlink->wcid.link_id, newly, enable);
++ mt76_trace(vif, "link=%u, wcid=%u, newly=%d, en=%d\n",
++ mlink->wcid.link_id, mlink->wcid.idx, newly, enable);
+
+ if (!enable)
+ goto out;
+@@ -3022,6 +3019,8 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+ struct tlv *tlv;
+ unsigned long valid_links = sta->valid_links;
+ unsigned int link_id;
++ struct ieee80211_vif *vif = container_of((void *)msta->vif, struct ieee80211_vif,
++ drv_priv);
+
+ mlink = mlink_dereference_protected(msta, msta->pri_link);
+ if (!mlink)
+@@ -3045,15 +3044,16 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+ mld_setup->link_num = hweight16(sta->valid_links);
+
+ mld_setup_link = (struct mld_setup_link *)mld_setup->link_info;
+- mlo_dbg(mt7996_hw_phy(mlink->sta->vif->hw), "pri_link(%u) primary_id(%d) seconed_id(%d) wcid(%d), link_num(%d), mld_addr[%pM]\n",
+- msta->pri_link, mld_setup->primary_id, mld_setup->seconed_id, mld_setup->setup_wcid, mld_setup->link_num, mld_setup->mld_addr);
++ mt76_trace(vif, "STA %pM pri_link=%u, pri_wcid=%u, sec_link=%u, sec_wcid=%u\n",
++ sta->addr, msta->pri_link, le16_to_cpu(mld_setup->primary_id),
++ msta->sec_link, le16_to_cpu(mld_setup->seconed_id));
+ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ mlink = mlink_dereference_protected(msta, link_id);
+ mconf = mconf_dereference_protected(msta->vif, link_id);
+
+ mld_setup_link->wcid = cpu_to_le16(mlink->wcid.idx);
+ mld_setup_link->bss_idx = mconf->mt76.idx;
+- mlo_dbg(mt7996_hw_phy(mlink->sta->vif->hw), "link_id(%d) wcid(%d) bss_idx(%d)\n",
++ mt76_trace(vif, "link_id(%d) wcid(%d) bss_idx(%d)\n",
+ link_id, mld_setup_link->wcid, mld_setup_link->bss_idx);
+ mld_setup_link++;
+ }
+@@ -3319,8 +3319,8 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
+ return mt7996_mcu_muar_config(phy, conf, mconf, false, enable);
+
+ memcpy(data.tlv.omac_addr, conf->addr, ETH_ALEN);
+- mlo_dbg(phy, "omac=%u, band=%u, addr=%pM, en=%d\n",
+- data.hdr.omac_idx,data.hdr.band_idx, data.tlv.omac_addr, enable);
++ mt76_trace(conf->vif, "band=%u, omac=%u, addr=%pM, en=%d\n",
++ data.hdr.band_idx, data.hdr.omac_idx, data.tlv.omac_addr, enable);
+ return mt76_mcu_send_msg(&dev->mt76, MCU_WMWA_UNI_CMD(DEV_INFO_UPDATE),
+ &data, sizeof(data), true);
+ }
+@@ -6533,10 +6533,10 @@ int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw,
+ }
+ }
+
+- mlo_dbg(mconf->phy, "link:%u, wcid:%d, control:%x, mode:%d, bmp:%x\n",
+- mlink->wcid.link_id, mlink->wcid.idx, eml_omn->control,
+- !!(eml_omn->control & EML_OMN_CONTROL_EMLSR_MODE),
+- eml_op->bitmap);
++ mt76_vif_dbg(vif, "link:%u, wcid:%d, control:%x, mode:%d, bmp:%x\n",
++ mlink->wcid.link_id, mlink->wcid.idx, eml_omn->control,
++ !!(eml_omn->control & EML_OMN_CONTROL_EMLSR_MODE),
++ eml_op->bitmap);
+
+ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 05bdc437..612e849c 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -982,7 +982,15 @@ mt7996_get_link_wcid(struct mt7996_dev *dev, u16 idx, u8 band_idx)
+ return &mlink->wcid;
+ }
+
+-#define mlo_dbg(phy, fmt, ...) wiphy_info(phy->mt76->hw->wiphy, "%s: " fmt, __func__, ##__VA_ARGS__)
++#define mt76_dbg(hw, fmt, ...) wiphy_info(hw->wiphy, "%s: " fmt, __func__, ##__VA_ARGS__)
++#define mt76_vif_dbg(vif, fmt, ...) \
++ pr_info("%s: %s: " fmt, \
++ ieee80211_vif_to_wdev(vif)->netdev->name, \
++ __func__, ##__VA_ARGS__)
++#define mt76_trace(vif, fmt, ...) \
++ trace_printk("(%s) " fmt, \
++ ieee80211_vif_to_wdev(vif)->netdev->name, \
++ ##__VA_ARGS__)
+
+ extern const struct ieee80211_ops mt7996_ops;
+ extern struct pci_driver mt7996_pci_driver;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0159-mtk-mt76-mt7996-support-configure-trigger-frame-type.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0159-mtk-mt76-mt7996-support-configure-trigger-frame-type.patch
new file mode 100644
index 0000000..4c0667b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0159-mtk-mt76-mt7996-support-configure-trigger-frame-type.patch
@@ -0,0 +1,88 @@
+From f3d7abe8218a285c098f88267034f5625fe3df3a Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Tue, 7 May 2024 10:00:09 +0800
+Subject: [PATCH 159/199] mtk: mt76: mt7996: support configure trigger frame
+ type
+
+Support receiving an nl80211 subcmd
+MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE, which is used to
+configure the trigger frame type by sending mcu commands. The input
+value can be 0 or 1. The former is for HE variant trigger frame and the
+latter is for EHT variant trigger frame.
+
+The purpose of this commit is for WiFi 7 R1 cert UL-RU and UL-MU test
+cases.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/mtk_mcu.c | 1 +
+ mt7996/mtk_mcu.h | 1 +
+ mt7996/vendor.c | 8 ++++++++
+ mt7996/vendor.h | 1 +
+ 4 files changed, 11 insertions(+)
+
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 82e3f721..74f185c2 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -1041,6 +1041,7 @@ error:
+ * SET_TRIG_TYPE (0xC9)
+ * SET_20M_DYN_ALGO (0xCA)
+ * SET_CERT_MU_EDCA_OVERRIDE (0xCD)
++ * SET_TRIG_VARIANT (0xD5)
+ */
+ int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val)
+ {
+diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
+index 2cffc893..8ba261a7 100644
+--- a/mt7996/mtk_mcu.h
++++ b/mt7996/mtk_mcu.h
+@@ -133,6 +133,7 @@ enum {
+ UNI_CMD_MURU_SET_20M_DYN_ALGO = 0xCA,
+ UNI_CMD_MURU_PROT_FRAME_THR = 0xCC,
+ UNI_CMD_MURU_SET_CERT_MU_EDCA_OVERRIDE,
++ UNI_CMD_MURU_SET_TRIG_VARIANT = 0xD5,
+ };
+
+ struct bf_pfmu_tag {
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index 585c4e28..54eb2686 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -107,6 +107,7 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
+ [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE] = { .type = NLA_U8 },
+ };
+
+ static const struct nla_policy
+@@ -907,6 +908,13 @@ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+ default:
+ return 0;
+ }
++ } else if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE]) {
++ u8 trig_var;
++
++ trig_var = nla_get_u8(tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE]);
++
++ return mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_TRIG_VARIANT,
++ trig_var);
+ }
+
+ return 0;
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index f6fcb623..bd9579d5 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -93,6 +93,7 @@ enum mtk_vendor_attr_rfeature_ctrl {
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE,
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY,
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF,
++ MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE,
+
+ /* keep last */
+ NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0160-mtk-mt76-mt7996-support-configure-coding-type-for-wi.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0160-mtk-mt76-mt7996-support-configure-coding-type-for-wi.patch
new file mode 100644
index 0000000..b3e6aa7
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0160-mtk-mt76-mt7996-support-configure-coding-type-for-wi.patch
@@ -0,0 +1,236 @@
+From 750c99749949677a385774085cce922986eda7a2 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 7 Jun 2024 13:24:04 +0800
+Subject: [PATCH 160/199] mtk: mt76: mt7996: support configure coding type for
+ wifi7 r1 cert
+
+This commit includes two changes for WiFi7 cert fix rate test cases.
+First, support receiving an nl80211 subcmd
+MTK_VENDOR_ATTR_RFEATURE_CTRL_CODING_TYPE, which is used to
+configure the encoding type by sending mcu commands. The input
+value can be 0, 1 or 8.
+
+Second, if we fix partial rate by two different user space commands,
+the first command will be useless due to the design of mcu commands.
+Some mcu commands could not be sent when we run several user space
+commands to fix partial rate. To address this issue, we utilize variable
+cert_mode to determine whether we are currently using multiple user
+space commands to fix the partial rate.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/mac.c | 10 ++++++++++
+ mt7996/mcu.c | 7 +++++++
+ mt7996/mcu.h | 1 +
+ mt7996/mt7996.h | 5 ++++-
+ mt7996/mtk_mcu.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ mt7996/vendor.c | 18 +++++++++++++++++-
+ mt7996/vendor.h | 2 ++
+ 7 files changed, 82 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 960b02dd..c59cc7cc 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2373,6 +2373,16 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
+ if (changed & IEEE80211_RC_SMPS_CHANGED)
+ mt7996_mcu_set_fixed_field(dev, mconf, link_sta, mlink, NULL,
+ RATE_PARAM_MMPS_UPDATE);
++#ifdef CONFIG_MTK_VENDOR
++ if (changed & IEEE80211_RC_CODING_TYPE_CHANGED) {
++ struct sta_phy_uni phy = {
++ .ldpc = dev->coding_type,
++ };
++
++ mt7996_mcu_set_fixed_field(dev, mconf, link_sta, mlink, &phy,
++ RATE_PARAM_FIXED_ENCODING);
++ }
++#endif
+
+ spin_lock_bh(&dev->mt76.sta_poll_lock);
+ }
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index f848e3b7..eeff5e9e 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -2659,6 +2659,7 @@ int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev,
+ case RATE_PARAM_FIXED_MCS:
+ case RATE_PARAM_FIXED_GI:
+ case RATE_PARAM_FIXED_HE_LTF:
++ case RATE_PARAM_FIXED_ENCODING:
+ if (phy)
+ ra->phy = *phy;
+ break;
+@@ -2884,6 +2885,12 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
++#ifdef CONFIG_MTK_VENDOR
++ if (changed && dev->cert_mode == 2)
++ return mt7996_mcu_add_rate_ctrl_fixed(dev, conf, mconf,
++ link_sta, mlink);
++#endif
++
+ /* firmware rc algorithm refers to sta_rec_he for HE control.
+ * once dev->rc_work changes the settings driver should also
+ * update sta_rec_he here.
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 737f426d..9b29dc29 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -909,6 +909,7 @@ enum {
+ RATE_PARAM_FIXED_HE_LTF = 7,
+ RATE_PARAM_FIXED_MCS,
+ RATE_PARAM_FIXED_GI = 11,
++ RATE_PARAM_FIXED_ENCODING,
+ RATE_PARAM_AUTO = 20,
+ #ifdef CONFIG_MTK_VENDOR
+ RATE_PARAM_FIXED_MIMO = 30,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 612e849c..ae792719 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -516,6 +516,8 @@ struct csi_data {
+
+ struct list_head node;
+ };
++
++int mt7996_set_coding_type(struct ieee80211_hw *hw, u8 coding_type, u8 link_id);
+ #endif
+
+ struct mt7996_rro_ba_session {
+@@ -786,7 +788,8 @@ struct mt7996_dev {
+ const struct mt7996_dbg_reg_desc *dbg_reg;
+ #endif
+ #ifdef CONFIG_MTK_VENDOR
+- bool cert_mode;
++ u8 cert_mode;
++ u8 coding_type;
+ #endif
+
+ #if defined CONFIG_NL80211_TESTMODE || defined CONFIG_MTK_DEBUG
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 74f185c2..7cf4b2be 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -1372,3 +1372,44 @@ int mt7996_mcu_mlo_agc(struct mt7996_dev *dev, const void *data, int len)
+ len, true);
+ }
+ #endif
++
++#ifdef CONFIG_MTK_VENDOR
++
++static void mt7996_sta_coding_type_work(void *data, struct ieee80211_sta *sta)
++{
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct mt7996_link_sta *mlink;
++ struct mt7996_dev *dev = msta->vif->dev;
++ u8 *link_id = data;
++
++ rcu_read_lock();
++ mlink = rcu_dereference(msta->link[*link_id]);
++
++ if (!mlink)
++ goto unlock;
++
++ spin_lock_bh(&dev->mt76.sta_poll_lock);
++ mlink->changed |= IEEE80211_RC_CODING_TYPE_CHANGED;
++ if (list_empty(&mlink->rc_list))
++ list_add_tail(&mlink->rc_list, &dev->sta_rc_list);
++
++ spin_unlock_bh(&dev->mt76.sta_poll_lock);
++
++unlock:
++ rcu_read_unlock();
++}
++
++int mt7996_set_coding_type(struct ieee80211_hw *hw, u8 coding_type, u8 link_id)
++{
++ struct mt7996_phy *phy = mt7996_hw_phy(hw);
++ struct mt7996_dev *dev = phy->dev;
++
++ dev->coding_type = coding_type;
++
++ /* Not support set all stations under different MLD interface */
++ ieee80211_iterate_stations_atomic(hw, mt7996_sta_coding_type_work, &link_id);
++ ieee80211_queue_work(hw, &dev->rc_work);
++
++ return 0;
++}
++#endif
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index 54eb2686..e929f812 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -108,6 +108,8 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
+ [MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_RFEATURE_CTRL_CODING_TYPE] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_RFEATURE_CTRL_LINK_ID] = { .type = NLA_U8 },
+ };
+
+ static const struct nla_policy
+@@ -864,16 +866,24 @@ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+ {
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
++ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
+ struct mt7996_dev *dev = phy->dev;
+ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL];
+ int err;
+ u32 val;
++ u8 link_id = 0;
+
+ err = nla_parse(tb, MTK_VENDOR_ATTR_RFEATURE_CTRL_MAX, data, data_len,
+ rfeature_ctrl_policy, NULL);
+ if (err)
+ return err;
+
++ if (ieee80211_vif_is_mld(vif) && tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_LINK_ID]) {
++ link_id = nla_get_u8(tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_LINK_ID]);
++ if (link_id >= IEEE80211_LINK_UNSPECIFIED)
++ return -EINVAL;
++ }
++
+ val = CAPI_RFEATURE_CHANGED;
+
+ if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG]) {
+@@ -915,6 +925,12 @@ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+
+ return mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_TRIG_VARIANT,
+ trig_var);
++ } else if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_CODING_TYPE]) {
++ u8 coding_type;
++
++ coding_type = nla_get_u8(tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_CODING_TYPE]);
++
++ return mt7996_set_coding_type(hw, coding_type, link_id);
+ }
+
+ return 0;
+@@ -971,7 +987,7 @@ static int mt7996_vendor_wireless_ctrl(struct wiphy *wiphy,
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]);
+ dev->cert_mode = val8;
+- mt7996_mcu_set_cert(phy, val8);
++ mt7996_mcu_set_cert(phy, !!val8);
+ mt7996_mcu_set_bypass_smthint(phy, val8);
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]);
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index bd9579d5..5608a3b4 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -94,6 +94,8 @@ enum mtk_vendor_attr_rfeature_ctrl {
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY,
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF,
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_VARIANT_TYPE,
++ MTK_VENDOR_ATTR_RFEATURE_CTRL_CODING_TYPE,
++ MTK_VENDOR_ATTR_RFEATURE_CTRL_LINK_ID,
+
+ /* keep last */
+ NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0161-mtk-mt76-mt7996-record-RSSI-and-SNR.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0161-mtk-mt76-mt7996-record-RSSI-and-SNR.patch
new file mode 100644
index 0000000..cea127b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0161-mtk-mt76-mt7996-record-RSSI-and-SNR.patch
@@ -0,0 +1,235 @@
+From b823f8980320ec23f5a95a1eadd6d93425f1c070 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Thu, 13 Jun 2024 17:27:03 +0800
+Subject: [PATCH 161/199] mtk: mt76: mt7996: record RSSI and SNR
+
+RSSI and SNR information were incomplete.
+- RSSI: per-antenna ACK-frame RSSI was not reported.
+- SNR: unavailable.
+Therefore, get and record these signal statuses in order to show them for debugging purposes.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/mac.c | 9 +++++-
+ mt7996/mcu.c | 76 ++++++++++++++++++++++++++++++-------------------
+ mt7996/mcu.h | 9 +++++-
+ mt7996/mt7996.h | 8 +++++-
+ 4 files changed, 70 insertions(+), 32 deletions(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index c59cc7cc..017e3465 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -493,6 +493,13 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ status->chain_signal[2] = to_rssi(MT_PRXV_RCPI2, v3);
+ status->chain_signal[3] = to_rssi(MT_PRXV_RCPI3, v3);
+
++ if (mlink) {
++ memcpy(mlink->chain_signal, status->chain_signal,
++ IEEE80211_MAX_CHAINS);
++ mlink->signal = mt76_rx_signal(mphy->antenna_mask,
++ mlink->chain_signal);
++ }
++
+ /* RXD Group 5 - C-RXV */
+ if (rxd1 & MT_RXD1_NORMAL_GROUP_5) {
+ rxd += 24;
+@@ -2413,7 +2420,7 @@ void mt7996_mac_work(struct work_struct *work)
+ if (i == mphy->band_idx) {
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_RATE);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_AIRTIME);
+- mt7996_mcu_get_rssi(mdev);
++ mt7996_mcu_get_signal_status(mdev);
+ // if (mtk_wed_device_active(&mdev->mmio.wed)) {
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index eeff5e9e..54295414 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -5791,14 +5791,15 @@ int mt7996_mcu_set_rro(struct mt7996_dev *dev, u16 tag, u16 val)
+ }
+
+ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+- u16 sta_num, u16 *sta_list)
++ u16 sta_num, u16 *sta_list)
+ {
+ #define PER_STA_INFO_MAX_NUM 90
+ struct mt7996_mcu_per_sta_info_event *res;
++ struct mt7996_link_sta *mlink;
+ struct mt76_wcid *wcid;
+ struct sk_buff *skb;
++ int i, j, ret;
+ u16 wlan_idx;
+- int i, ret;
+ struct {
+ u8 __rsv1;
+ u8 unsolicit;
+@@ -5837,23 +5838,18 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+ switch (tag) {
+ case UNI_PER_STA_RSSI:
+ for (i = 0; i < sta_num; ++i) {
+- struct mt7996_link_sta *mlink;
+- struct mt76_phy *phy;
+- s8 rssi[4];
+- u8 *rcpi;
+-
+ wlan_idx = le16_to_cpu(res->rssi[i].wlan_idx);
+ wcid = rcu_dereference(dev->wcid[wlan_idx]);
+- if (wcid) {
+- rcpi = res->rssi[i].rcpi;
+- rssi[0] = to_rssi(MT_PRXV_RCPI0, rcpi[0]);
+- rssi[1] = to_rssi(MT_PRXV_RCPI0, rcpi[1]);
+- rssi[2] = to_rssi(MT_PRXV_RCPI0, rcpi[2]);
+- rssi[3] = to_rssi(MT_PRXV_RCPI0, rcpi[3]);
+-
+- mlink = container_of(wcid, struct mt7996_link_sta, wcid);
+- phy = dev->phys[wcid->phy_idx];
+- mlink->ack_signal = mt76_rx_signal(phy->antenna_mask, rssi);
++ mlink = wcid_to_mlink(wcid);
++ if (mlink) {
++ struct mt76_phy *phy = dev->phys[wcid->phy_idx];
++ u8 *rcpi = res->rssi[i].rcpi;
++
++ for (j = 0; j < IEEE80211_MAX_CHAINS; ++j)
++ mlink->chain_ack_signal[j] = to_rssi(MT_PRXV_RCPI0, rcpi[j]);
++
++ mlink->ack_signal = mt76_rx_signal(phy->antenna_mask,
++ mlink->chain_ack_signal);
+ ewma_avg_signal_add(&mlink->avg_ack_signal, -mlink->ack_signal);
+ } else {
+ ret = -EINVAL;
+@@ -5862,6 +5858,21 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+ }
+ }
+ break;
++ case UNI_PER_STA_SNR:
++ for (i = 0; i < sta_num; ++i) {
++ wlan_idx = le16_to_cpu(res->snr[i].wlan_idx);
++ wcid = rcu_dereference(dev->wcid[wlan_idx]);
++ mlink = wcid_to_mlink(wcid);
++ if (mlink)
++ memcpy(mlink->chain_ack_snr, res->snr[i].val,
++ IEEE80211_MAX_CHAINS);
++ else {
++ ret = -EINVAL;
++ dev_err(dev->dev, "Failed to update SNR for "
++ "invalid WCID: %hu\n", wlan_idx);
++ }
++ }
++ break;
+ default:
+ ret = -EINVAL;
+ dev_err(dev->dev, "Unknown UNI_PER_STA_INFO_TAG: %d\n", tag);
+@@ -5872,7 +5883,7 @@ out:
+ return ret;
+ }
+
+-int mt7996_mcu_get_rssi(struct mt76_dev *dev)
++int mt7996_mcu_get_signal_status(struct mt76_dev *dev)
+ {
+ u16 sta_list[PER_STA_INFO_MAX_NUM];
+ LIST_HEAD(sta_poll_list);
+@@ -5897,8 +5908,8 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev)
+ break;
+ }
+ mlink = list_first_entry(&sta_poll_list,
+- struct mt7996_link_sta,
+- wcid.poll_list);
++ struct mt7996_link_sta,
++ wcid.poll_list);
+ list_del_init(&mlink->wcid.poll_list);
+ spin_unlock_bh(&dev->sta_poll_lock);
+
+@@ -5906,16 +5917,23 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev)
+ }
+
+ ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_RSSI,
+- i, sta_list);
+- if (ret) {
+- /* Add STAs, whose RSSI has not been updated,
+- * back to polling list.
+- */
+- spin_lock_bh(&dev->sta_poll_lock);
+- list_splice(&sta_poll_list, &dev->sta_poll_list);
+- spin_unlock_bh(&dev->sta_poll_lock);
++ i, sta_list);
++ if (ret)
+ break;
+- }
++
++ ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_SNR,
++ i, sta_list);
++ if (ret)
++ break;
++ }
++
++ if (ret) {
++ /* Add STAs, whose signal statuses have not been updated,
++ * back to polling list.
++ */
++ spin_lock_bh(&dev->sta_poll_lock);
++ list_splice(&sta_poll_list, &dev->sta_poll_list);
++ spin_unlock_bh(&dev->sta_poll_lock);
+ }
+
+ return ret;
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 9b29dc29..20eaf20d 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -202,7 +202,13 @@ struct mt7996_mcu_mib {
+ struct per_sta_rssi {
+ __le16 wlan_idx;
+ u8 __rsv[2];
+- u8 rcpi[4];
++ u8 rcpi[IEEE80211_MAX_CHAINS];
++} __packed;
++
++struct per_sta_snr {
++ __le16 wlan_idx;
++ u8 __rsv[2];
++ s8 val[IEEE80211_MAX_CHAINS];
+ } __packed;
+
+ struct mt7996_mcu_per_sta_info_event {
+@@ -213,6 +219,7 @@ struct mt7996_mcu_per_sta_info_event {
+
+ union {
+ struct per_sta_rssi rssi[0];
++ struct per_sta_snr snr[0];
+ };
+ } __packed;
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index ae792719..8d27ae5d 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -317,9 +317,15 @@ struct mt7996_link_sta {
+
+ struct list_head rc_list;
+
++ s8 chain_signal[IEEE80211_MAX_CHAINS];
++ int signal;
++
++ s8 chain_ack_signal[IEEE80211_MAX_CHAINS];
+ int ack_signal;
+ struct ewma_avg_signal avg_ack_signal;
+
++ s8 chain_ack_snr[IEEE80211_MAX_CHAINS];
++
+ unsigned long changed;
+
+ struct mt76_connac_sta_key_conf bip;
+@@ -1126,7 +1132,7 @@ void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb);
+ void mt7996_mcu_exit(struct mt7996_dev *dev);
+ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+ u16 sta_num, u16 *sta_list);
+-int mt7996_mcu_get_rssi(struct mt76_dev *dev);
++int mt7996_mcu_get_signal_status(struct mt76_dev *dev);
+ int mt7996_mcu_get_all_sta_info(struct mt76_dev *dev, u16 tag);
+ int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id);
+ int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0162-mtk-mt76-mt7996-support-find-the-mt7996_phy-by-link_.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0162-mtk-mt76-mt7996-support-find-the-mt7996_phy-by-link_.patch
new file mode 100644
index 0000000..239e33b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0162-mtk-mt76-mt7996-support-find-the-mt7996_phy-by-link_.patch
@@ -0,0 +1,183 @@
+From a2a53b70dec62aa8f7afb02d135c2af76423e1e8 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Thu, 20 Jun 2024 10:55:07 +0800
+Subject: [PATCH 162/199] mtk: mt76: mt7996: support find the mt7996_phy by
+ link_id for vendor command
+
+Add support to find the corresponding phy by link_id. This commit is for
+the wifi7 r1 cert UL OFDMA case. If we want to force sending trigger
+frame on the specific band, we need to fill band idx in the mcu cmd.
+That is why we need link id to find the corresponding phy.
+
+Fix the way to find the band_idx if WiFi7 AP is non-MLD mode.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/mt7996.h | 5 +++--
+ mt7996/mtk_debugfs.c | 2 +-
+ mt7996/mtk_mcu.c | 22 ++++++++++++----------
+ mt7996/vendor.c | 19 ++++++++++++++-----
+ 4 files changed, 30 insertions(+), 18 deletions(-)
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 8d27ae5d..42c1e287 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1326,11 +1326,12 @@ int mt7996_mcu_set_txbf_internal(struct mt7996_phy *phy, u8 action, int idx, boo
+ void mt7996_mcu_rx_bf_event(struct mt7996_dev *dev, struct sk_buff *skb);
+ int mt7996_mcu_set_muru_fixed_rate_enable(struct mt7996_dev *dev, u8 action, int val);
+ int mt7996_mcu_set_muru_fixed_rate_parameter(struct mt7996_dev *dev, u8 action, void *para);
+-int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para);
++int mt7996_mcu_set_txbf_snd_info(struct mt7996_dev *dev, void *para);
+ int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val);
+ int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val);
+ int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val);
+-int mt7996_mcu_set_rfeature_trig_type(struct mt7996_phy *phy, u8 enable, u8 trig_type);
++int mt7996_mcu_set_rfeature_trig_type(struct mt7996_dev *dev, u8 band_idx,
++ u8 enable, u8 trig_type);
+ void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type);
+ void mt7996_mcu_set_nusers_ofdma(struct mt7996_phy *phy, u8 type, u8 ofdma_user_cnt);
+ void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type);
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index a7cbde3e..9bd35c91 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -2929,7 +2929,7 @@ mt7996_bf_txsnd_info_set(struct file *file,
+ else
+ buf[count] = '\0';
+
+- ret = mt7996_mcu_set_txbf_snd_info(phy, buf);
++ ret = mt7996_mcu_set_txbf_snd_info(phy->dev, buf);
+
+ if (ret) return -EFAULT;
+
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 7cf4b2be..c87daf8e 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -352,7 +352,7 @@ int mt7996_mcu_set_txbf_internal(struct mt7996_phy *phy, u8 action, int idx, boo
+ return mt76_mcu_skb_send_msg(&phy->dev->mt76, skb, MCU_WM_UNI_CMD(BF), false);
+ }
+
+-int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para)
++int mt7996_mcu_set_txbf_snd_info(struct mt7996_dev *dev, void *para)
+ {
+ char *buf = (char *)para;
+ __le16 input[5] = {0};
+@@ -365,7 +365,7 @@ int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para)
+
+ memset(&hdr, 0, sizeof(hdr));
+
+- skb = mt76_mcu_msg_alloc(&phy->dev->mt76, NULL, len);
++ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, len);
+ if (!skb)
+ return -ENOMEM;
+
+@@ -428,7 +428,7 @@ int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para)
+ return -EINVAL;
+ }
+
+- return mt76_mcu_skb_send_msg(&phy->dev->mt76, skb, MCU_WM_UNI_CMD(BF), false);
++ return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(BF), false);
+ }
+
+ static inline void
+@@ -1112,10 +1112,9 @@ int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
+ true);
+ }
+
+-int mt7996_mcu_set_bsrp_ctrl(struct mt7996_phy *phy, u16 interval,
++int mt7996_mcu_set_bsrp_ctrl(struct mt7996_dev *dev, u8 band_idx, u16 interval,
+ u16 ru_alloc, u32 trig_type, u8 trig_flow, u8 ext_cmd)
+ {
+- struct mt7996_dev *dev = phy->dev;
+ struct {
+ u8 _rsv[4];
+
+@@ -1141,13 +1140,16 @@ int mt7996_mcu_set_bsrp_ctrl(struct mt7996_phy *phy, u16 interval,
+ GENMASK(2, 0) : GENMASK(1, 0),
+ };
+
++ if (!mt7996_band_valid(dev, band_idx))
++ return -EINVAL;
++
+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req,
+ sizeof(req), false);
+ }
+
+-int mt7996_mcu_set_rfeature_trig_type(struct mt7996_phy *phy, u8 enable, u8 trig_type)
++int mt7996_mcu_set_rfeature_trig_type(struct mt7996_dev *dev, u8 band_idx,
++ u8 enable, u8 trig_type)
+ {
+- struct mt7996_dev *dev = phy->dev;
+ int ret = 0;
+ char buf[] = "01:00:00:1B";
+
+@@ -1159,14 +1161,14 @@ int mt7996_mcu_set_rfeature_trig_type(struct mt7996_phy *phy, u8 enable, u8 trig
+
+ switch (trig_type) {
+ case CAPI_BASIC:
+- return mt7996_mcu_set_bsrp_ctrl(phy, 5, 67, 0, 0, enable);
++ return mt7996_mcu_set_bsrp_ctrl(dev, band_idx, 5, 67, 0, 0, enable);
+ case CAPI_BRP:
+- return mt7996_mcu_set_txbf_snd_info(phy, buf);
++ return mt7996_mcu_set_txbf_snd_info(dev, buf);
+ case CAPI_MU_BAR:
+ return mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY,
+ MU_DL_ACK_POLICY_MU_BAR);
+ case CAPI_BSRP:
+- return mt7996_mcu_set_bsrp_ctrl(phy, 5, 67, 4, 0, enable);
++ return mt7996_mcu_set_bsrp_ctrl(dev, band_idx, 5, 67, 4, 0, enable);
+ default:
+ return 0;
+ }
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index e929f812..ed7c1322 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -866,12 +866,13 @@ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+ {
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+- struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
+ struct mt7996_dev *dev = phy->dev;
++ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_bss_conf *mconf;
+ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL];
+ int err;
+- u32 val;
+- u8 link_id = 0;
++ u8 band_idx, link_id = 0;
+
+ err = nla_parse(tb, MTK_VENDOR_ATTR_RFEATURE_CTRL_MAX, data, data_len,
+ rfeature_ctrl_policy, NULL);
+@@ -884,7 +885,15 @@ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+ return -EINVAL;
+ }
+
+- val = CAPI_RFEATURE_CHANGED;
++ rcu_read_lock();
++ mconf = rcu_dereference(mvif->link[link_id]);
++ if (!mconf || !mconf->phy) {
++ rcu_read_unlock();
++ return -EINVAL;
++ }
++
++ band_idx = mconf->phy->mt76->band_idx;
++ rcu_read_unlock();
+
+ if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG]) {
+ u8 enable, trig_type;
+@@ -904,7 +913,7 @@ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+ };
+ }
+
+- err = mt7996_mcu_set_rfeature_trig_type(phy, enable, trig_type);
++ err = mt7996_mcu_set_rfeature_trig_type(dev, band_idx, enable, trig_type);
+ if (err)
+ return err;
+ } else if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY]) {
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0163-mtk-mt76-mt7996-workaround-for-get_tsf-crash-issue.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0163-mtk-mt76-mt7996-workaround-for-get_tsf-crash-issue.patch
new file mode 100644
index 0000000..3093ae7
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0163-mtk-mt76-mt7996-workaround-for-get_tsf-crash-issue.patch
@@ -0,0 +1,40 @@
+From 2788ac3b4b7c0484faea6207a86e37c827262c89 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Mon, 24 Jun 2024 11:09:50 +0800
+Subject: [PATCH 163/199] mtk: mt76: mt7996: workaround for get_tsf crash issue
+
+---
+ mt7996/main.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index cff2c527..443b3962 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1630,11 +1630,20 @@ mt7996_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_bss_conf *mconf;
+- u64 ret;
++ u64 ret = -1ULL;
++ int i;
+
+ mutex_lock(&dev->mt76.mutex);
+- mconf = mconf_dereference_protected(mvif, mvif->master_link_id);
+- ret = __mt7996_get_tsf(hw, mconf);
++ /* FIXME workaround for preventing kernel crash during ACS
++ * (i.e., link 0 is doing ACS while link 1 queries tsf)
++ */
++ for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
++ mconf = mconf_dereference_protected(mvif, i);
++ if (mconf)
++ break;
++ }
++ if (mconf)
++ ret = __mt7996_get_tsf(hw, mconf);
+ mutex_unlock(&dev->mt76.mutex);
+
+ return ret;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0164-mtk-mt76-add-debugfs-for-tx-drop-counters.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0164-mtk-mt76-add-debugfs-for-tx-drop-counters.patch
new file mode 100644
index 0000000..af71cc8
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0164-mtk-mt76-add-debugfs-for-tx-drop-counters.patch
@@ -0,0 +1,401 @@
+From a56b55265b3e813f7b803b242094a9a9a77cd3a4 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Thu, 13 Jun 2024 17:47:13 +0800
+Subject: [PATCH 164/199] mtk: mt76: add debugfs for tx drop counters
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ dma.c | 22 +++++++++---
+ mac80211.c | 2 ++
+ mt76.h | 27 +++++++++++++++
+ mt7996/mac.c | 20 ++++++++---
+ mt7996/main.c | 10 ++++--
+ mt7996/mtk_debugfs.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
+ tx.c | 12 +++++++
+ 7 files changed, 161 insertions(+), 12 deletions(-)
+
+diff --git a/dma.c b/dma.c
+index 3f1fb6c2..0dae40e2 100644
+--- a/dma.c
++++ b/dma.c
+@@ -612,12 +612,16 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
+ dma_addr_t addr;
+ u8 *txwi;
+
+- if (test_bit(MT76_RESET, &phy->state))
++ if (test_bit(MT76_RESET, &phy->state)) {
++ phy->tx_dbg_stats.tx_drop[MT_TX_DROP_RESET_STATE]++;
+ goto free_skb;
++ }
+
+ t = mt76_get_txwi(dev);
+- if (!t)
++ if (!t) {
++ dev->tx_dbg_stats.tx_drop[MT_TX_DROP_GET_TXWI_FAIL]++;
+ goto free_skb;
++ }
+
+ txwi = mt76_get_txwi_ptr(dev, t);
+
+@@ -627,8 +631,10 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
+
+ len = skb_headlen(skb);
+ addr = dma_map_single(dev->dma_dev, skb->data, len, DMA_TO_DEVICE);
+- if (unlikely(dma_mapping_error(dev->dma_dev, addr)))
++ if (unlikely(dma_mapping_error(dev->dma_dev, addr))) {
++ dev->tx_dbg_stats.tx_drop[MT_TX_DROP_DMA_FAIL]++;
+ goto free;
++ }
+
+ tx_info.buf[n].addr = t->dma_addr;
+ tx_info.buf[n++].len = dev->drv->txwi_size;
+@@ -636,13 +642,17 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
+ tx_info.buf[n++].len = len;
+
+ skb_walk_frags(skb, iter) {
+- if (n == ARRAY_SIZE(tx_info.buf))
++ if (n == ARRAY_SIZE(tx_info.buf)) {
++ dev->tx_dbg_stats.tx_drop[MT_TX_DROP_AGG_EXCEEDED]++;
+ goto unmap;
++ }
+
+ addr = dma_map_single(dev->dma_dev, iter->data, iter->len,
+ DMA_TO_DEVICE);
+- if (unlikely(dma_mapping_error(dev->dma_dev, addr)))
++ if (unlikely(dma_mapping_error(dev->dma_dev, addr))) {
++ dev->tx_dbg_stats.tx_drop[MT_TX_DROP_DMA_FAIL]++;
+ goto unmap;
++ }
+
+ tx_info.buf[n].addr = addr;
+ tx_info.buf[n++].len = iter->len;
+@@ -651,6 +661,7 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
+
+ if (q->queued + (tx_info.nbuf + 1) / 2 >= q->ndesc - 1) {
+ ret = -ENOMEM;
++ phy->tx_dbg_stats.tx_drop[MT_TX_DROP_RING_FULL]++;
+ goto unmap;
+ }
+
+@@ -662,6 +673,7 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
+ if (ret < 0)
+ goto unmap;
+
++ phy->tx_dbg_stats.tx_to_hw++;
+ return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
+ tx_info.info, tx_info.skb, t);
+
+diff --git a/mac80211.c b/mac80211.c
+index 10267019..5402366e 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -417,6 +417,7 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw)
+
+ INIT_LIST_HEAD(&phy->tx_list);
+ spin_lock_init(&phy->tx_lock);
++ spin_lock_init(&phy->tx_dbg_stats.lock);
+
+ SET_IEEE80211_DEV(hw, dev->dev);
+ SET_IEEE80211_PERM_ADDR(hw, phy->macaddr);
+@@ -597,6 +598,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
+ spin_lock_init(&dev->lock);
+ spin_lock_init(&dev->cc_lock);
+ spin_lock_init(&dev->status_lock);
++ spin_lock_init(&dev->tx_dbg_stats.lock);
+ mutex_init(&dev->mutex);
+ init_waitqueue_head(&dev->tx_wait);
+
+diff --git a/mt76.h b/mt76.h
+index 728740ef..ee118ee5 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -835,6 +835,31 @@ struct mt76_vif {
+ struct ieee80211_chanctx_conf *ctx;
+ };
+
++enum {
++ MT_TX_DROP_IN_TESTMODE,
++ MT_TX_DROP_WCID_NOT_INIT,
++ MT_TX_DROP_STOPPED_QUEUE,
++ MT_TX_DROP_RESET_STATE,
++ MT_TX_DROP_GET_TXWI_FAIL,
++ MT_TX_DROP_DMA_FAIL,
++ MT_TX_DROP_AGG_EXCEEDED,
++ MT_TX_DROP_RING_FULL,
++ MT_TX_DROP_INVALID_SKB,
++ MT_TX_DROP_GET_TOKEN_FAIL,
++ MT_TX_DROP_ADDR_TRANS_FAIL,
++ MT_TX_DROP_INVALID_WCID,
++ MT_TX_DROP_INVALID_LINK,
++ MT_TX_DROP_MAX,
++};
++
++struct mt76_tx_debug {
++ u32 tx_from_mac80211;
++ u32 tx_to_hw;
++
++ u32 tx_drop[MT_TX_DROP_MAX];
++ spinlock_t lock;
++};
++
+ struct mt76_phy {
+ struct ieee80211_hw *hw;
+ struct ieee80211_hw *ori_hw;
+@@ -891,6 +916,7 @@ struct mt76_phy {
+ bool al;
+ u8 pin;
+ } leds;
++ struct mt76_tx_debug tx_dbg_stats;
+ };
+
+ struct mt76_dev {
+@@ -995,6 +1021,7 @@ struct mt76_dev {
+ };
+
+ const char *bin_file_name;
++ struct mt76_tx_debug tx_dbg_stats;
+ };
+
+ #define MT76_MAX_AMSDU_NUM 8
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 017e3465..0f282f16 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -897,11 +897,15 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ u8 *txwi = (u8 *)txwi_ptr;
+ u8 link_id;
+
+- if (unlikely(tx_info->skb->len <= ETH_HLEN))
++ if (unlikely(tx_info->skb->len <= ETH_HLEN)) {
++ mdev->tx_dbg_stats.tx_drop[MT_TX_DROP_INVALID_SKB]++;
+ return -EINVAL;
++ }
+
+- if (WARN_ON(!wcid))
++ if (WARN_ON(!wcid)) {
++ mdev->tx_dbg_stats.tx_drop[MT_TX_DROP_INVALID_WCID]++;
+ return -EINVAL;
++ }
+
+ msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
+ if (ieee80211_is_data_qos(hdr->frame_control) && sta->mlo) {
+@@ -927,15 +931,19 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ }
+
+ mconf = rcu_dereference(mvif->link[wcid->link_id]);
+- if (!mconf)
++ if (!mconf) {
++ mdev->tx_dbg_stats.tx_drop[MT_TX_DROP_INVALID_LINK]++;
+ return -ENOLINK;
++ }
+
+ t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
+ t->skb = tx_info->skb;
+
+ id = mt76_token_consume(mdev, &t);
+- if (id < 0)
++ if (id < 0) {
++ mdev->tx_dbg_stats.tx_drop[MT_TX_DROP_GET_TOKEN_FAIL]++;
+ return id;
++ }
+ #ifdef CONFIG_MTK_DEBUG
+ t->jiffies = jiffies;
+ #endif
+@@ -957,8 +965,10 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+
+ conf = rcu_dereference(vif->link_conf[wcid->link_id]);
+ link_sta = rcu_dereference(sta->link[wcid->link_id]);
+- if (!conf || !link_sta)
++ if (!conf || !link_sta) {
++ mdev->tx_dbg_stats.tx_drop[MT_TX_DROP_INVALID_LINK]++;
+ return -ENOLINK;
++ }
+
+ dma_sync_single_for_cpu(mdev->dma_dev, tx_info->buf[1].addr,
+ tx_info->buf[1].len, DMA_TO_DEVICE);
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 443b3962..553345e8 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1423,11 +1423,13 @@ static void mt7996_tx(struct ieee80211_hw *hw,
+ struct sk_buff *skb)
+ {
+ struct mt76_phy *mphy;
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_vif *vif = info->control.vif;
+ struct mt76_wcid *wcid;
+ struct mt7996_vif *mvif;
+ struct mt7996_sta *msta;
++ bool addr_trans_success = false;
+
+ if (control->sta) {
+ msta = (struct mt7996_sta *)control->sta->drv_priv;
+@@ -1499,14 +1501,18 @@ static void mt7996_tx(struct ieee80211_hw *hw,
+ mphy = mconf->phy->mt76;
+ wcid = &mlink->wcid;
+ } else {
+- struct mt7996_dev *dev = mt7996_hw_dev(hw);
+-
+ mphy = hw->priv;
+ wcid = &dev->mt76.global_wcid;
+ }
+
++ addr_trans_success = true;
+ mt76_tx(mphy, control->sta, wcid, skb);
+ unlock:
++ if (!addr_trans_success) {
++ spin_lock_bh(&dev->mt76.tx_dbg_stats.lock);
++ dev->mt76.tx_dbg_stats.tx_drop[MT_TX_DROP_ADDR_TRANS_FAIL]++;
++ spin_unlock_bh(&dev->mt76.tx_dbg_stats.lock);
++ }
+ rcu_read_unlock();
+ }
+
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index 9bd35c91..759b9d8f 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -4163,6 +4163,83 @@ out:
+ return ret;
+ }
+
++static int
++mt7996_tx_drop_show(struct seq_file *s, void *data)
++{
++ struct mt7996_dev *dev = s->private;
++ struct mt76_dev *mdev = &dev->mt76;
++ struct mt76_tx_debug *dev_stats = &mdev->tx_dbg_stats;
++ struct mt76_tx_debug *phy_stats[__MT_MAX_BAND];
++ int i = 0;
++
++ seq_printf(s, "\t\t\t\t dev");
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ seq_printf(s, " Band%d", i);
++ if (mdev->phys[i]) {
++ phy_stats[i] = &mdev->phys[i]->tx_dbg_stats;
++ } else {
++ phy_stats[i] = kzalloc(sizeof(struct mt76_tx_debug),
++ GFP_KERNEL);
++ if (!phy_stats[i])
++ goto out;
++ }
++
++ }
++ seq_printf(s, " total\n");
++
++ seq_printf(s, "%-30s%12d%12d%12d%12d%12d\n", "Receive from mac80211",
++ dev_stats->tx_from_mac80211,
++ phy_stats[0]->tx_from_mac80211,
++ phy_stats[1]->tx_from_mac80211,
++ phy_stats[2]->tx_from_mac80211,
++ dev_stats->tx_from_mac80211 +
++ phy_stats[0]->tx_from_mac80211 +
++ phy_stats[1]->tx_from_mac80211 +
++ phy_stats[2]->tx_from_mac80211);
++ seq_printf(s, "%-30s%12d%12d%12d%12d%12d\n\n", "Send to hw",
++ dev_stats->tx_to_hw,
++ phy_stats[0]->tx_to_hw,
++ phy_stats[1]->tx_to_hw,
++ phy_stats[2]->tx_to_hw,
++ dev_stats->tx_to_hw +
++ phy_stats[0]->tx_to_hw +
++ phy_stats[1]->tx_to_hw +
++ phy_stats[2]->tx_to_hw);
++#define __pr(t) seq_printf(s, "Drop due to %-18s%12d%12d%12d%12d%12d\n",\
++ #t, dev_stats->tx_drop[MT_TX_DROP_##t], \
++ phy_stats[0]->tx_drop[MT_TX_DROP_##t], \
++ phy_stats[1]->tx_drop[MT_TX_DROP_##t], \
++ phy_stats[2]->tx_drop[MT_TX_DROP_##t], \
++ dev_stats->tx_drop[MT_TX_DROP_##t] + \
++ phy_stats[0]->tx_drop[MT_TX_DROP_##t] + \
++ phy_stats[1]->tx_drop[MT_TX_DROP_##t] + \
++ phy_stats[2]->tx_drop[MT_TX_DROP_##t])
++
++ __pr(IN_TESTMODE);
++ __pr(WCID_NOT_INIT);
++ __pr(STOPPED_QUEUE);
++ __pr(RESET_STATE);
++ __pr(GET_TXWI_FAIL);
++ __pr(DMA_FAIL);
++ __pr(AGG_EXCEEDED);
++ __pr(RING_FULL);
++ __pr(INVALID_SKB);
++ __pr(GET_TOKEN_FAIL);
++ __pr(ADDR_TRANS_FAIL);
++ __pr(INVALID_WCID);
++ __pr(INVALID_LINK);
++
++#undef __pr
++out:
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ if (!mdev->phys[i] && phy_stats[i])
++ kfree(phy_stats[i]);
++ }
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_tx_drop);
++
+ /* DRR */
+ static int
+ mt7996_drr_info(struct seq_file *s, void *data)
+@@ -4288,6 +4365,9 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+ /* amsdu */
+ debugfs_create_file("amsdu_algo", 0600, dir, dev, &fops_amsdu_algo);
+ debugfs_create_file("amsdu_para", 0600, dir, dev, &fops_amsdu_para);
++
++ /* Drop counters */
++ debugfs_create_file("tx_drop_stats", 0400, dir, dev, &mt7996_tx_drop_fops);
+ }
+
+ #endif
+diff --git a/tx.c b/tx.c
+index 6580833e..5e6e433f 100644
+--- a/tx.c
++++ b/tx.c
+@@ -331,8 +331,14 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
+ {
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+
++ spin_lock_bh(&phy->tx_dbg_stats.lock);
++ phy->tx_dbg_stats.tx_from_mac80211++;
++ spin_unlock_bh(&phy->tx_dbg_stats.lock);
+ if (mt76_testmode_enabled(phy)) {
+ ieee80211_free_txskb(phy->hw, skb);
++ spin_lock_bh(&phy->tx_dbg_stats.lock);
++ phy->tx_dbg_stats.tx_drop[MT_TX_DROP_IN_TESTMODE]++;
++ spin_unlock_bh(&phy->tx_dbg_stats.lock);
+ return;
+ }
+
+@@ -349,6 +355,9 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
+ dev_warn(phy->dev->dev, "Un-initialized STA %pM wcid %d in mt76_tx\n",
+ sta->addr, wcid->idx);
+
++ spin_lock_bh(&phy->tx_dbg_stats.lock);
++ phy->tx_dbg_stats.tx_drop[MT_TX_DROP_WCID_NOT_INIT]++;
++ spin_unlock_bh(&phy->tx_dbg_stats.lock);
+ ieee80211_free_txskb(phy->hw, skb);
+ return;
+ }
+@@ -380,6 +389,8 @@ mt76_txq_dequeue(struct mt76_phy *phy, struct mt76_txq *mtxq)
+ info = IEEE80211_SKB_CB(skb);
+ info->hw_queue |= FIELD_PREP(MT_TX_HW_QUEUE_PHY, phy->band_idx);
+
++ phy->dev->tx_dbg_stats.tx_from_mac80211++;
++
+ return skb;
+ }
+
+@@ -617,6 +628,7 @@ mt76_txq_schedule_pending_wcid(struct mt76_phy *phy, struct mt76_wcid *wcid)
+ q = phy->q_tx[qid];
+ if (mt76_txq_stopped(q)) {
+ ret = -1;
++ phy->tx_dbg_stats.tx_drop[MT_TX_DROP_STOPPED_QUEUE]++;
+ break;
+ }
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0165-mtk-mt76-add-debugfs-for-rx-drop-counters.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0165-mtk-mt76-add-debugfs-for-rx-drop-counters.patch
new file mode 100644
index 0000000..925e4bd
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0165-mtk-mt76-add-debugfs-for-rx-drop-counters.patch
@@ -0,0 +1,499 @@
+From 99a027c431faf039052d0d157807469231f037dc Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Thu, 23 May 2024 02:33:47 +0800
+Subject: [PATCH 165/199] mtk: mt76: add debugfs for rx drop counters
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ agg-rx.c | 9 +++++
+ dma.c | 40 +++++++++++++++++-----
+ dma.h | 14 ++++----
+ mac80211.c | 15 ++++++++-
+ mt76.h | 39 ++++++++++++++++++++++
+ mt7996/mac.c | 13 ++++++++
+ mt7996/mtk_debugfs.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
+ 7 files changed, 193 insertions(+), 16 deletions(-)
+
+diff --git a/agg-rx.c b/agg-rx.c
+index b48943c4..9875baa8 100644
+--- a/agg-rx.c
++++ b/agg-rx.c
+@@ -152,6 +152,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
+ struct mt76_wcid *wcid = status->wcid;
+ struct ieee80211_sta *sta;
+ struct mt76_rx_tid *tid;
++ struct mt76_phy *phy;
+ bool sn_less;
+ u16 seqno, head, size, idx;
+ u8 tidno = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK;
+@@ -178,6 +179,8 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
+ if (!tid)
+ return;
+
++ phy = mt76_dev_phy(tid->dev, wcid->phy_idx);
++
+ status->flag |= RX_FLAG_DUP_VALIDATED;
+ spin_lock_bh(&tid->lock);
+
+@@ -200,6 +203,9 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
+ if (sn_less) {
+ __skb_unlink(skb, frames);
+ dev_kfree_skb(skb);
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_drop[MT_RX_DROP_AGG_SN_LESS]++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
+ goto out;
+ }
+
+@@ -226,6 +232,9 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
+ /* Discard if the current slot is already in use */
+ if (tid->reorder_buf[idx]) {
+ dev_kfree_skb(skb);
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_drop[MT_RX_DROP_AGG_DUP]++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
+ goto out;
+ }
+
+diff --git a/dma.c b/dma.c
+index 0dae40e2..81e76191 100644
+--- a/dma.c
++++ b/dma.c
+@@ -251,13 +251,16 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ if (mt76_queue_is_wed_rx(q)) {
+ if (!rxwi) {
+ rxwi = mt76_get_rxwi(dev);
+- if (!rxwi)
++ if (!rxwi) {
++ q->rx_drop[MT_RX_DROP_DMAD_GET_RXWI_FAIL]++;
+ return -ENOMEM;
++ }
+ }
+
+ rx_token = mt76_rx_token_consume(dev, data, rxwi, buf->addr);
+ if (rx_token < 0) {
+ mt76_put_rxwi(dev, rxwi);
++ q->rx_drop[MT_RX_DROP_DMAD_GET_TOKEN_FAIL]++;
+ return -ENOMEM;
+ }
+
+@@ -428,6 +431,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ struct mt76_desc *desc = &q->desc[idx];
+ u32 ctrl, desc_info, buf1;
+ void *buf = e->buf;
++ int reason;
+
+ if (mt76_queue_is_wed_rro_ind(q))
+ goto done;
+@@ -443,7 +447,9 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ *info = desc_info;
+
+ buf1 = le32_to_cpu(desc->buf1);
+- mt76_dma_should_drop_buf(drop, ctrl, buf1, desc_info);
++ reason = mt76_dma_should_drop_buf(drop, ctrl, buf1, desc_info);
++ if (drop && *drop && reason >= 0)
++ q->rx_drop[reason]++;
+
+ if (mt76_queue_is_wed_rx(q)) {
+ u32 id, find = 0;
+@@ -467,13 +473,17 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ }
+
+ spin_unlock_bh(&dev->rx_token_lock);
+- if (!find)
++ if (!find) {
++ q->rx_drop[MT_RX_DROP_DMAD_ADDR_NOT_FOUND]++;
+ return NULL;
++ }
+ }
+
+ r = mt76_rx_token_release(dev, token);
+- if (!r)
++ if (!r) {
++ q->rx_drop[MT_RX_DROP_DMAD_TOKEN_NOT_FOUND]++;
+ return NULL;
++ }
+
+ dma_unmap_single(dev->dma_dev, r->dma_addr,
+ SKB_WITH_OVERHEAD(q->buf_size),
+@@ -489,8 +499,10 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ struct mt76_queue_buf qbuf;
+
+ buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32);
+- if (!buf)
++ if (!buf) {
++ q->rx_drop[MT_RX_DROP_DMAD_NOMEM]++;
+ return NULL;
++ }
+
+ memcpy(buf, r->ptr, SKB_WITH_OVERHEAD(q->buf_size));
+
+@@ -500,6 +512,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ if (unlikely(dma_mapping_error(dev->dma_dev, r->dma_addr))) {
+ skb_free_frag(r->ptr);
+ mt76_put_rxwi(dev, r);
++ q->rx_drop[MT_RX_DROP_DMAD_DMA_MAPPING_FAIL]++;
+ return NULL;
+ }
+
+@@ -517,8 +530,11 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ }
+ }
+
+- if (drop)
++ if (drop) {
+ *drop |= !!(buf1 & MT_DMA_CTL_WO_DROP);
++ if (buf1 & MT_DMA_CTL_WO_DROP)
++ q->rx_drop[MT_RX_DROP_DMAD_WO_FRAG]++;
++ }
+ } else {
+ dma_unmap_single(dev->dma_dev, e->dma_addr[0],
+ SKB_WITH_OVERHEAD(q->buf_size),
+@@ -892,6 +908,7 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
+
+ skb_add_rx_frag(skb, nr_frags, page, offset, len, q->buf_size);
+ } else {
++ q->rx_drop[MT_RX_DROP_FRAG]++;
+ skb_free_frag(data);
+ }
+
+@@ -899,10 +916,12 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
+ return;
+
+ q->rx_head = NULL;
+- if (nr_frags < ARRAY_SIZE(shinfo->frags))
++ if (nr_frags < ARRAY_SIZE(shinfo->frags)) {
+ dev->drv->rx_skb(dev, q - dev->q_rx, skb, &info);
+- else
++ } else {
++ q->rx_drop[MT_RX_DROP_FRAG]++;
+ dev_kfree_skb(skb);
++ }
+ }
+
+ static int
+@@ -947,6 +966,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+ data_len = SKB_WITH_OVERHEAD(q->buf_size);
+
+ if (data_len < len + q->buf_offset) {
++ q->rx_drop[MT_RX_DROP_FRAG]++;
+ dev_kfree_skb(q->rx_head);
+ q->rx_head = NULL;
+ goto free_frag;
+@@ -963,8 +983,10 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+ goto free_frag;
+
+ skb = build_skb(data, q->buf_size);
+- if (!skb)
++ if (!skb) {
++ q->rx_drop[MT_RX_DROP_BUILD_SKB_FAIL]++;
+ goto free_frag;
++ }
+
+ skb_reserve(skb, q->buf_offset);
+
+diff --git a/dma.h b/dma.h
+index 3a8c2e55..718122d5 100644
+--- a/dma.h
++++ b/dma.h
+@@ -93,27 +93,29 @@ mt76_dma_reset_tx_queue(struct mt76_dev *dev, struct mt76_queue *q)
+ mt76_wed_dma_setup(dev, q, true);
+ }
+
+-static inline void
++static inline int
+ mt76_dma_should_drop_buf(bool *drop, u32 ctrl, u32 buf1, u32 info)
+ {
+ if (!drop)
+- return;
++ return -1;
+
+ *drop = !!(ctrl & (MT_DMA_CTL_TO_HOST_A | MT_DMA_CTL_DROP));
+ if (!(ctrl & MT_DMA_CTL_VER_MASK))
+- return;
++ return MT_RX_DROP_DMAD_WO_DROP;
+
+ switch (FIELD_GET(MT_DMA_WED_IND_REASON, buf1)) {
+ case MT_DMA_WED_IND_REASON_REPEAT:
+ *drop = true;
+- break;
++ return MT_RX_DROP_DMAD_RRO_REPEAT;
+ case MT_DMA_WED_IND_REASON_OLDPKT:
+ *drop = !(info & MT_DMA_INFO_DMA_FRAG);
+- break;
++ return MT_RX_DROP_DMAD_RRO_OLDPKT;
+ default:
+ *drop = !!(ctrl & MT_DMA_CTL_PN_CHK_FAIL);
+- break;
++ return MT_RX_DROP_DMAD_RRO_PN_CHK_FAIL;
+ }
++
++ return -1;
+ }
+
+ #endif
+diff --git a/mac80211.c b/mac80211.c
+index 5402366e..d5f842db 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -418,6 +418,7 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw)
+ INIT_LIST_HEAD(&phy->tx_list);
+ spin_lock_init(&phy->tx_lock);
+ spin_lock_init(&phy->tx_dbg_stats.lock);
++ spin_lock_init(&phy->rx_dbg_stats.lock);
+
+ SET_IEEE80211_DEV(hw, dev->dev);
+ SET_IEEE80211_PERM_ADDR(hw, phy->macaddr);
+@@ -755,6 +756,9 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
+ }
+
+ if (ether_addr_equal(skb->data + offset, rfc1042_header)) {
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_drop[MT_RX_DROP_RFC_PKT]++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
+ dev_kfree_skb(skb);
+ return;
+ }
+@@ -792,6 +796,9 @@ void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
+
+ if (!test_bit(MT76_STATE_RUNNING, &phy->state)) {
+ dev_kfree_skb(skb);
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_drop[MT_RX_DROP_STATE_ERR]++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
+ return;
+ }
+
+@@ -1055,6 +1062,7 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
+ {
+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
+ struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);
++ struct mt76_phy *phy;
+ struct mt76_rx_status mstat;
+
+ mstat = *((struct mt76_rx_status *)skb->cb);
+@@ -1101,7 +1109,12 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
+ }
+
+ *sta = wcid_to_sta(mstat.wcid);
+- *hw = mt76_main_hw(dev->phys[mstat.phy_idx]);
++ *hw = mt76_phy_hw(dev, mstat.phy_idx);
++
++ phy = mt76_dev_phy(dev, mstat.phy_idx);
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_to_mac80211++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
+ }
+
+ static void
+diff --git a/mt76.h b/mt76.h
+index ee118ee5..f2d12b89 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -187,6 +187,34 @@ enum mt76_dfs_state {
+ MT_DFS_STATE_ACTIVE,
+ };
+
++enum {
++ /* Per dev counters*/
++ MT_RX_DROP_DMAD_RRO_REPEAT,
++ MT_RX_DROP_DMAD_RRO_OLDPKT,
++ MT_RX_DROP_DMAD_RRO_PN_CHK_FAIL,
++ MT_RX_DROP_DMAD_WO_FRAG,
++ MT_RX_DROP_DMAD_WO_DROP,
++ MT_RX_DROP_DMAD_ADDR_NOT_FOUND,
++ MT_RX_DROP_DMAD_TOKEN_NOT_FOUND,
++ MT_RX_DROP_DMAD_GET_TOKEN_FAIL,
++ MT_RX_DROP_DMAD_GET_RXWI_FAIL,
++ MT_RX_DROP_DMAD_NOMEM,
++ MT_RX_DROP_DMAD_DMA_MAPPING_FAIL,
++ MT_RX_DROP_FRAG,
++ MT_RX_DROP_BUILD_SKB_FAIL,
++
++ MT_RX_DROP_PER_Q_MAX,
++
++ /* Per phy counters */
++ MT_RX_DROP_RXD_ERR = 0,
++ MT_RX_DROP_STATE_ERR,
++ MT_RX_DROP_RFC_PKT,
++ MT_RX_DROP_AGG_SN_LESS,
++ MT_RX_DROP_AGG_DUP,
++
++ MT_RX_DROP_PER_PHY_MAX,
++};
++
+ struct mt76_queue_buf {
+ dma_addr_t addr;
+ u16 len:15,
+@@ -255,6 +283,8 @@ struct mt76_queue {
+ dma_addr_t desc_dma;
+ struct sk_buff *rx_head;
+ struct page_frag_cache rx_page;
++
++ u32 rx_drop[MT_RX_DROP_PER_Q_MAX];
+ };
+
+ struct mt76_mcu_ops {
+@@ -860,6 +890,14 @@ struct mt76_tx_debug {
+ spinlock_t lock;
+ };
+
++struct mt76_rx_debug {
++ u32 rx_from_hw;
++ u32 rx_to_mac80211;
++
++ u32 rx_drop[MT_RX_DROP_PER_PHY_MAX];
++ spinlock_t lock;
++};
++
+ struct mt76_phy {
+ struct ieee80211_hw *hw;
+ struct ieee80211_hw *ori_hw;
+@@ -917,6 +955,7 @@ struct mt76_phy {
+ u8 pin;
+ } leds;
+ struct mt76_tx_debug tx_dbg_stats;
++ struct mt76_rx_debug rx_dbg_stats;
+ };
+
+ struct mt76_dev {
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 0f282f16..2f37d31c 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1410,9 +1410,11 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+ struct sk_buff *skb, u32 *info)
+ {
+ struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
++ struct mt76_phy *phy;
+ __le32 *rxd = (__le32 *)skb->data;
+ __le32 *end = (__le32 *)&skb->data[skb->len];
+ enum rx_pkt_type type;
++ u8 band_idx;
+
+ type = le32_get_bits(rxd[0], MT_RXD0_PKT_TYPE);
+ if (type != PKT_TYPE_NORMAL) {
+@@ -1447,12 +1449,23 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+ dev_kfree_skb(skb);
+ break;
+ case PKT_TYPE_NORMAL:
++ band_idx = le32_get_bits(rxd[1], MT_RXD1_NORMAL_BAND_IDX);
++ phy = mt76_dev_phy(mdev, band_idx);
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_from_hw++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
++
+ if (!mt7996_mac_fill_rx(dev, q, skb, info)) {
+ mt76_rx(&dev->mt76, q, skb);
+ return;
+ }
+ fallthrough;
+ default:
++ band_idx = le32_get_bits(rxd[1], MT_RXD1_NORMAL_BAND_IDX);
++ phy = mt76_dev_phy(mdev, band_idx);
++ spin_lock_bh(&phy->rx_dbg_stats.lock);
++ phy->rx_dbg_stats.rx_drop[MT_RX_DROP_RXD_ERR]++;
++ spin_unlock_bh(&phy->rx_dbg_stats.lock);
+ dev_kfree_skb(skb);
+ break;
+ }
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index 759b9d8f..b16ea5fe 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -4240,6 +4240,84 @@ out:
+ }
+ DEFINE_SHOW_ATTRIBUTE(mt7996_tx_drop);
+
++static int
++mt7996_rx_drop_show(struct seq_file *s, void *data)
++{
++ struct mt7996_dev *dev = s->private;
++ struct mt76_dev *mdev = &dev->mt76;
++ struct mt76_rx_debug *stats[__MT_MAX_BAND];
++ struct mt76_queue *q[2];
++ int i = 0;
++
++ q[0] = &mdev->q_rx[MT_RXQ_MAIN];
++ q[1] = is_mt7996(mdev) ? &mdev->q_rx[MT_RXQ_BAND2] :
++ &mdev->q_rx[MT_RXQ_BAND1];
++
++ seq_printf(s, "\t\t\t\t ");
++ for (i = 0; i < 2; i++) {
++ seq_printf(s, " RXQ%d", q[i]->hw_idx);
++ }
++ seq_printf(s, "\n");
++
++#define __pr(t) seq_printf(s, "Drop due to %-22s%12d%12d\n", #t, \
++ q[0]->rx_drop[MT_RX_DROP_##t], \
++ q[1]->rx_drop[MT_RX_DROP_##t]);
++ __pr(DMAD_RRO_REPEAT);
++ __pr(DMAD_RRO_OLDPKT);
++ __pr(DMAD_RRO_PN_CHK_FAIL);
++ __pr(DMAD_WO_FRAG);
++ __pr(DMAD_WO_DROP);
++ __pr(DMAD_ADDR_NOT_FOUND);
++ __pr(DMAD_TOKEN_NOT_FOUND);
++ __pr(DMAD_GET_TOKEN_FAIL);
++ __pr(DMAD_GET_RXWI_FAIL);
++ __pr(DMAD_NOMEM);
++ __pr(DMAD_DMA_MAPPING_FAIL);
++ __pr(FRAG);
++ __pr(BUILD_SKB_FAIL);
++#undef __pr
++
++ seq_printf(s, "\n\t\t\t\t ");
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ seq_printf(s, " Band%d", i);
++ if (mdev->phys[i]) {
++ stats[i] = &mdev->phys[i]->rx_dbg_stats;
++ } else {
++ stats[i] = kzalloc(sizeof(struct mt76_rx_debug),
++ GFP_KERNEL);
++ if (!stats[i])
++ goto out;
++ }
++ }
++ seq_printf(s, "\n");
++ seq_printf(s, "%-35s%12d%12d%12d\n", "Receive from hw",
++ stats[MT_BAND0]->rx_from_hw,
++ stats[MT_BAND1]->rx_from_hw,
++ stats[MT_BAND2]->rx_from_hw);
++ seq_printf(s, "%-35s%12d%12d%12d\n\n", "Send to mac80211",
++ stats[MT_BAND0]->rx_to_mac80211,
++ stats[MT_BAND1]->rx_to_mac80211,
++ stats[MT_BAND2]->rx_to_mac80211);
++#define __pr(t) seq_printf(s, "Drop due to %-22s%12d%12d%12d\n", #t, \
++ stats[MT_BAND0]->rx_drop[MT_RX_DROP_##t], \
++ stats[MT_BAND1]->rx_drop[MT_RX_DROP_##t], \
++ stats[MT_BAND2]->rx_drop[MT_RX_DROP_##t])
++ __pr(RXD_ERR);
++ __pr(STATE_ERR);
++ __pr(RFC_PKT);
++ __pr(AGG_SN_LESS);
++ __pr(AGG_DUP);
++#undef __pr
++
++out:
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ if (!mdev->phys[i] && stats[i])
++ kfree(stats[i]);
++ }
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_rx_drop);
+ /* DRR */
+ static int
+ mt7996_drr_info(struct seq_file *s, void *data)
+@@ -4368,6 +4446,7 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+
+ /* Drop counters */
+ debugfs_create_file("tx_drop_stats", 0400, dir, dev, &mt7996_tx_drop_fops);
++ debugfs_create_file("rx_drop_stats", 0400, dir, dev, &mt7996_rx_drop_fops);
+ }
+
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0166-mtk-mt76-mt7996-add-support-for-remain-on-channel-op.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0166-mtk-mt76-mt7996-add-support-for-remain-on-channel-op.patch
new file mode 100644
index 0000000..000a95f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0166-mtk-mt76-mt7996-add-support-for-remain-on-channel-op.patch
@@ -0,0 +1,308 @@
+From 17fa174e1a5da3fc24454f6b5e4e014b93b0165d Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 7 Jun 2024 15:24:00 +0800
+Subject: [PATCH 166/199] mtk: mt76: mt7996: add support for remain-on-channel
+ operation
+
+Remain-on-channel operation allows interface to temporarily leave the
+operating channel and go to another channel for listening or TX skbs.
+It is not allowed to conduct a scan and a remain-on-channel at the same
+time, since they both require a bss/link to jump to another channel.
+
+The constrains for interfaces about remain-on-channel operation:
+1. The legacy interfaces can only remain on channels that is in the same
+ band with the original channel.
+2. The MLD AP can only remain on channels that in the same band with one
+ of its operating links.
+3. The MLd STA can remain on full-band channels even if it does not have
+ connection on that band. In such case, the default link is used.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/init.c | 4 ++
+ mt7996/main.c | 174 +++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/mt7996.h | 5 ++
+ 3 files changed, 181 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 55eb32cb..5f38374f 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -498,6 +498,8 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+ wiphy->max_scan_ssids = 4;
+ wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
+
++ wiphy->max_remain_on_channel_duration = 5000;
++
+ /* enable MLO support */
+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
+ wiphy->iftype_ext_capab = mt7996_iftypes_ext_capa;
+@@ -740,6 +742,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+
+ INIT_DELAYED_WORK(&mphy->mac_work, mt7996_mac_work);
+ INIT_DELAYED_WORK(&phy->scan_work, mt7996_scan_work);
++ INIT_DELAYED_WORK(&phy->roc_complete_work, mt7996_roc_complete_work);
+
+ ret = mt7996_eeprom_parse_hw_cap(dev, phy);
+ if (ret)
+@@ -1676,6 +1679,7 @@ int mt7996_register_device(struct mt7996_dev *dev)
+ INIT_WORK(&dev->rc_work, mt7996_mac_sta_rc_work);
+ INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7996_mac_work);
+ INIT_DELAYED_WORK(&dev->phy.scan_work, mt7996_scan_work);
++ INIT_DELAYED_WORK(&dev->phy.roc_complete_work, mt7996_roc_complete_work);
+ INIT_DELAYED_WORK(&dev->scs_work, mt7996_mcu_scs_sta_poll);
+ INIT_LIST_HEAD(&dev->sta_rc_list);
+ INIT_LIST_HEAD(&dev->twt_list);
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 553345e8..35a77609 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -505,6 +505,7 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+
+ cancel_delayed_work_sync(&phy->scan_work);
++ cancel_delayed_work_sync(&phy->roc_complete_work);
+ cancel_delayed_work(&mvif->beacon_mon_work);
+
+ mutex_lock(&dev->mt76.mutex);
+@@ -528,7 +529,7 @@ static void ___mt7996_set_channel(struct mt7996_phy *phy,
+ {
+ struct mt76_dev *mdev = phy->mt76->dev;
+ struct mt76_phy *mphy = phy->mt76;
+- bool offchannel = phy->scan_chan != NULL;
++ bool offchannel = phy->scan_chan != NULL || phy->roc_chan != NULL;
+ int timeout = HZ / 5;
+ unsigned long was_scanning = ieee80211_get_scanning(mphy->hw);
+
+@@ -2520,7 +2521,8 @@ mt7996_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+
+ mt76_vif_dbg(vif, "trigger scan on mt76 band %u\n", phy->mt76->band_idx);
+ mutex_lock(&phy->dev->mt76.mutex);
+- if (WARN_ON(phy->scan_req || phy->scan_chan)) {
++ if (WARN_ON(phy->scan_req || phy->scan_chan ||
++ test_bit(MT76_STATE_ROC, &phy->mt76->state))) {
+ mutex_unlock(&phy->dev->mt76.mutex);
+ return -EBUSY;
+ }
+@@ -2641,6 +2643,170 @@ mt7996_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+ }
+ }
+
++void mt7996_roc_complete_work(struct work_struct *work)
++{
++ struct cfg80211_chan_def *chandef;
++ struct ieee80211_vif *vif;
++ struct ieee80211_hw *hw;
++ struct mt7996_vif *mvif;
++ struct mt7996_phy *phy;
++ int i;
++
++ phy = container_of(work, struct mt7996_phy, roc_complete_work.work);
++ vif = phy->roc_vif;
++ mvif = (struct mt7996_vif *)vif->drv_priv;
++ hw = mvif->hw;
++
++ mutex_lock(&phy->dev->mt76.mutex);
++
++ if (!test_bit(MT76_STATE_ROC, &phy->mt76->state)) {
++ mutex_unlock(&phy->dev->mt76.mutex);
++ return;
++ }
++
++ phy->roc_vif = NULL;
++ phy->roc_chan = NULL;
++ clear_bit(MT76_STATE_ROC, &phy->mt76->state);
++
++ if (ieee80211_vif_is_mld(vif)) {
++ struct mt7996_bss_conf *mconf;
++
++ for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
++ mconf = mconf_dereference_protected(mvif, i);
++
++ if (mconf && mconf->phy == phy && mconf == &mvif->deflink) {
++ mt7996_remove_bss_conf(vif, &vif->bss_conf,
++ &mvif->deflink);
++ break;
++ }
++ }
++ }
++
++ mutex_unlock(&phy->dev->mt76.mutex);
++
++ chandef = phy->chanctx ? &phy->chanctx->chandef : &phy->mt76->chandef;
++ wiphy_info(hw->wiphy, "finish roc work, go back to freq=%u\n",
++ chandef->chan->center_freq);
++ mt7996_set_channel(phy, chandef);
++ ieee80211_remain_on_channel_expired(hw);
++}
++
++static int
++mt7996_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_channel *chan, int duration,
++ enum ieee80211_roc_type type)
++{
++ struct cfg80211_chan_def chandef = {};
++ struct mt7996_bss_conf *mconf;
++ struct mt7996_vif *mvif;
++ struct mt7996_phy *phy;
++ int ret;
++
++ if (!chan)
++ return -EINVAL;
++
++ phy = mt7996_band_phy(hw, chan->band);
++
++ if (!phy)
++ return -EINVAL;
++
++ mvif = (struct mt7996_vif *)vif->drv_priv;
++ mutex_lock(&phy->dev->mt76.mutex);
++
++ if (test_bit(MT76_STATE_ROC, &phy->mt76->state) ||
++ test_bit(MT76_SCANNING, &phy->mt76->state)) {
++ ret = -EBUSY;
++ goto error_unlock;
++ }
++
++ if (!ieee80211_vif_is_mld(vif)) {
++ mconf = mconf_dereference_protected(mvif, 0);
++ if (!mconf || mconf->phy != phy) {
++ ret = -EINVAL;
++ goto error_unlock;
++ }
++ } else {
++ unsigned long valid_links = vif->valid_links;
++ unsigned int link_id;
++ bool found = false;
++
++ for_each_set_bit(link_id, &valid_links,
++ IEEE80211_MLD_MAX_NUM_LINKS) {
++ mconf = mconf_dereference_protected(mvif, link_id);
++ if (mconf && mconf->phy == phy) {
++ found = true;
++ break;
++ }
++ }
++
++ if (!found) {
++ if (vif->type != NL80211_IFTYPE_STATION) {
++ ret = -ENOLINK;
++ goto error_unlock;
++ }
++
++ /* Try to find an empty link, which is later used to scan. */
++ for (link_id = 0;
++ link_id < IEEE80211_MLD_MAX_NUM_LINKS;
++ link_id++) {
++ if (!rcu_access_pointer(mvif->link[link_id]))
++ break;
++ }
++
++ if (link_id == IEEE80211_MLD_MAX_NUM_LINKS) {
++ ret = -ENOLINK;
++ goto error_unlock;
++ }
++
++ vif->bss_conf.link_id = link_id;
++ ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
++ if (ret)
++ goto error_unlock;
++ }
++
++ }
++ wiphy_info(hw->wiphy, "start roc work on freq=%u\n",
++ chan->center_freq);
++
++ set_bit(MT76_STATE_ROC, &phy->mt76->state);
++ phy->roc_vif = vif;
++ phy->roc_chan = chan;
++ mutex_unlock(&phy->dev->mt76.mutex);
++
++ cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20);
++ mt7996_set_channel(phy, &chandef);
++ ieee80211_ready_on_channel(hw);
++
++ ieee80211_queue_delayed_work(phy->mt76->hw, &phy->roc_complete_work,
++ msecs_to_jiffies(duration));
++
++ return 0;
++
++error_unlock:
++ mutex_unlock(&phy->dev->mt76.mutex);
++ return ret;
++}
++
++static int
++mt7996_cancel_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
++{
++ int band;
++ struct mt7996_phy *phy;
++
++ for (band = 0; band < NUM_NL80211_BANDS; band++) {
++ if (!hw->wiphy->bands[band])
++ continue;
++
++ phy = mt7996_band_phy(hw, band);
++ if (!phy || !test_bit(MT76_STATE_ROC, &phy->mt76->state))
++ continue;
++
++ cancel_delayed_work_sync(&phy->roc_complete_work);
++ ieee80211_queue_delayed_work(phy->mt76->hw, &phy->roc_complete_work, 0);
++ }
++ return 0;
++}
++
+ static int
+ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+ {
+@@ -2689,6 +2855,7 @@ mt7996_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+
+ mt76_dbg(hw, "remove %u\n", conf->def.chan->hw_value);
+ cancel_delayed_work_sync(&phy->scan_work);
++ cancel_delayed_work_sync(&phy->roc_complete_work);
+ cancel_delayed_work_sync(&phy->mt76->mac_work);
+
+ mutex_lock(&phy->dev->mt76.mutex);
+@@ -2774,6 +2941,7 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ mt76_vif_dbg(vif, "remove link %u from %d MHz\n",
+ link_conf->link_id, conf->def.chan->center_freq);
+ cancel_delayed_work_sync(&phy->scan_work);
++ cancel_delayed_work_sync(&phy->roc_complete_work);
+
+ mutex_lock(&phy->dev->mt76.mutex);
+
+@@ -3036,6 +3204,8 @@ const struct ieee80211_ops mt7996_ops = {
+ .wake_tx_queue = mt76_wake_tx_queue,
+ .hw_scan = mt7996_hw_scan,
+ .cancel_hw_scan = mt7996_cancel_hw_scan,
++ .remain_on_channel = mt7996_remain_on_channel,
++ .cancel_remain_on_channel = mt7996_cancel_remain_on_channel,
+ .release_buffered_frames = mt76_release_buffered_frames,
+ .get_txpower = mt7996_get_txpower,
+ .channel_switch_beacon = mt7996_channel_switch_beacon,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 42c1e287..3ee8156c 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -597,6 +597,10 @@ struct mt7996_phy {
+ struct mt7996_scs_ctrl scs_ctrl;
+ u32 red_drop;
+
++ struct delayed_work roc_complete_work;
++ struct ieee80211_vif *roc_vif;
++ struct ieee80211_channel *roc_chan;
++
+ bool sku_limit_en;
+ bool sku_path_en;
+
+@@ -1249,6 +1253,7 @@ bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len);
+ void mt7996_stats_work(struct work_struct *work);
+ void mt7996_scan_work(struct work_struct *work);
+ void mt7996_scan_complete(struct mt7996_phy *phy, bool aborted);
++void mt7996_roc_complete_work(struct work_struct *work);
+ void mt7996_beacon_mon_work(struct work_struct *work);
+ int mt76_dfs_start_rdd(struct mt7996_dev *dev, bool force);
+ int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0167-mtk-mt76-mt7996-rework-the-setting-flow-of-starec-RA.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0167-mtk-mt76-mt7996-rework-the-setting-flow-of-starec-RA.patch
new file mode 100644
index 0000000..29f9510
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0167-mtk-mt76-mt7996-rework-the-setting-flow-of-starec-RA.patch
@@ -0,0 +1,291 @@
+From 6b95665d9e183c522e051a18177afe8b91ea817c Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 26 Jun 2024 19:09:46 +0800
+Subject: [PATCH 167/199] mtk: mt76: mt7996: rework the setting flow of starec
+ RA and MLD tags
+
+1. STA_REC_RA and STA_REC_MLD tags need to be set when newly is true,
+ so that FW can correctly set non-setup link(s) to powersave mode when
+ the peer is a MLSR MLD STA. (reported by Peter)
+
+2. This patch also tries to fix random EAPOL timeout issue.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7996/main.c | 4 --
+ mt7996/mcu.c | 187 +++++++++++++++++++++---------------------------
+ mt7996/mcu.h | 3 +
+ mt7996/mt7996.h | 2 -
+ 4 files changed, 83 insertions(+), 113 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 35a77609..b5d45d19 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1318,10 +1318,6 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ mtxq->wcid = mlink->wcid.idx;
+ }
+
+- ret = mt7996_mcu_add_mld_sta(dev, vif, sta, add);
+- if (ret)
+- goto error;
+-
+ return 0;
+ error:
+ mt7996_mac_sta_remove_links(dev, vif, sta, add);
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 54295414..9b3c6e3d 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -2911,6 +2911,77 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ return mt7996_mcu_add_rate_ctrl_fixed(dev, conf, mconf, link_sta, mlink);
+ }
+
++static void
++mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
++ struct ieee80211_sta *sta, unsigned long valid_links)
++{
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct sta_rec_mld_setup *mld_setup;
++ struct mld_setup_link *mld_setup_link;
++ struct mt7996_link_sta *mlink;
++ struct mt7996_bss_conf *mconf;
++ struct tlv *tlv;
++ unsigned int link_id;
++ struct ieee80211_vif *vif = container_of((void *)msta->vif, struct ieee80211_vif,
++ drv_priv);
++
++ mlink = mlink_dereference_protected(msta, msta->pri_link);
++ if (!mlink)
++ return;
++
++ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MLD,
++ sizeof(*mld_setup) +
++ sizeof(struct mld_setup_link) *
++ hweight16(valid_links));
++
++ mld_setup = (struct sta_rec_mld_setup *)tlv;
++ memcpy(mld_setup->mld_addr, sta->addr, ETH_ALEN);
++ mld_setup->setup_wcid = cpu_to_le16(mlink->wcid.idx);
++ mld_setup->primary_id = cpu_to_le16(mlink->wcid.idx);
++ if (msta->sec_link != msta->pri_link) {
++ mlink = mlink_dereference_protected(msta, msta->sec_link);
++ if (!mlink)
++ return;
++ }
++ mld_setup->seconed_id = cpu_to_le16(mlink->wcid.idx);
++ mld_setup->link_num = hweight16(valid_links);
++
++ mld_setup_link = (struct mld_setup_link *)mld_setup->link_info;
++ mt76_trace(vif, "STA %pM pri_link=%u, pri_wcid=%u, sec_link=%u, sec_wcid=%u\n",
++ sta->addr, msta->pri_link, le16_to_cpu(mld_setup->primary_id),
++ msta->sec_link, le16_to_cpu(mld_setup->seconed_id));
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ mlink = mlink_dereference_protected(msta, link_id);
++ mconf = mconf_dereference_protected(msta->vif, link_id);
++
++ mld_setup_link->wcid = cpu_to_le16(mlink->wcid.idx);
++ mld_setup_link->bss_idx = mconf->mt76.idx;
++ mt76_trace(vif, "link_id(%d) wcid(%d) bss_idx(%d)\n",
++ link_id, mld_setup_link->wcid, mld_setup_link->bss_idx);
++ mld_setup_link++;
++ }
++}
++
++static void
++mt7996_mcu_sta_eht_mld_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
++ struct ieee80211_sta *sta)
++{
++ struct sta_rec_eht_mld *eht_mld;
++ struct tlv *tlv;
++ int i;
++
++ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT_MLD, sizeof(*eht_mld));
++ eht_mld = (struct sta_rec_eht_mld *)tlv;
++
++ for (i = 0; i < ARRAY_SIZE(eht_mld->str_cap); i++)
++ eht_mld->str_cap[i] = 0x7;
++
++ eht_mld->eml_cap = cpu_to_le16(sta->eml_capa);
++ /* TODO:
++ eht_mld->nsep = ;
++ */
++}
++
+ #if 0
+ static int
+ mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf,
+@@ -2978,6 +3049,8 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+
+ /* tag order is in accordance with firmware dependency. */
+ if (link_sta) {
++ struct ieee80211_sta *sta = link_sta->sta;
++
+ /* starec hdrt mode */
+ mt7996_mcu_sta_hdrt_tlv(dev, skb);
+ /* starec bfer */
+@@ -2987,7 +3060,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ /* starec vht */
+ mt7996_mcu_sta_vht_tlv(skb, link_sta);
+ /* starec uapsd */
+- mt76_connac_mcu_sta_uapsd(skb, vif, link_sta->sta);
++ mt76_connac_mcu_sta_uapsd(skb, vif, sta);
+ /* starec amsdu */
+ mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, link_sta, mlink);
+ /* starec he */
+@@ -3000,6 +3073,12 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ mt7996_mcu_sta_muru_tlv(dev, skb, conf, mconf, link_sta);
+ /* starec bfee */
+ mt7996_mcu_sta_bfee_tlv(dev, skb, conf, mconf, link_sta);
++
++ if (sta->mlo) {
++ /* starec mld setup */
++ mt7996_mcu_sta_mld_setup_tlv(dev, skb, sta, sta->valid_links);
++ mt7996_mcu_sta_eht_mld_tlv(dev, skb, sta);
++ }
+ }
+
+ #if 0
+@@ -3014,112 +3093,6 @@ out:
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+ }
+
+-static void
+-mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+- struct ieee80211_sta *sta)
+-{
+- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+- struct sta_rec_mld_setup *mld_setup;
+- struct mld_setup_link *mld_setup_link;
+- struct mt7996_link_sta *mlink;
+- struct mt7996_bss_conf *mconf;
+- struct tlv *tlv;
+- unsigned long valid_links = sta->valid_links;
+- unsigned int link_id;
+- struct ieee80211_vif *vif = container_of((void *)msta->vif, struct ieee80211_vif,
+- drv_priv);
+-
+- mlink = mlink_dereference_protected(msta, msta->pri_link);
+- if (!mlink)
+- return;
+-
+- tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MLD,
+- sizeof(*mld_setup) +
+- sizeof(struct mld_setup_link) *
+- hweight16(sta->valid_links));
+-
+- mld_setup = (struct sta_rec_mld_setup *)tlv;
+- memcpy(mld_setup->mld_addr, sta->addr, ETH_ALEN);
+- mld_setup->setup_wcid = cpu_to_le16(mlink->wcid.idx);
+- mld_setup->primary_id = cpu_to_le16(mlink->wcid.idx);
+- if (msta->sec_link != msta->pri_link) {
+- mlink = mlink_dereference_protected(msta, msta->sec_link);
+- if (!mlink)
+- return;
+- }
+- mld_setup->seconed_id = cpu_to_le16(mlink->wcid.idx);
+- mld_setup->link_num = hweight16(sta->valid_links);
+-
+- mld_setup_link = (struct mld_setup_link *)mld_setup->link_info;
+- mt76_trace(vif, "STA %pM pri_link=%u, pri_wcid=%u, sec_link=%u, sec_wcid=%u\n",
+- sta->addr, msta->pri_link, le16_to_cpu(mld_setup->primary_id),
+- msta->sec_link, le16_to_cpu(mld_setup->seconed_id));
+- for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+- mlink = mlink_dereference_protected(msta, link_id);
+- mconf = mconf_dereference_protected(msta->vif, link_id);
+-
+- mld_setup_link->wcid = cpu_to_le16(mlink->wcid.idx);
+- mld_setup_link->bss_idx = mconf->mt76.idx;
+- mt76_trace(vif, "link_id(%d) wcid(%d) bss_idx(%d)\n",
+- link_id, mld_setup_link->wcid, mld_setup_link->bss_idx);
+- mld_setup_link++;
+- }
+-}
+-
+-static void
+-mt7996_mcu_sta_eht_mld_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+- struct ieee80211_sta *sta)
+-{
+- struct sta_rec_eht_mld *eht_mld;
+- struct tlv *tlv;
+- int i;
+-
+- tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT_MLD, sizeof(*eht_mld));
+- eht_mld = (struct sta_rec_eht_mld *)tlv;
+-
+- for (i = 0; i < ARRAY_SIZE(eht_mld->str_cap); i++)
+- eht_mld->str_cap[i] = 0x7;
+-
+- eht_mld->eml_cap = cpu_to_le16(sta->eml_capa);
+- /* TODO:
+- eht_mld->nsep = ;
+- */
+-}
+-
+-int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+- struct ieee80211_sta *sta, unsigned long add)
+-{
+- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+- unsigned int link_id;
+-
+- if (!sta->mlo)
+- return 0;
+-
+- for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+- struct mt7996_bss_conf *mconf =
+- mconf_dereference_protected(mvif, link_id);
+- struct mt7996_link_sta *mlink =
+- mlink_dereference_protected(msta, link_id);
+- struct sk_buff *skb;
+- int ret;
+-
+- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
+- &mlink->wcid,
+- MT7996_STA_UPDATE_MAX_SIZE);
+- if (IS_ERR(skb))
+- return PTR_ERR(skb);
+- /* starec mld setup */
+- mt7996_mcu_sta_mld_setup_tlv(dev, skb, sta);
+- /* starec eht mld */
+- mt7996_mcu_sta_eht_mld_tlv(dev, skb, sta);
+- ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
+- MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+- if (ret)
+- return ret;
+- }
+- return 0;
+-}
+ int mt7996_mcu_teardown_mld_sta(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
+ struct mt7996_link_sta *mlink)
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 20eaf20d..05b29c90 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -983,6 +983,9 @@ enum {
+ sizeof(struct sta_rec_hdrt) + \
+ sizeof(struct sta_rec_hdr_trans) + \
+ sizeof(struct sta_rec_tx_cap) + \
++ sizeof(struct sta_rec_mld_setup) + \
++ sizeof(struct mld_setup_link) * 3 + \
++ sizeof(struct sta_rec_eht_mld) + \
+ sizeof(struct tlv))
+
+ #define MT7996_MAX_BEACON_SIZE 1338
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 3ee8156c..1e507b1c 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1083,8 +1083,6 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_link_sta *link_sta,
+ struct mt7996_link_sta *mlink, bool changed);
+-int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+- struct ieee80211_sta *sta, unsigned long add);
+ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef);
+ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag, bool sta);
+ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0168-mtk-mt76-mt7996-Fix-NULL-pointer-crash-when-mac-tx-f.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0168-mtk-mt76-mt7996-Fix-NULL-pointer-crash-when-mac-tx-f.patch
new file mode 100644
index 0000000..e14d128
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0168-mtk-mt76-mt7996-Fix-NULL-pointer-crash-when-mac-tx-f.patch
@@ -0,0 +1,27 @@
+From 8f1b477c5734b3e46dd8d6795c784ef58d553d74 Mon Sep 17 00:00:00 2001
+From: Bo Jiao <Bo.Jiao@mediatek.com>
+Date: Thu, 27 Jun 2024 14:54:38 +0800
+Subject: [PATCH 168/199] mtk: mt76: mt7996: Fix NULL pointer crash when mac tx
+ free with a msta that has been removed.
+
+Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
+---
+ mt7996/mac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 2f37d31c..12cc60cb 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1200,7 +1200,7 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+ struct mt7996_link_sta *mlink =
+ rcu_dereference(msta->link[link_id]);
+
+- if (list_empty(&mlink->wcid.poll_list))
++ if (mlink && list_empty(&mlink->wcid.poll_list))
+ list_add_tail(&mlink->wcid.poll_list, &mdev->sta_poll_list);
+ }
+ spin_unlock_bh(&mdev->sta_poll_lock);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0169-mtk-mt76-mt7996-update-adie-efuse-merge-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0169-mtk-mt76-mt7996-update-adie-efuse-merge-support.patch
new file mode 100644
index 0000000..8def00e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0169-mtk-mt76-mt7996-update-adie-efuse-merge-support.patch
@@ -0,0 +1,376 @@
+From a6bd94f22e1b58c4248e433889071b4e0bd1f283 Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Fri, 14 Jun 2024 10:14:31 +0800
+Subject: [PATCH 169/199] mtk: mt76: mt7996: update adie efuse merge support
+
+Refactor efuse merge due to FW supporting the efuse merge mcu command
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7996/eeprom.c | 144 -----------------------------------------
+ mt7996/mcu.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/mcu.h | 1 +
+ 3 files changed, 167 insertions(+), 145 deletions(-)
+
+diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
+index e8e1d85a..fb0f2953 100644
+--- a/mt7996/eeprom.c
++++ b/mt7996/eeprom.c
+@@ -531,146 +531,6 @@ fail:
+ return ret;
+ }
+
+-static int mt7996_apply_cal_free_data(struct mt7996_dev *dev)
+-{
+-#define MT_EE_CAL_FREE_MAX_SIZE 30
+-#define MT_EE_7977BN_OFFSET (0x1200 - 0x500)
+-#define MT_EE_END_OFFSET 0xffff
+- enum adie_type {
+- ADIE_7975,
+- ADIE_7976,
+- ADIE_7977,
+- ADIE_7978,
+- ADIE_7979,
+- };
+- static const u16 adie_offs_list[][MT_EE_CAL_FREE_MAX_SIZE] = {
+- [ADIE_7975] = {0x5cd, 0x5cf, 0x5d1, 0x5d3, 0x6c0, 0x6c1, 0x6c2, 0x6c3,
+- 0x7a1, 0x7a6, 0x7a8, 0x7aa, -1},
+- [ADIE_7976] = {0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x53, 0x55, 0x57, 0x59,
+- 0x70, 0x71, 0x790, 0x791, 0x794, 0x795, 0x7a6, 0x7a8, 0x7aa, -1},
+- [ADIE_7977] = {0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x53, 0x55, 0x57, 0x59,
+- 0x69, 0x6a, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, -1},
+- [ADIE_7978] = {0x91, 0x95, 0x100, 0x102, 0x104, 0x106, 0x107,
+- 0x108, 0x109, 0x10a, 0x10b, 0x10c, 0x10e, 0x110, -1},
+- [ADIE_7979] = {0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x53, 0x55, 0x57, 0x59,
+- 0x69, 0x6a, 0x7a, 0x7b, 0x7c, 0x7e, 0x80, -1},
+- };
+- static const u16 eep_offs_list[][MT_EE_CAL_FREE_MAX_SIZE] = {
+- [ADIE_7975] = {0x451, 0x453, 0x455, 0x457, 0x44c, 0x44d, 0x44e, 0x44f,
+- 0xba1, 0xba6, 0xba8, 0xbaa, -1},
+- [ADIE_7976] = {0x44c, 0x44d, 0x44e, 0x44f, 0x450,
+- 0x451, 0x453, 0x455, 0x457, 0x459,
+- 0x470, 0x471, 0xb90, 0xb91, 0xb94, 0xb95,
+- 0xba6, 0xba8, 0xbaa, -1},
+- [ADIE_7977] = {0x124c, 0x124d, 0x124e, 0x124f, 0x1250,
+- 0x1251, 0x1253, 0x1255, 0x1257, 0x1259,
+- 0x1269, 0x126a, 0x127a, 0x127b, 0x127c, 0x127d, 0x127e, -1},
+- [ADIE_7978] = {0xb91, 0xb95, 0x480, 0x482, 0x484, 0x486, 0x487, 0x488, 0x489,
+- 0x48a, 0x48b, 0x48c, 0x48e, 0x490, -1},
+- [ADIE_7979] = {0x124c, 0x124d, 0x124e, 0x124f, 0x1250, 0x1251,
+- 0x1253, 0x1255, 0x1257, 0x1259, 0x1269, 0x126a,
+- 0x127a, 0x127b, 0x127c, 0x127e, 0x1280, -1},
+- };
+- static const u16 adie_base_7996[] = {
+- 0x400, 0x1e00, 0x1200
+- };
+- static const u16 adie_base_7992[] = {
+- 0x400, 0x1200, 0x0
+- };
+- static const u16 *adie_offs[__MT_MAX_BAND];
+- static const u16 *eep_offs[__MT_MAX_BAND];
+- static const u16 *adie_base;
+- u8 *eeprom = dev->mt76.eeprom.data;
+- u8 buf[MT7996_EEPROM_BLOCK_SIZE];
+- int adie_id, band, i, ret;
+-
+- switch (mt76_chip(&dev->mt76)) {
+- case 0x7990:
+- adie_base = adie_base_7996;
+- /* adie 0 */
+- if (dev->fem_type == MT7996_FEM_INT && dev->chip_sku != MT7996_SKU_233)
+- adie_id = ADIE_7975;
+- else
+- adie_id = ADIE_7976;
+- adie_offs[0] = adie_offs_list[adie_id];
+- eep_offs[0] = eep_offs_list[adie_id];
+-
+- /* adie 1 */
+- if (dev->chip_sku == MT7996_SKU_444) {
+- adie_offs[1] = adie_offs_list[ADIE_7977];
+- eep_offs[1] = eep_offs_list[ADIE_7977];
+- }
+-
+- /* adie 2 */
+- adie_offs[2] = adie_offs_list[ADIE_7977];
+- eep_offs[2] = eep_offs_list[ADIE_7977];
+- break;
+- case 0x7992:
+- adie_base = adie_base_7992;
+- /* adie 0 */
+- if (dev->chip_sku == MT7992_SKU_44 &&
+- dev->fem_type != MT7996_FEM_EXT)
+- adie_id = ADIE_7975;
+- else if (dev->chip_sku == MT7992_SKU_24)
+- adie_id = ADIE_7978;
+- else
+- adie_id = ADIE_7976;
+- adie_offs[0] = adie_offs_list[adie_id];
+- eep_offs[0] = eep_offs_list[adie_id];
+-
+- /* adie 1 */
+- if (dev->chip_sku == MT7992_SKU_44 &&
+- dev->fem_type != MT7996_FEM_INT)
+- adie_id = ADIE_7977;
+- else if (dev->chip_sku != MT7992_SKU_23)
+- adie_id = ADIE_7979;
+- else
+- break;
+- adie_offs[1] = adie_offs_list[adie_id];
+- eep_offs[1] = eep_offs_list[adie_id];
+- break;
+- default:
+- return -EINVAL;
+- }
+-
+- for (band = 0; band < __MT_MAX_BAND; band++) {
+- u16 adie_offset, eep_offset;
+- u32 block_num, prev_block_num = -1;
+-
+- if (!adie_offs[band])
+- continue;
+-
+- for (i = 0; i < MT_EE_CAL_FREE_MAX_SIZE; i++) {
+- adie_offset = adie_offs[band][i] + adie_base[band];
+- eep_offset = eep_offs[band][i];
+- block_num = adie_offset / MT7996_EEPROM_BLOCK_SIZE;
+-
+- if (adie_offs[band][i] == MT_EE_END_OFFSET)
+- break;
+-
+- if (is_mt7996(&dev->mt76) && dev->chip_sku == MT7996_SKU_444 &&
+- band == MT_BAND1)
+- eep_offset -= MT_EE_7977BN_OFFSET;
+-
+- if (prev_block_num != block_num) {
+- ret = mt7996_mcu_get_eeprom(dev, adie_offset, buf);
+- if (ret) {
+- if (ret != -EINVAL)
+- return ret;
+-
+- prev_block_num = -1;
+- continue;
+- }
+- }
+-
+- eeprom[eep_offset] = buf[adie_offset % MT7996_EEPROM_BLOCK_SIZE];
+- prev_block_num = block_num;
+- }
+- }
+-
+- return 0;
+-}
+-
+ int mt7996_eeprom_init(struct mt7996_dev *dev)
+ {
+ int ret;
+@@ -685,10 +545,6 @@ int mt7996_eeprom_init(struct mt7996_dev *dev)
+
+ mt7996_eeprom_load_precal(dev);
+
+- ret = mt7996_apply_cal_free_data(dev);
+- if (ret)
+- return ret;
+-
+ ret = mt7996_eeprom_parse_hw_cap(dev, &dev->phy);
+ if (ret < 0)
+ return ret;
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 9b3c6e3d..08c92eb3 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -4595,7 +4595,151 @@ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag, bool sta)
+ &req, sizeof(req), true);
+ }
+
+-int mt7996_mcu_set_eeprom(struct mt7996_dev *dev)
++static int mt7996_mcu_set_cal_free_data(struct mt7996_dev *dev)
++{
++#define MT_EE_CAL_FREE_MAX_SIZE 30
++#define MT_EE_7977BN_OFFSET (0x1200 - 0x500)
++#define MT_EE_END_OFFSET 0xffff
++ enum adie_type {
++ ADIE_7975,
++ ADIE_7976,
++ ADIE_7977,
++ ADIE_7978,
++ ADIE_7979,
++ };
++ static const u16 adie_offs_list[][MT_EE_CAL_FREE_MAX_SIZE] = {
++ [ADIE_7975] = {0x5cd, 0x5cf, 0x5d1, 0x5d3, 0x6c0, 0x6c1, 0x6c2, 0x6c3,
++ 0x7a1, 0x7a6, 0x7a8, 0x7aa, -1},
++ [ADIE_7976] = {0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x53, 0x55, 0x57, 0x59,
++ 0x70, 0x71, 0x790, 0x791, 0x794, 0x795, 0x7a6, 0x7a8, 0x7aa, -1},
++ [ADIE_7977] = {0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x53, 0x55, 0x57, 0x59,
++ 0x69, 0x6a, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, -1},
++ [ADIE_7978] = {0x91, 0x95, 0x100, 0x102, 0x104, 0x106, 0x107,
++ 0x108, 0x109, 0x10a, 0x10b, 0x10c, 0x10e, 0x110, -1},
++ [ADIE_7979] = {0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x53, 0x55, 0x57, 0x59,
++ 0x69, 0x6a, 0x7a, 0x7b, 0x7c, 0x7e, 0x80, -1},
++ };
++ static const u16 eep_offs_list[][MT_EE_CAL_FREE_MAX_SIZE] = {
++ [ADIE_7975] = {0x451, 0x453, 0x455, 0x457, 0x44c, 0x44d, 0x44e, 0x44f,
++ 0xba1, 0xba6, 0xba8, 0xbaa, -1},
++ [ADIE_7976] = {0x44c, 0x44d, 0x44e, 0x44f, 0x450,
++ 0x451, 0x453, 0x455, 0x457, 0x459,
++ 0x470, 0x471, 0xb90, 0xb91, 0xb94, 0xb95,
++ 0xba6, 0xba8, 0xbaa, -1},
++ [ADIE_7977] = {0x124c, 0x124d, 0x124e, 0x124f, 0x1250,
++ 0x1251, 0x1253, 0x1255, 0x1257, 0x1259,
++ 0x1269, 0x126a, 0x127a, 0x127b, 0x127c, 0x127d, 0x127e, -1},
++ [ADIE_7978] = {0xb91, 0xb95, 0x480, 0x482, 0x484, 0x486, 0x487, 0x488, 0x489,
++ 0x48a, 0x48b, 0x48c, 0x48e, 0x490, -1},
++ [ADIE_7979] = {0x124c, 0x124d, 0x124e, 0x124f, 0x1250, 0x1251,
++ 0x1253, 0x1255, 0x1257, 0x1259, 0x1269, 0x126a,
++ 0x127a, 0x127b, 0x127c, 0x127e, 0x1280, -1},
++ };
++ static const u16 adie_base_7996[] = {
++ 0x400, 0x1e00, 0x1200
++ };
++ static const u16 adie_base_7992[] = {
++ 0x400, 0x1200, 0x0
++ };
++ static const u16 *adie_offs[__MT_MAX_BAND];
++ static const u16 *eep_offs[__MT_MAX_BAND];
++ static const u16 *adie_base;
++ int adie_id, band, i, ret;
++
++ switch (mt76_chip(&dev->mt76)) {
++ case 0x7990:
++ adie_base = adie_base_7996;
++ /* adie 0 */
++ if (dev->fem_type == MT7996_FEM_INT && dev->chip_sku != MT7996_SKU_233)
++ adie_id = ADIE_7975;
++ else
++ adie_id = ADIE_7976;
++ adie_offs[0] = adie_offs_list[adie_id];
++ eep_offs[0] = eep_offs_list[adie_id];
++
++ /* adie 1 */
++ if (dev->chip_sku == MT7996_SKU_444) {
++ adie_offs[1] = adie_offs_list[ADIE_7977];
++ eep_offs[1] = eep_offs_list[ADIE_7977];
++ }
++
++ /* adie 2 */
++ adie_offs[2] = adie_offs_list[ADIE_7977];
++ eep_offs[2] = eep_offs_list[ADIE_7977];
++ break;
++ case 0x7992:
++ adie_base = adie_base_7992;
++ /* adie 0 */
++ if (dev->chip_sku == MT7992_SKU_44 &&
++ dev->fem_type != MT7996_FEM_EXT)
++ adie_id = ADIE_7975;
++ else if (dev->chip_sku == MT7992_SKU_24)
++ adie_id = ADIE_7978;
++ else
++ adie_id = ADIE_7976;
++ adie_offs[0] = adie_offs_list[adie_id];
++ eep_offs[0] = eep_offs_list[adie_id];
++
++ /* adie 1 */
++ if (dev->chip_sku == MT7992_SKU_44 &&
++ dev->fem_type != MT7996_FEM_INT)
++ adie_id = ADIE_7977;
++ else if (dev->chip_sku != MT7992_SKU_23)
++ adie_id = ADIE_7979;
++ else
++ break;
++ adie_offs[1] = adie_offs_list[adie_id];
++ eep_offs[1] = eep_offs_list[adie_id];
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ for (band = 0; band < __MT_MAX_BAND; band++) {
++ struct {
++ /* fixed field */
++ u8 __rsv[4];
++
++ __le16 tag;
++ __le16 len;
++ __le16 adie_offset;
++ __le16 eep_offset;
++ __le16 count;
++ u8 rsv[2];
++ } __packed req = {
++ .tag = cpu_to_le16(UNI_EFUSE_PATCH),
++ .len = cpu_to_le16(sizeof(req) - 4),
++ .count = cpu_to_le16(1),
++ };
++ u16 adie_offset, eep_offset;
++
++ if (!adie_offs[band])
++ continue;
++
++ for (i = 0; i < MT_EE_CAL_FREE_MAX_SIZE; i++) {
++ adie_offset = adie_offs[band][i] + adie_base[band];
++ eep_offset = eep_offs[band][i];
++
++ if (adie_offs[band][i] == MT_EE_END_OFFSET)
++ break;
++
++ if (is_mt7996(&dev->mt76) && dev->chip_sku == MT7996_SKU_444 &&
++ band == MT_BAND1)
++ eep_offset -= MT_EE_7977BN_OFFSET;
++
++ req.eep_offset = cpu_to_le16(eep_offset);
++ req.adie_offset = cpu_to_le16(adie_offset);
++ ret = mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(EFUSE_CTRL),
++ &req, sizeof(req), true);
++ if (ret)
++ return ret;
++ }
++ }
++
++ return 0;
++}
++
++int mt7996_mcu_set_eeprom_flash(struct mt7996_dev *dev)
+ {
+ #define MAX_PAGE_IDX_MASK GENMASK(7, 5)
+ #define PAGE_IDX_MASK GENMASK(4, 2)
+@@ -4640,6 +4784,27 @@ int mt7996_mcu_set_eeprom(struct mt7996_dev *dev)
+ return 0;
+ }
+
++int mt7996_mcu_set_eeprom(struct mt7996_dev *dev)
++{
++ struct mt7996_mcu_eeprom req = {
++ .tag = cpu_to_le16(UNI_EFUSE_BUFFER_MODE),
++ .len = cpu_to_le16(sizeof(req) - 4),
++ .buffer_mode = EE_MODE_EFUSE,
++ .format = EE_FORMAT_WHOLE
++ };
++ int ret;
++
++ if (dev->flash_mode)
++ ret = mt7996_mcu_set_eeprom_flash(dev);
++ else
++ ret = mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(EFUSE_CTRL),
++ &req, sizeof(req), true);
++ if (ret)
++ return ret;
++
++ return mt7996_mcu_set_cal_free_data(dev);
++}
++
+ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf)
+ {
+ struct mt7996_mcu_eeprom_info req = {
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 05b29c90..d99e9a60 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1038,6 +1038,7 @@ enum {
+ UNI_EFUSE_BUFFER_MODE,
+ UNI_EFUSE_FREE_BLOCK,
+ UNI_EFUSE_BUFFER_RD,
++ UNI_EFUSE_PATCH,
+ };
+
+ enum {
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0170-mtk-mt76-mt7996-support-handle-link_id-in-ap_wireles.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0170-mtk-mt76-mt7996-support-handle-link_id-in-ap_wireles.patch
new file mode 100644
index 0000000..f98bc73
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0170-mtk-mt76-mt7996-support-handle-link_id-in-ap_wireles.patch
@@ -0,0 +1,327 @@
+From e7b25f87fa76aef0603209472187e9cadfbaada6 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 14 Jun 2024 14:54:44 +0800
+Subject: [PATCH 170/199] mtk: mt76: mt7996: support handle link_id in
+ ap_wireless vendor cmd
+
+Add support handle link_id in ap_wireless vendor command. The link_id is
+used to find the corresponding phy and its band_idx. The band_idx is the
+critical information required by some mcu commands.
+
+This commit also refactor some functions, changing the parameter from
+phy to dev since phy is not required.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/mt7996.h | 12 +++++------
+ mt7996/mtk_mcu.c | 53 +++++++++++++++++++++++++++++++-----------------
+ mt7996/vendor.c | 46 ++++++++++++++++++++++++++++-------------
+ mt7996/vendor.h | 6 +-----
+ 4 files changed, 73 insertions(+), 44 deletions(-)
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 1e507b1c..00cd0b61 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1300,8 +1300,8 @@ int mt7996_vendor_amnt_sta_remove(struct mt7996_phy *phy,
+ struct ieee80211_sta *sta);
+ void mt7996_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en);
+ void mt7996_mcu_set_mimo(struct mt7996_phy *phy);
+-int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val);
+-int mt7996_mcu_set_muru_cfg(struct mt7996_phy *phy, void *data);
++int mt7996_set_muru_cfg(struct mt7996_dev *dev, u8 action, u8 val);
++int mt7996_mcu_set_muru_cfg(struct mt7996_dev *dev, void *data);
+ void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif);
+ int mt7996_mcu_set_csi(struct mt7996_phy *phy, u8 mode,
+ u8 cfg, u8 v1, u32 v2, u8 *mac_addr);
+@@ -1332,12 +1332,12 @@ int mt7996_mcu_set_muru_fixed_rate_parameter(struct mt7996_dev *dev, u8 action,
+ int mt7996_mcu_set_txbf_snd_info(struct mt7996_dev *dev, void *para);
+ int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val);
+ int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val);
+-int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val);
++int mt7996_mcu_set_bypass_smthint(struct mt7996_dev *dev, u8 band_idx, u8 val);
+ int mt7996_mcu_set_rfeature_trig_type(struct mt7996_dev *dev, u8 band_idx,
+ u8 enable, u8 trig_type);
+-void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type);
+-void mt7996_mcu_set_nusers_ofdma(struct mt7996_phy *phy, u8 type, u8 ofdma_user_cnt);
+-void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type);
++void mt7996_mcu_set_ppdu_tx_type(struct mt7996_dev *dev, u8 ppdu_type);
++void mt7996_mcu_set_nusers_ofdma(struct mt7996_dev *dev, u8 band_idx, u8 ofdma_user_cnt);
++void mt7996_mcu_set_cert(struct mt7996_dev *dev);
+ void mt7996_tm_update_channel(struct mt7996_phy *phy);
+
+ int mt7996_mcu_set_vow_drr_dbg(struct mt7996_dev *dev, u32 val);
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index c87daf8e..8bacf29d 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -1082,11 +1082,10 @@ int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val)
+ false);
+ }
+
+-int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
++int mt7996_mcu_set_bypass_smthint(struct mt7996_dev *dev, u8 band_idx, u8 val)
+ {
+ #define BF_PHY_SMTH_INT_BYPASS 0
+ #define BYPASS_VAL 1
+- struct mt7996_dev *dev = phy->dev;
+ struct {
+ u8 _rsv[4];
+
+@@ -1101,11 +1100,11 @@ int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val)
+ .tag = cpu_to_le16(BF_CFG_PHY),
+ .len = cpu_to_le16(sizeof(data) - 4),
+ .action = BF_PHY_SMTH_INT_BYPASS,
+- .band_idx = phy->mt76->band_idx,
++ .band_idx = band_idx,
+ .smthintbypass = val,
+ };
+
+- if (val != BYPASS_VAL)
++ if (val != BYPASS_VAL || !mt7996_band_valid(dev, band_idx))
+ return -EINVAL;
+
+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(BF), &data, sizeof(data),
+@@ -1174,9 +1173,8 @@ int mt7996_mcu_set_rfeature_trig_type(struct mt7996_dev *dev, u8 band_idx,
+ }
+ }
+
+-int mt7996_mcu_set_muru_cfg(struct mt7996_phy *phy, void *data)
++int mt7996_mcu_set_muru_cfg(struct mt7996_dev *dev, void *data)
+ {
+- struct mt7996_dev *dev = phy->dev;
+ struct mt7996_muru *muru;
+ struct {
+ u8 _rsv[4];
+@@ -1202,7 +1200,7 @@ int mt7996_mcu_set_muru_cfg(struct mt7996_phy *phy, void *data)
+ sizeof(req), false);
+ }
+
+-int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val)
++int mt7996_set_muru_cfg(struct mt7996_dev *dev, u8 action, u8 val)
+ {
+ struct mt7996_muru *muru;
+ struct mt7996_muru_dl *dl;
+@@ -1222,7 +1220,7 @@ int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val)
+ comm->sch_type = MURU_OFDMA_SCH_TYPE_DL;
+ muru->cfg_comm = cpu_to_le32(MURU_COMM_SET);
+ muru->cfg_dl = cpu_to_le32(MURU_FIXED_DL_TOTAL_USER_CNT);
+- ret = mt7996_mcu_set_muru_cfg(phy, muru);
++ ret = mt7996_mcu_set_muru_cfg(dev, muru);
+ break;
+ case MU_CTRL_UL_USER_CNT:
+ ul->user_num = val;
+@@ -1230,7 +1228,7 @@ int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val)
+ comm->sch_type = MURU_OFDMA_SCH_TYPE_UL;
+ muru->cfg_comm = cpu_to_le32(MURU_COMM_SET);
+ muru->cfg_ul = cpu_to_le32(MURU_FIXED_UL_TOTAL_USER_CNT);
+- ret = mt7996_mcu_set_muru_cfg(phy, muru);
++ ret = mt7996_mcu_set_muru_cfg(dev, muru);
+ break;
+ default:
+ break;
+@@ -1240,16 +1238,15 @@ int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val)
+ return ret;
+ }
+
+-void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type)
++void mt7996_mcu_set_ppdu_tx_type(struct mt7996_dev *dev, u8 ppdu_type)
+ {
+- struct mt7996_dev *dev = phy->dev;
+ int enable_su;
+
+ switch (ppdu_type) {
+ case CAPI_SU:
+ enable_su = 1;
+ mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SUTX_CTRL, enable_su);
+- mt7996_set_muru_cfg(phy, MU_CTRL_DL_USER_CNT, 0);
++ mt7996_set_muru_cfg(dev, MU_CTRL_DL_USER_CNT, 0);
+ break;
+ case CAPI_MU:
+ enable_su = 0;
+@@ -1260,16 +1257,35 @@ void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type)
+ }
+ }
+
+-void mt7996_mcu_set_nusers_ofdma(struct mt7996_phy *phy, u8 type, u8 user_cnt)
++void mt7996_mcu_set_nusers_ofdma(struct mt7996_dev *dev, u8 band_idx, u8 user_cnt)
+ {
+- struct mt7996_dev *dev = phy->dev;
++ struct mt76_phy *mphy;
++ struct mt7996_phy *phy;
+ int enable_su = 0;
++ u8 type;
++
++ if (!mt7996_band_valid(dev, band_idx)) {
++ dev_err(dev->mt76.dev, "Invalid band_idx\n");
++ return;
++ }
++
++ mphy = dev->mt76.phys[band_idx];
++ if (!mphy)
++ return;
++
++ phy = (struct mt7996_phy *)mphy->priv;
+
+ mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SUTX_CTRL, enable_su);
+- mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY, MU_DL_ACK_POLICY_SU_BAR);
++ mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY,
++ MU_DL_ACK_POLICY_SU_BAR);
+ mt7996_mcu_muru_set_prot_frame_thr(dev, 9999);
+
+- mt7996_set_muru_cfg(phy, type, user_cnt);
++ if (phy->muru_onoff & OFDMA_UL)
++ type = MU_CTRL_UL_USER_CNT;
++ else
++ type = MU_CTRL_DL_USER_CNT;
++
++ mt7996_set_muru_cfg(dev, type, user_cnt);
+ }
+
+ void mt7996_mcu_set_mimo(struct mt7996_phy *phy)
+@@ -1300,9 +1316,8 @@ void mt7996_mcu_set_mimo(struct mt7996_phy *phy)
+ mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_FORCE_MU, force_mu);
+ }
+
+-void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type)
++void mt7996_mcu_set_cert(struct mt7996_dev *dev)
+ {
+- struct mt7996_dev *dev = phy->dev;
+ struct {
+ u8 _rsv[4];
+
+@@ -1313,7 +1328,7 @@ void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type)
+ } __packed req = {
+ .tag = cpu_to_le16(UNI_CMD_CERT_CFG),
+ .len = cpu_to_le16(sizeof(req) - 4),
+- .action = type, /* 1: CAPI Enable */
++ .action = !!dev->cert_mode, /* 1: CAPI Enable */
+ };
+
+ mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(WSYS_CONFIG), &req,
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index ed7c1322..33c682c0 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -31,6 +31,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
+ [MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA] = {.type = NLA_U8 },
+ [MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO] = {.type = NLA_U8 },
+ [MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE] = {.type = NLA_U16 },
++ [MTK_VENDOR_ATTR_WIRELESS_CTRL_LINK_ID] = {.type = NLA_U8 },
+ };
+
+ static const struct nla_policy
+@@ -182,7 +183,7 @@ static int mt7996_vendor_mu_ctrl(struct wiphy *wiphy,
+ nla_memcpy(muru, tb[MTK_VENDOR_ATTR_MU_CTRL_STRUCT],
+ sizeof(struct mt7996_muru));
+
+- err = mt7996_mcu_set_muru_cfg(phy, muru);
++ err = mt7996_mcu_set_muru_cfg(phy->dev, muru);
+ kfree(muru);
+ }
+
+@@ -953,9 +954,12 @@ static int mt7996_vendor_wireless_ctrl(struct wiphy *wiphy,
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_dev *dev = phy->dev;
++ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_bss_conf *mconf;
+ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL];
+ int err;
+- u8 val8;
++ u8 val8, band_idx, link_id = 0;
+ u16 val16;
+ u32 val32;
+
+@@ -964,12 +968,28 @@ static int mt7996_vendor_wireless_ctrl(struct wiphy *wiphy,
+ if (err)
+ return err;
+
+- val32 = CAPI_WIRELESS_CHANGED;
++ if (ieee80211_vif_is_mld(vif) && tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_LINK_ID]) {
++ link_id = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_LINK_ID]);
++
++ if (link_id >= IEEE80211_LINK_UNSPECIFIED)
++ return -EINVAL;
++ }
++
++ rcu_read_lock();
++ mconf = rcu_dereference(mvif->link[link_id]);
++ if (!mconf || !mconf->phy) {
++ rcu_read_unlock();
++ return -EINVAL;
++ }
++
++ band_idx = mconf->phy->mt76->band_idx;
++ rcu_read_unlock();
+
+ if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_OFDMA]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_OFDMA]);
+- val32 |= FIELD_PREP(RATE_CFG_MODE, RATE_PARAM_FIXED_OFDMA) |
+- FIELD_PREP(RATE_CFG_VAL, val8);
++ val32 = FIELD_PREP(RATE_CFG_MODE, RATE_PARAM_FIXED_OFDMA) |
++ FIELD_PREP(RATE_CFG_VAL, val8) |
++ FIELD_PREP(RATE_CFG_BAND_IDX, band_idx);
+ ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
+ mt7996_set_wireless_vif, &val32);
+ if (val8 == 3) /* DL20and80 */
+@@ -980,24 +1000,22 @@ static int mt7996_vendor_wireless_ctrl(struct wiphy *wiphy,
+ hw->max_rx_aggregation_subframes = val16;
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_PPDU_TX_TYPE]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_PPDU_TX_TYPE]);
+- mt7996_mcu_set_ppdu_tx_type(phy, val8);
++ mt7996_mcu_set_ppdu_tx_type(dev, val8);
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA]);
+- if (phy->muru_onoff & OFDMA_UL)
+- mt7996_mcu_set_nusers_ofdma(phy, MU_CTRL_UL_USER_CNT, val8);
+- else
+- mt7996_mcu_set_nusers_ofdma(phy, MU_CTRL_DL_USER_CNT, val8);
++ mt7996_mcu_set_nusers_ofdma(dev, band_idx, val8);
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO]);
+- val32 |= FIELD_PREP(RATE_CFG_MODE, RATE_PARAM_FIXED_MIMO) |
+- FIELD_PREP(RATE_CFG_VAL, val8);
++ val32 = FIELD_PREP(RATE_CFG_MODE, RATE_PARAM_FIXED_MIMO) |
++ FIELD_PREP(RATE_CFG_VAL, val8) |
++ FIELD_PREP(RATE_CFG_BAND_IDX, band_idx);
+ ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
+ mt7996_set_wireless_vif, &val32);
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]);
+ dev->cert_mode = val8;
+- mt7996_mcu_set_cert(phy, !!val8);
+- mt7996_mcu_set_bypass_smthint(phy, val8);
++ mt7996_mcu_set_cert(dev);
++ mt7996_mcu_set_bypass_smthint(dev, band_idx, val8);
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]);
+ mt7996_set_wireless_amsdu(hw, val8);
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index 5608a3b4..714f0b3e 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -78,11 +78,6 @@ enum mtk_vendor_attr_mu_ctrl {
+ NUM_MTK_VENDOR_ATTRS_MU_CTRL - 1
+ };
+
+-enum mtk_capi_control_changed {
+- CAPI_RFEATURE_CHANGED = BIT(16),
+- CAPI_WIRELESS_CHANGED = BIT(17),
+-};
+-
+ enum mtk_vendor_attr_rfeature_ctrl {
+ MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
+
+@@ -117,6 +112,7 @@ enum mtk_vendor_attr_wireless_ctrl {
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT = 9,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA, /* reserve */
++ MTK_VENDOR_ATTR_WIRELESS_CTRL_LINK_ID,
+
+ /* keep last */
+ NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0171-mtk-mt76-mt7996-fix-incorrect-indexing-of-MIB-FW-eve.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0171-mtk-mt76-mt7996-fix-incorrect-indexing-of-MIB-FW-eve.patch
new file mode 100644
index 0000000..03262f4
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0171-mtk-mt76-mt7996-fix-incorrect-indexing-of-MIB-FW-eve.patch
@@ -0,0 +1,99 @@
+From 96ef7f1ebdc990ecd0e547710c0929aa7d885a68 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Fri, 28 Jun 2024 18:03:41 +0800
+Subject: [PATCH 171/199] mtk: mt76: mt7996: fix incorrect indexing of MIB FW
+ event
+
+When porting channel state reporting from Wi-Fi 6 to Wi-Fi 7 codebase, indexing of FW event of MIB data was not properly handled.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/mcu.c | 45 +++++++++++++++++++++++++++++----------------
+ 1 file changed, 29 insertions(+), 16 deletions(-)
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 08c92eb3..bb4f6170 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -5106,6 +5106,13 @@ int mt7996_mcu_get_chip_config(struct mt7996_dev *dev, u32 *cap)
+
+ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch)
+ {
++ enum {
++ IDX_TX_TIME,
++ IDX_RX_TIME,
++ IDX_OBSS_AIRTIME,
++ IDX_NON_WIFI_TIME,
++ IDX_NUM
++ };
+ struct {
+ struct {
+ u8 band;
+@@ -5115,16 +5122,15 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch)
+ __le16 tag;
+ __le16 len;
+ __le32 offs;
+- } data[4];
++ } data[IDX_NUM];
+ } __packed req = {
+ .hdr.band = phy->mt76->band_idx,
+ };
+- /* strict order */
+ static const u32 offs[] = {
+- UNI_MIB_TX_TIME,
+- UNI_MIB_RX_TIME,
+- UNI_MIB_OBSS_AIRTIME,
+- UNI_MIB_NON_WIFI_TIME,
++ [IDX_TX_TIME] = UNI_MIB_TX_TIME,
++ [IDX_RX_TIME] = UNI_MIB_RX_TIME,
++ [IDX_OBSS_AIRTIME] = UNI_MIB_OBSS_AIRTIME,
++ [IDX_NON_WIFI_TIME] = UNI_MIB_NON_WIFI_TIME,
+ };
+ struct mt76_channel_state *state = phy->mt76->chan_state;
+ struct mt76_channel_state *state_ts = &phy->state_ts;
+@@ -5133,7 +5139,7 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch)
+ struct sk_buff *skb;
+ int i, ret;
+
+- for (i = 0; i < 4; i++) {
++ for (i = 0; i < IDX_NUM; i++) {
+ req.data[i].tag = cpu_to_le16(UNI_CMD_MIB_DATA);
+ req.data[i].len = cpu_to_le16(sizeof(req.data[i]));
+ req.data[i].offs = cpu_to_le32(offs[i]);
+@@ -5152,17 +5158,24 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch)
+ goto out;
+
+ #define __res_u64(s) le64_to_cpu(res[s].data)
+- state->cc_tx += __res_u64(1) - state_ts->cc_tx;
+- state->cc_bss_rx += __res_u64(2) - state_ts->cc_bss_rx;
+- state->cc_rx += __res_u64(2) + __res_u64(3) - state_ts->cc_rx;
+- state->cc_busy += __res_u64(0) + __res_u64(1) + __res_u64(2) + __res_u64(3) -
++ state->cc_tx += __res_u64(IDX_TX_TIME) - state_ts->cc_tx;
++ state->cc_bss_rx += __res_u64(IDX_RX_TIME) - state_ts->cc_bss_rx;
++ state->cc_rx += __res_u64(IDX_RX_TIME) +
++ __res_u64(IDX_OBSS_AIRTIME) -
++ state_ts->cc_rx;
++ state->cc_busy += __res_u64(IDX_TX_TIME) +
++ __res_u64(IDX_RX_TIME) +
++ __res_u64(IDX_OBSS_AIRTIME) +
++ __res_u64(IDX_NON_WIFI_TIME) -
+ state_ts->cc_busy;
+-
+ out:
+- state_ts->cc_tx = __res_u64(1);
+- state_ts->cc_bss_rx = __res_u64(2);
+- state_ts->cc_rx = __res_u64(2) + __res_u64(3);
+- state_ts->cc_busy = __res_u64(0) + __res_u64(1) + __res_u64(2) + __res_u64(3);
++ state_ts->cc_tx = __res_u64(IDX_TX_TIME);
++ state_ts->cc_bss_rx = __res_u64(IDX_RX_TIME);
++ state_ts->cc_rx = __res_u64(IDX_RX_TIME) + __res_u64(IDX_OBSS_AIRTIME);
++ state_ts->cc_busy = __res_u64(IDX_TX_TIME) +
++ __res_u64(IDX_RX_TIME) +
++ __res_u64(IDX_OBSS_AIRTIME) +
++ __res_u64(IDX_NON_WIFI_TIME);
+ #undef __res_u64
+
+ dev_kfree_skb(skb);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0172-mtk-mt76-mt7996-support-muru-dbg-info-debug-commands.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0172-mtk-mt76-mt7996-support-muru-dbg-info-debug-commands.patch
new file mode 100644
index 0000000..9cda995
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0172-mtk-mt76-mt7996-support-muru-dbg-info-debug-commands.patch
@@ -0,0 +1,82 @@
+From 75b59026efecf9c1f6a9486537566121ea3f9055 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 3 Jun 2024 15:18:05 +0800
+Subject: [PATCH 172/199] mtk: mt76: mt7996: support muru dbg info debug
+ commands
+
+Support enable muru debug functionality by debugfs.
+Usage:
+$ echo <item>-<val> > /sys/kernel/debug/ieee80211/phy0/mt76/muru_dbg
+
+The purpose of this commit is for WiFi 7 R1 cert UL-MU test cases.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/mtk_debugfs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index b16ea5fe..b698c68a 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -4326,6 +4326,48 @@ mt7996_drr_info(struct seq_file *s, void *data)
+ return 0;
+ }
+
++static ssize_t mt7996_muru_dbg_info_set(struct file *file,
++ const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_dev *dev = file->private_data;
++ char buf[10];
++ u16 item;
++ u8 val;
++ int ret;
++
++ if (count >= sizeof(buf))
++ return -EINVAL;
++
++ if (copy_from_user(buf, user_buf, count))
++ return -EFAULT;
++
++ if (count && buf[count - 1] == '\n')
++ buf[count - 1] = '\0';
++ else
++ buf[count] = '\0';
++
++ if (sscanf(buf, "%hu-%hhu", &item, &val) != 2) {
++ dev_warn(dev->mt76.dev,"format: item-value\n");
++ return -EINVAL;
++ }
++
++ ret = mt7996_mcu_muru_dbg_info(dev, item, val);
++ if (ret) {
++ dev_warn(dev->mt76.dev, "Fail to send mcu cmd.\n");
++ return -EFAULT;
++ }
++
++ return count;
++}
++
++static const struct file_operations fops_muru_dbg_info = {
++ .write = mt7996_muru_dbg_info_set,
++ .open = simple_open,
++ .owner = THIS_MODULE,
++ .llseek = default_llseek,
++};
++
+ void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ /* agg */
+@@ -4447,6 +4489,8 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+ /* Drop counters */
+ debugfs_create_file("tx_drop_stats", 0400, dir, dev, &mt7996_tx_drop_fops);
+ debugfs_create_file("rx_drop_stats", 0400, dir, dev, &mt7996_rx_drop_fops);
++
++ debugfs_create_file("muru_dbg", 0200, dir, dev, &fops_muru_dbg_info);
+ }
+
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0173-mtk-mt76-mt7996-add-kite-if_comb.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0173-mtk-mt76-mt7996-add-kite-if_comb.patch
new file mode 100644
index 0000000..e41cb4b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0173-mtk-mt76-mt7996-add-kite-if_comb.patch
@@ -0,0 +1,68 @@
+From 4e90d97cde027ac38e6f88649d4e028c96999e2e Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Wed, 3 Jul 2024 10:34:39 +0800
+Subject: [PATCH 173/199] mtk: mt76: mt7996: add kite if_comb
+
+Add Kite (dual band) if_comb
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7996/init.c | 33 ++++++++++++++++++++++++++++++---
+ 1 file changed, 30 insertions(+), 3 deletions(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 5f38374f..f923ce66 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -46,6 +46,22 @@ static const struct ieee80211_iface_combination if_comb[] = {
+ }
+ };
+
++static const struct ieee80211_iface_combination if_comb_7992[] = {
++ {
++ .limits = if_limits,
++ .n_limits = ARRAY_SIZE(if_limits),
++ .max_interfaces = MT7996_MAX_INTERFACES * 2,
++ .num_different_channels = 2,
++ .beacon_int_infra_match = true,
++ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
++ BIT(NL80211_CHAN_WIDTH_20) |
++ BIT(NL80211_CHAN_WIDTH_40) |
++ BIT(NL80211_CHAN_WIDTH_80) |
++ BIT(NL80211_CHAN_WIDTH_160),
++ .beacon_int_min_gcd = 100,
++ }
++};
++
+ static const u8 mt7996_if_types_ext_capa[] = {
+ [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
+@@ -417,11 +433,22 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
+ hw->vif_data_size = sizeof(struct mt7996_vif);
+ hw->chanctx_data_size = sizeof(struct mt7996_chanctx);
+
+- wiphy->iface_combinations = if_comb;
+- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
++ switch (mt76_chip(mdev)) {
++ case 0x7990:
++ wiphy->iface_combinations = if_comb;
++ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
++ wiphy->mbssid_max_interfaces = 16 * 3;
++ break;
++ case 0x7992:
++ default:
++ wiphy->iface_combinations = if_comb_7992;
++ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_7992);
++ wiphy->mbssid_max_interfaces = 16 * 2;
++ break;
++ }
++
+ wiphy->reg_notifier = mt7996_regd_notifier;
+ wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
+- wiphy->mbssid_max_interfaces = 16 * 3;
+
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BSS_COLOR);
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0174-mtk-mt76-mt7996-change-source-of-per-WCID-TX-MPDU-st.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0174-mtk-mt76-mt7996-change-source-of-per-WCID-TX-MPDU-st.patch
new file mode 100644
index 0000000..9d80ebd
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0174-mtk-mt76-mt7996-change-source-of-per-WCID-TX-MPDU-st.patch
@@ -0,0 +1,162 @@
+From ddada5f035de7b87e15de8a87ba1c2491d87edfd Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Mon, 17 Jun 2024 17:16:19 +0800
+Subject: [PATCH 174/199] mtk: mt76: mt7996: change source of per-WCID TX MPDU
+ statistics
+
+Change source of per-WCID TX MPDU statistics from TX-free-done event to PPDU TXS, because WCID from TX-free-done event may not represent the actually used link.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt76.h | 1 +
+ mt76_connac3_mac.h | 5 +++++
+ mt7996/mac.c | 50 +++++++++++++++++++++++++---------------------
+ 3 files changed, 33 insertions(+), 23 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index f2d12b89..feb7bf16 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -360,6 +360,7 @@ struct mt76_sta_stats {
+ u64 tx_bytes;
+ /* WED TX */
+ u32 tx_packets; /* unit: MSDU */
++ u32 tx_mpdus;
+ u32 tx_retries;
+ u32 tx_failed;
+ u64 tx_airtime;
+diff --git a/mt76_connac3_mac.h b/mt76_connac3_mac.h
+index db0c29e6..ad8392cd 100644
+--- a/mt76_connac3_mac.h
++++ b/mt76_connac3_mac.h
+@@ -204,6 +204,11 @@ enum tx_frag_idx {
+ MT_TX_FRAG_LAST
+ };
+
++enum {
++ MT_TXS_MPDU_FMT = 0,
++ MT_TXS_PPDU_FMT = 2,
++};
++
+ #define MT_CT_INFO_APPLY_TXD BIT(0)
+ #define MT_CT_INFO_COPY_HOST_TXD_ALL BIT(1)
+ #define MT_CT_INFO_MGMT_FRAME BIT(2)
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 12cc60cb..97cd5e23 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1206,19 +1206,9 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+ spin_unlock_bh(&mdev->sta_poll_lock);
+ continue;
+ } else if (info & MT_TXFREE_INFO_HEADER) {
+- u32 tx_retries = 0, tx_failed = 0;
+-
+ if (!wcid)
+ continue;
+
+- tx_retries =
+- FIELD_GET(MT_TXFREE_INFO_COUNT, info) - 1;
+- tx_failed = tx_retries +
+- !!FIELD_GET(MT_TXFREE_INFO_STAT, info);
+-
+- wcid->stats.tx_retries += tx_retries;
+- wcid->stats.tx_failed += tx_failed;
+-
+ if (FIELD_GET(MT_TXFREE_INFO_STAT, info) == 2) {
+ struct mt7996_phy *mphy =
+ __mt7996_phy(dev, wcid->phy_idx);
+@@ -1256,9 +1246,10 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len)
+
+ static bool
+ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+- int pid, __le32 *txs_data)
++ struct mt76_wcid *link_wcid, int pid, __le32 *txs_data)
+ {
+- struct mt76_sta_stats *stats = &wcid->stats;
++ u8 fmt = le32_get_bits(txs_data[0], MT_TXS0_TXS_FORMAT);
++ struct mt76_sta_stats *stats = &link_wcid->stats;
+ struct mt76_dev *mdev = &dev->mt76;
+ struct ieee80211_tx_info *info;
+ struct sk_buff_head list;
+@@ -1270,8 +1261,9 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+
+ mt76_tx_status_lock(mdev, &list);
+
+- /* only report MPDU TXS */
+- if (le32_get_bits(txs_data[0], MT_TXS0_TXS_FORMAT) == 0) {
++ switch (fmt) {
++ case MT_TXS_MPDU_FMT:
++ /* Only report MPDU TXS to mac80211. */
+ skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
+ if (skb) {
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+@@ -1300,6 +1292,15 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+ mvif->probe_send_count[wcid->phy_idx] = 0;
+ }
+ }
++ break;
++ case MT_TXS_PPDU_FMT:
++ stats->tx_mpdus += le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_CNT);
++ stats->tx_failed += le32_get_bits(txs_data[6], MT_TXS6_MPDU_FAIL_CNT);
++ stats->tx_retries += le32_get_bits(txs_data[7], MT_TXS7_MPDU_RETRY_CNT);
++ break;
++ default:
++ dev_err(mdev->dev, "Unknown TXS format: %hhu\n", fmt);
++ goto unlock;
+ }
+
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) && wcid->sta) {
+@@ -1331,6 +1332,7 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+
+ if (skb)
+ mt76_tx_status_skb_done(mdev, skb, &list);
++unlock:
+ mt76_tx_status_unlock(mdev, &list);
+
+ return !!skb;
+@@ -1338,13 +1340,13 @@ mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
+
+ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
+ {
+- struct mt7996_link_sta *mlink;
+- struct mt76_wcid *wcid;
++ struct mt76_wcid *wcid, *link_wcid;
+ __le32 *txs_data = data;
+ u16 wcidx;
+- u8 pid;
++ u8 band, pid;
+
+ wcidx = le32_get_bits(txs_data[2], MT_TXS2_WCID);
++ band = le32_get_bits(txs_data[2], MT_TXS2_BAND);
+ pid = le32_get_bits(txs_data[3], MT_TXS3_PID);
+
+ if (pid < MT_PACKET_ID_NO_SKB)
+@@ -1359,17 +1361,19 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
+ if (!wcid)
+ goto out;
+
+- mt7996_mac_add_txs_skb(dev, wcid, pid, txs_data);
++ link_wcid = mt7996_get_link_wcid(dev, wcidx, band);
++ if (!link_wcid)
++ goto out;
++
++ mt7996_mac_add_txs_skb(dev, wcid, link_wcid, pid, txs_data);
+
+- if (!wcid->sta)
++ if (!link_wcid->sta)
+ goto out;
+
+- mlink = wcid_to_mlink(wcid);
+ spin_lock_bh(&dev->mt76.sta_poll_lock);
+- if (list_empty(&mlink->wcid.poll_list))
+- list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list);
++ if (list_empty(&link_wcid->poll_list))
++ list_add_tail(&link_wcid->poll_list, &dev->mt76.sta_poll_list);
+ spin_unlock_bh(&dev->mt76.sta_poll_lock);
+-
+ out:
+ rcu_read_unlock();
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0175-mtk-mt76-mt7996-update-preamble-puncture-support-for.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0175-mtk-mt76-mt7996-update-preamble-puncture-support-for.patch
new file mode 100644
index 0000000..2896b57
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0175-mtk-mt76-mt7996-update-preamble-puncture-support-for.patch
@@ -0,0 +1,301 @@
+From 88307d7d8ce98e7d072f6f4592fe2c5c0162080d Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Tue, 28 May 2024 15:31:39 +0800
+Subject: [PATCH 175/199] mtk: mt76: mt7996: update preamble puncture support
+ for mt7996
+
+Add pp station mode support. Current fw only support one bitmap on a band.
+For extender mode, fw only consider that extender and root AP are both in
+fw mode and detect the same bitmap. So that extender AP/STA can use the
+same bitmap setting.
+Current PP_DSCB_CTRL cmd only use bitmap value in fw implementation.
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+---
+ mt76_connac_mcu.h | 1 +
+ mt7996/main.c | 22 ++++++++++
+ mt7996/mcu.c | 107 +++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/mcu.h | 34 +++++++++++++++
+ mt7996/mt7996.h | 2 +
+ 5 files changed, 165 insertions(+), 1 deletion(-)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 8de91f62..c1becf7e 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1071,6 +1071,7 @@ enum {
+ MCU_UNI_EVENT_TESTMODE_CTRL = 0x46,
+ MCU_UNI_EVENT_CSI_REPORT = 0x4A,
+ MCU_UNI_EVENT_WED_RRO = 0x57,
++ MCU_UNI_EVENT_PP = 0x5a,
+ MCU_UNI_EVENT_PER_STA_INFO = 0x6d,
+ MCU_UNI_EVENT_ALL_STA_INFO = 0x6e,
+ };
+diff --git a/mt7996/main.c b/mt7996/main.c
+index b5d45d19..032ef5f3 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1241,6 +1241,12 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
+ if (ret)
+ goto error;
+
++ if (link_sta->eht_cap.has_eht && conf->vif->type == NL80211_IFTYPE_STATION) {
++ ret = mt7996_mcu_set_pp_sta_dscb(mconf->phy, &conf->chanreq.oper, mconf->mt76.omac_idx);
++ if (ret)
++ goto error;
++ }
++
+ ewma_avg_signal_init(&mlink->avg_ack_signal);
+
+ return 0;
+@@ -2840,6 +2846,10 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+ if (ret)
+ return ret;
+
++ ret = mt7996_mcu_set_pp_alg_ctrl(phy, PP_ALG_SET_TIMER);
++ if (ret)
++ return ret;
++
+ return mt7996_set_channel(phy, &ctx->chandef);
+ }
+
+@@ -2960,6 +2970,7 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+ struct mt7996_chanctx *new_ctx;
+ struct mt7996_phy *phy;
+ int i, ret = 0;
++ u8 omac_idx;
+
+ for (i = 0; i < n_vifs; i++) {
+ if (vifs[i].old_ctx == vifs[i].new_ctx)
+@@ -3002,6 +3013,17 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+
+ mutex_unlock(&dev->mt76.mutex);
+
++ if (vifs->vif->type == NL80211_IFTYPE_AP && phy->pp_mode == PP_USR_MODE)
++ ret = mt7996_mcu_set_pp_en(phy, PP_USR_MODE,
++ new_ctx->chandef.punctured);
++ else if (vifs->vif->type == NL80211_IFTYPE_STATION) {
++ omac_idx = get_omac_idx(NL80211_IFTYPE_STATION, phy->omac_mask);
++ ret = mt7996_mcu_set_pp_sta_dscb(phy, &new_ctx->chandef, omac_idx);
++ }
++
++ if (ret)
++ goto out;
++
+ ret = mt7996_set_channel(phy, &new_ctx->chandef);
+ if (ret)
+ goto out;
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index bb4f6170..adb71bf5 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -1280,6 +1280,39 @@ mt7996_mcu_wed_rro_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ }
+ }
+
++static void
++mt7996_mcu_pp_event(struct mt7996_dev *dev, struct sk_buff *skb)
++{
++ struct mt7996_mcu_pp_basic_event *event;
++ struct mt7996_mcu_pp_dscb_event *dscb_event;
++ struct mt7996_phy *phy;
++ struct mt76_phy *mphy;
++ u16 report_bitmap;
++
++ event = (struct mt7996_mcu_pp_basic_event *)skb->data;
++
++ switch (le16_to_cpu(event->tag)) {
++ case UNI_EVENT_STATIC_PP_TAG_CSA_DSCB_IE:
++ case UNI_EVENT_STATIC_PP_TAG_DSCB_IE:
++ if (!mt7996_band_valid(dev, event->band_idx))
++ return;
++
++ mphy = mt76_dev_phy(&dev->mt76, event->band_idx);
++ phy = mphy->priv;
++
++ dscb_event = (struct mt7996_mcu_pp_dscb_event *)event;
++ report_bitmap = le16_to_cpu(dscb_event->punct_bitmap);
++
++ if (phy->punct_bitmap == report_bitmap)
++ return;
++
++ if (phy->pp_mode == PP_FW_MODE)
++ phy->punct_bitmap = report_bitmap;
++
++ break;
++ }
++}
++
+ static void
+ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+@@ -1305,6 +1338,9 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ case MCU_UNI_EVENT_WED_RRO:
+ mt7996_mcu_wed_rro_event(dev, skb);
+ break;
++ case MCU_UNI_EVENT_PP:
++ mt7996_mcu_pp_event(dev, skb);
++ break;
+ #ifdef CONFIG_MTK_DEBUG
+ case MCU_UNI_EVENT_SR:
+ mt7996_mcu_rx_sr_event(dev, skb);
+@@ -6274,7 +6310,8 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
+ u8 force_bitmap_ctrl;
+ u8 auto_mode;
+ __le16 bitmap;
+- u8 _rsv2[2];
++ u8 csa_enable;
++ u8 _rsv2;
+ } __packed req = {
+ .tag = cpu_to_le16(UNI_CMD_PP_EN_CTRL),
+ .len = cpu_to_le16(sizeof(req) - 4),
+@@ -6284,6 +6321,7 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
+ .force_bitmap_ctrl = (mode == PP_USR_MODE) ? 2 : 0,
+ .auto_mode = pp_auto,
+ .bitmap = cpu_to_le16(bitmap),
++ .csa_enable = false,
+ };
+
+ if (phy->chanctx->chandef.chan->band == NL80211_BAND_2GHZ ||
+@@ -6300,6 +6338,73 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap)
+ &req, sizeof(req), false);
+ }
+
++int mt7996_mcu_set_pp_sta_dscb(struct mt7996_phy *phy,
++ struct cfg80211_chan_def *chandef,
++ u8 omac_idx)
++{
++ struct mt7996_dev *dev = phy->dev;
++ struct {
++ u8 _rsv1[4];
++
++ __le16 tag;
++ __le16 len;
++ u8 band_idx;
++ u8 omac_idx;
++ u8 eht_op_present;
++ u8 dscb_present;
++ __le16 dscb;
++ u8 ctrl;
++ u8 ccfs0;
++ u8 ccfs1;
++ u8 rsv2[3];
++ } __packed req = {
++ .tag = cpu_to_le16(UNI_CMD_PP_DSCB_CTRL),
++ .len = cpu_to_le16(sizeof(req) - 4),
++
++ .band_idx = phy->mt76->band_idx,
++ .omac_idx = omac_idx,
++ .eht_op_present = true,
++ .dscb_present = !!chandef->punctured,
++ .dscb = cpu_to_le16(chandef->punctured),
++ .ctrl = 0,
++ .ccfs0 = ieee80211_frequency_to_channel(chandef->center_freq1),
++ .ccfs1 = ieee80211_frequency_to_channel(chandef->center_freq1),
++ };
++
++ if (phy->chanctx->chandef.chan->band == NL80211_BAND_2GHZ ||
++ phy->punct_bitmap == chandef->punctured)
++ return 0;
++
++ switch (chandef->width) {
++ case NL80211_CHAN_WIDTH_320:
++ req.ctrl |= IEEE80211_EHT_OPER_CHAN_WIDTH_320MHZ;
++ if (chandef->chan->hw_value < req.ccfs1)
++ req.ccfs0 -= 16;
++ else
++ req.ccfs0 += 16;
++ break;
++ case NL80211_CHAN_WIDTH_160:
++ req.ctrl |= IEEE80211_EHT_OPER_CHAN_WIDTH_160MHZ;
++ if (chandef->chan->hw_value < req.ccfs1)
++ req.ccfs0 -= 8;
++ else
++ req.ccfs0 += 8;
++ break;
++ case NL80211_CHAN_WIDTH_80:
++ req.ctrl |= IEEE80211_EHT_OPER_CHAN_WIDTH_80MHZ;
++ req.ccfs0 = 0;
++ break;
++ default:
++ return 0;
++ break;
++ }
++
++ phy->punct_bitmap = cpu_to_le16(chandef->punctured);
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(PP),
++ &req, sizeof(req), false);
++}
++
+ int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data)
+ {
+ struct mt7996_dev *dev = phy->dev;
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index d99e9a60..011b6c7a 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1162,6 +1162,7 @@ enum {
+
+ enum {
+ UNI_CMD_PP_EN_CTRL,
++ UNI_CMD_PP_DSCB_CTRL,
+ };
+
+ enum pp_mode {
+@@ -1170,6 +1171,39 @@ enum pp_mode {
+ PP_USR_MODE,
+ };
+
++enum {
++ UNI_EVENT_PP_TAG_ALG_CTRL = 1,
++ UNI_EVENT_STATIC_PP_TAG_DSCB_IE,
++ UNI_EVENT_STATIC_PP_TAG_CSA_DSCB_IE,
++ UNI_EVENT_PP_SHOW_INFO,
++};
++
++struct mt7996_mcu_pp_basic_event {
++ struct mt7996_mcu_rxd rxd;
++
++ u8 __rsv1[4];
++
++ __le16 tag;
++ __le16 len;
++ u8 band_idx;
++ u8 __rsv2[3];
++} __packed;
++
++struct mt7996_mcu_pp_dscb_event {
++ struct mt7996_mcu_rxd rxd;
++
++ u8 __rsv1[4];
++
++ __le16 tag;
++ __le16 len;
++ u8 band_idx;
++ u8 omac_idx;
++ u8 new_dscb;
++ u8 __rsv2;
++ __le16 punct_bitmap;
++ u8 __rsv3[2];
++} __packed;
++
+ enum {
+ UNI_CMD_SCS_SEND_DATA,
+ UNI_CMD_SCS_SET_PD_THR_RANGE = 2,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 00cd0b61..f31d3f36 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1276,6 +1276,8 @@ int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
+ struct mt7996_link_sta *mlink);
+ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
+ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
++int mt7996_mcu_set_pp_sta_dscb(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef,
++ u8 omac_idx);
+ int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u8 link_id,
+ struct ieee80211_sta *sta, struct mt7996_eml_omn *eml_omn);
+ #ifdef CONFIG_MAC80211_DEBUGFS
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0176-mtk-mt76-Add-dynamic-pp-vendor-and-debug-pp-algo-cmd.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0176-mtk-mt76-Add-dynamic-pp-vendor-and-debug-pp-algo-cmd.patch
new file mode 100644
index 0000000..7b2b8de
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0176-mtk-mt76-Add-dynamic-pp-vendor-and-debug-pp-algo-cmd.patch
@@ -0,0 +1,425 @@
+From a2ca9b9f2be2bd336db4c3e6a2f6693d6e2236b4 Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Tue, 28 May 2024 15:39:06 +0800
+Subject: [PATCH 176/199] mtk: mt76: Add dynamic pp vendor and debug pp algo
+ cmd support
+
+Add dynamic pp vendor and debug pp algo cmd support.
+1. Add support channel switch with a punct bitmap.
+2. Add pp event for fw mode and trigger a channel switch by hostapd.
+3. Add pp algo dump cmd to get current fw punct bitmap and mode.
+
+When extender sta have not connected to root ap and the chandef is null.
+mt76 just ignore the event. Once the sta connect to ap, the sta part would
+send a new fw cmd to update the pp bitmap.
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+---
+ mt7996/mcu.c | 70 ++++++++++++++++++++++++++++-
+ mt7996/mcu.h | 38 ++++++++++++++++
+ mt7996/mt7996.h | 2 +
+ mt7996/mtk_debugfs.c | 14 ++++++
+ mt7996/vendor.c | 103 +++++++++++++++++++++++++++++++------------
+ mt7996/vendor.h | 8 +++-
+ 6 files changed, 205 insertions(+), 30 deletions(-)
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index adb71bf5..00bc675e 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -1280,6 +1280,39 @@ mt7996_mcu_wed_rro_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ }
+ }
+
++void
++mt7996_dump_pp_statistic_event(struct mt7996_dev *dev,
++ struct mt7996_mcu_pp_alg_ctrl_event *event)
++{
++ u32 unit_time = le32_to_cpu(event->pp_timer_intv);
++
++ dev_info(dev->mt76.dev, "band idx = %u\n", le32_to_cpu(event->band_idx));
++ dev_info(dev->mt76.dev, "x2 value = %u\n", le32_to_cpu(event->thr_x2_value));
++ dev_info(dev->mt76.dev, "x2 shift = %u\n", le32_to_cpu(event->thr_x2_shift));
++ dev_info(dev->mt76.dev, "x3 value = %u\n", le32_to_cpu(event->thr_x3_value));
++ dev_info(dev->mt76.dev, "x3 shift = %u\n", le32_to_cpu(event->thr_x3_shift));
++ dev_info(dev->mt76.dev, "x4 value = %u\n", le32_to_cpu(event->thr_x4_value));
++ dev_info(dev->mt76.dev, "x4 shift = %u\n", le32_to_cpu(event->thr_x4_shift));
++ dev_info(dev->mt76.dev, "x5 value = %u\n", le32_to_cpu(event->thr_x5_value));
++ dev_info(dev->mt76.dev, "x5 shift = %u\n", le32_to_cpu(event->thr_x5_shift));
++ dev_info(dev->mt76.dev, "x6 value = %u\n", le32_to_cpu(event->thr_x6_value));
++ dev_info(dev->mt76.dev, "x6 shift = %u\n", le32_to_cpu(event->thr_x6_shift));
++ dev_info(dev->mt76.dev, "x7 value = %u\n", le32_to_cpu(event->thr_x7_value));
++ dev_info(dev->mt76.dev, "x7 shift = %u\n", le32_to_cpu(event->thr_x7_shift));
++ dev_info(dev->mt76.dev, "x8 value = %u\n", le32_to_cpu(event->thr_x8_value));
++ dev_info(dev->mt76.dev, "x8 shift = %u\n", le32_to_cpu(event->thr_x8_shift));
++ dev_info(dev->mt76.dev, "sw_pp_time = %u (Unit: %u ms)\n",
++ le32_to_cpu(event->sw_pp_time), unit_time);
++ dev_info(dev->mt76.dev, "hw_pp_time = %u (Unit: %u ms)\n",
++ le32_to_cpu(event->hw_pp_time), unit_time);
++ dev_info(dev->mt76.dev, "no_pp_time = %u (Unit: %u ms)\n",
++ le32_to_cpu(event->no_pp_time), unit_time);
++ dev_info(dev->mt76.dev, "auto_bw_time = %u (Unit: %u ms)\n",
++ le32_to_cpu(event->auto_bw_time), unit_time);
++ dev_info(dev->mt76.dev, "punct_bitmap = 0x%04x\n",
++ le16_to_cpu(event->punct_bitmap));
++}
++
+ static void
+ mt7996_mcu_pp_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+@@ -1306,9 +1339,13 @@ mt7996_mcu_pp_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ if (phy->punct_bitmap == report_bitmap)
+ return;
+
+- if (phy->pp_mode == PP_FW_MODE)
++ if (phy->pp_mode == PP_FW_MODE) {
+ phy->punct_bitmap = report_bitmap;
+-
++ mt7996_vendor_pp_bitmap_update(phy, report_bitmap);
++ }
++ break;
++ case UNI_EVENT_PP_TAG_ALG_CTRL:
++ mt7996_dump_pp_statistic_event(dev, (struct mt7996_mcu_pp_alg_ctrl_event *)event);
+ break;
+ }
+ }
+@@ -6405,6 +6442,35 @@ int mt7996_mcu_set_pp_sta_dscb(struct mt7996_phy *phy,
+ &req, sizeof(req), false);
+ }
+
++int mt7996_mcu_set_pp_alg_ctrl(struct mt7996_phy *phy, u8 action)
++{
++ struct mt7996_dev *dev = phy->dev;
++ struct {
++ u8 _rsv1[4];
++
++ __le16 tag;
++ __le16 len;
++
++ __le32 pp_timer_intv;
++ __le32 rsv2[14];
++ u8 band_idx;
++ u8 pp_action;
++ u8 reset;
++ u8 _rsv3;
++ } __packed req = {
++ .tag = cpu_to_le16(UNI_CMD_PP_ALG_CTRL),
++ .len = cpu_to_le16(sizeof(req) - 4),
++
++ .pp_timer_intv = action == PP_ALG_SET_TIMER ? 2000 : 0,
++ .band_idx = phy->mt76->band_idx,
++ .pp_action = action,
++ .reset = 0,
++ };
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(PP),
++ &req, sizeof(req), false);
++}
++
+ int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data)
+ {
+ struct mt7996_dev *dev = phy->dev;
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 011b6c7a..01eb0ea1 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1162,6 +1162,7 @@ enum {
+
+ enum {
+ UNI_CMD_PP_EN_CTRL,
++ UNI_CMD_PP_ALG_CTRL,
+ UNI_CMD_PP_DSCB_CTRL,
+ };
+
+@@ -1171,6 +1172,11 @@ enum pp_mode {
+ PP_USR_MODE,
+ };
+
++enum pp_alg_action {
++ PP_ALG_SET_TIMER,
++ PP_ALG_GET_STATISTICS = 2,
++};
++
+ enum {
+ UNI_EVENT_PP_TAG_ALG_CTRL = 1,
+ UNI_EVENT_STATIC_PP_TAG_DSCB_IE,
+@@ -1204,6 +1210,38 @@ struct mt7996_mcu_pp_dscb_event {
+ u8 __rsv3[2];
+ } __packed;
+
++struct mt7996_mcu_pp_alg_ctrl_event {
++ struct mt7996_mcu_rxd rxd;
++
++ u8 __rsv1[4];
++
++ __le16 tag;
++ __le16 len;
++
++ __le32 pp_timer_intv;
++ __le32 thr_x2_value;
++ __le32 thr_x2_shift;
++ __le32 thr_x3_value;
++ __le32 thr_x3_shift;
++ __le32 thr_x4_value;
++ __le32 thr_x4_shift;
++ __le32 thr_x5_value;
++ __le32 thr_x5_shift;
++ __le32 thr_x6_value;
++ __le32 thr_x6_shift;
++ __le32 thr_x7_value;
++ __le32 thr_x7_shift;
++ __le32 thr_x8_value;
++ __le32 thr_x8_shift;
++ __le32 sw_pp_time;
++ __le32 hw_pp_time;
++ __le32 no_pp_time;
++ __le32 auto_bw_time;
++ u8 band_idx;
++ u8 __rsv2;
++ __le16 punct_bitmap;
++} __packed;
++
+ enum {
+ UNI_CMD_SCS_SEND_DATA,
+ UNI_CMD_SCS_SET_PD_THR_RANGE = 2,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index f31d3f36..74c32827 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1278,6 +1278,7 @@ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
+ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
+ int mt7996_mcu_set_pp_sta_dscb(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef,
+ u8 omac_idx);
++int mt7996_mcu_set_pp_alg_ctrl(struct mt7996_phy *phy, u8 action);
+ int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u8 link_id,
+ struct ieee80211_sta *sta, struct mt7996_eml_omn *eml_omn);
+ #ifdef CONFIG_MAC80211_DEBUGFS
+@@ -1307,6 +1308,7 @@ int mt7996_mcu_set_muru_cfg(struct mt7996_dev *dev, void *data);
+ void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif);
+ int mt7996_mcu_set_csi(struct mt7996_phy *phy, u8 mode,
+ u8 cfg, u8 v1, u32 v2, u8 *mac_addr);
++int mt7996_vendor_pp_bitmap_update(struct mt7996_phy *phy, u16 bitmap);
+ #endif
+
+ int mt7996_mcu_edcca_enable(struct mt7996_phy *phy, bool enable);
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index b698c68a..093f3c69 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -4368,6 +4368,18 @@ static const struct file_operations fops_muru_dbg_info = {
+ .llseek = default_llseek,
+ };
+
++static int mt7996_pp_alg_show(struct seq_file *s, void *data)
++{
++ struct mt7996_phy *phy = s->private;
++ struct mt7996_dev *dev = phy->dev;
++
++ dev_info(dev->mt76.dev, "pp_mode = %d\n", phy->pp_mode);
++ mt7996_mcu_set_pp_alg_ctrl(phy, PP_ALG_GET_STATISTICS);
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_pp_alg);
++
+ void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ /* agg */
+@@ -4390,6 +4402,8 @@ void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+
+ debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
+ debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
++
++ debugfs_create_file("pp_alg", 0200, dir, phy, &mt7996_pp_alg_fops);
+ }
+
+ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index 33c682c0..d7973c5e 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -96,7 +96,9 @@ ibf_ctrl_policy[NUM_MTK_VENDOR_ATTRS_IBF_CTRL] = {
+ static struct nla_policy
+ pp_ctrl_policy[NUM_MTK_VENDOR_ATTRS_PP_CTRL] = {
+ [MTK_VENDOR_ATTR_PP_MODE] = { .type = NLA_U8 },
+- [MTK_VENDOR_ATTR_PP_BAND_IDX] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_PP_LINK_ID] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_PP_BITMAP] = { .type = NLA_U16 },
++ [MTK_VENDOR_ATTR_PP_CURR_FREQ] = { .type = NLA_U32 },
+ };
+
+ static const struct nla_policy
+@@ -805,31 +807,44 @@ static int mt7996_vendor_pp_ctrl(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const void *data, int data_len)
+ {
+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
+ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_PP_CTRL];
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_phy *phy;
+- struct mt76_phy *mphy;
+ struct cfg80211_chan_def *chandef;
++ struct mt7996_bss_conf *mconf;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ int err;
+- u8 val8, band_idx = 0;
++ u8 mode = 0, link_id = 0;
++ u16 punct_bitmap = 0;
+
+ err = nla_parse(tb, MTK_VENDOR_ATTR_PP_CTRL_MAX, data, data_len,
+ pp_ctrl_policy, NULL);
+
+- if (tb[MTK_VENDOR_ATTR_PP_BAND_IDX]) {
+- band_idx = nla_get_u8(tb[MTK_VENDOR_ATTR_PP_BAND_IDX]);
+- }
++ if (tb[MTK_VENDOR_ATTR_PP_MODE])
++ mode = nla_get_u8(tb[MTK_VENDOR_ATTR_PP_MODE]);
++ else
++ return -EINVAL;
+
+- if (!mt7996_band_valid(dev, band_idx))
+- goto error;
++ if (ieee80211_vif_is_mld(vif) && tb[MTK_VENDOR_ATTR_PP_LINK_ID]) {
++ link_id = nla_get_u8(tb[MTK_VENDOR_ATTR_PP_LINK_ID]);
++ if (link_id >= IEEE80211_LINK_UNSPECIFIED)
++ return -EINVAL;
++ }
+
+- mphy = dev->mt76.phys[band_idx];
+- if (!mphy)
++ rcu_read_lock();
++ mconf = rcu_dereference(mvif->link[link_id]);
++ if (!mconf) {
++ rcu_read_unlock();
+ goto error;
++ }
+
+- phy = (struct mt7996_phy *)mphy->priv;
+- if (!phy)
++ phy = mconf->phy;
++ if (!phy) {
++ rcu_read_unlock();
+ goto error;
++ }
++ rcu_read_unlock();
+
+ chandef = &phy->chanctx->chandef;
+ if (!chandef)
+@@ -838,28 +853,53 @@ static int mt7996_vendor_pp_ctrl(struct wiphy *wiphy, struct wireless_dev *wdev,
+ if (chandef->chan->band == NL80211_BAND_2GHZ)
+ return 0;
+
+- if (tb[MTK_VENDOR_ATTR_PP_MODE]) {
+- val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_PP_MODE]);
+- switch (val8) {
+- case PP_DISABLE:
+- case PP_FW_MODE:
+- err = mt7996_mcu_set_pp_en(phy, val8, 0);
+- break;
+- case PP_USR_MODE:
+- /* handled by add_chanctx */
+- err = 0;
+- break;
+- default:
+- err = -EINVAL;
+- }
++ switch (mode) {
++ case PP_USR_MODE:
++ if (tb[MTK_VENDOR_ATTR_PP_BITMAP])
++ punct_bitmap = nla_get_u16(tb[MTK_VENDOR_ATTR_PP_BITMAP]);
++ fallthrough;
++ case PP_FW_MODE:
++ case PP_DISABLE:
++ err = mt7996_mcu_set_pp_en(phy, mode, punct_bitmap);
++ break;
++ default:
++ return -EINVAL;
+ }
+
+ return err;
+ error:
+- dev_err(dev->mt76.dev, "Invalid band idx: %d\n", band_idx);
++ dev_err(dev->mt76.dev, "Invalid link id: %d\n", link_id);
+ return -EINVAL;
+ }
+
++int mt7996_vendor_pp_bitmap_update(struct mt7996_phy *phy, u16 bitmap)
++{
++ struct sk_buff *skb;
++ struct mt76_phy *mphy = phy->mt76;
++ struct cfg80211_chan_def *chandef = &phy->chanctx->chandef;
++
++ if (!chandef)
++ return 0;
++
++ skb = cfg80211_vendor_event_alloc(mphy->hw->wiphy, NULL, 20,
++ MTK_NL80211_VENDOR_EVENT_PP_BMP_UPDATE,
++ GFP_ATOMIC);
++
++ if (!skb)
++ return -ENOMEM;
++
++ if (nla_put_u16(skb, MTK_VENDOR_ATTR_PP_BITMAP, bitmap) ||
++ nla_put_u32(skb, MTK_VENDOR_ATTR_PP_CURR_FREQ,
++ chandef->chan->center_freq)) {
++ dev_kfree_skb(skb);
++ return -ENOMEM;
++ }
++
++ cfg80211_vendor_event(skb, GFP_ATOMIC);
++
++ return 0;
++}
++
+ static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data,
+@@ -1490,10 +1530,19 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+ },
+ };
+
++static const struct nl80211_vendor_cmd_info mt7996_vendor_events[] = {
++ [MTK_NL80211_VENDOR_EVENT_PP_BMP_UPDATE] = {
++ .vendor_id = MTK_NL80211_VENDOR_ID,
++ .subcmd = MTK_NL80211_VENDOR_EVENT_PP_BMP_UPDATE,
++ },
++};
++
+ void mt7996_vendor_register(struct mt7996_phy *phy)
+ {
+ phy->mt76->hw->wiphy->vendor_commands = mt7996_vendor_commands;
+ phy->mt76->hw->wiphy->n_vendor_commands = ARRAY_SIZE(mt7996_vendor_commands);
++ phy->mt76->hw->wiphy->vendor_events = mt7996_vendor_events;
++ phy->mt76->hw->wiphy->n_vendor_events = ARRAY_SIZE(mt7996_vendor_events);
+
+ INIT_LIST_HEAD(&phy->csi.list);
+ spin_lock_init(&phy->csi.lock);
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index 714f0b3e..ca4f00ad 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -21,6 +21,10 @@ enum mtk_nl80211_vendor_subcmds {
+ MTK_NL80211_VENDOR_SUBCMD_EML_CTRL = 0xd3,
+ };
+
++enum mtk_nl80211_vendor_events {
++ MTK_NL80211_VENDOR_EVENT_PP_BMP_UPDATE = 0x5,
++};
++
+ enum mtk_vendor_attr_edcca_ctrl {
+ MTK_VENDOR_ATTR_EDCCA_THRESHOLD_INVALID = 0,
+
+@@ -222,7 +226,9 @@ enum mtk_vendor_attr_pp_ctrl {
+ MTK_VENDOR_ATTR_PP_CTRL_UNSPEC,
+
+ MTK_VENDOR_ATTR_PP_MODE,
+- MTK_VENDOR_ATTR_PP_BAND_IDX,
++ MTK_VENDOR_ATTR_PP_LINK_ID,
++ MTK_VENDOR_ATTR_PP_BITMAP,
++ MTK_VENDOR_ATTR_PP_CURR_FREQ,
+
+ /* keep last */
+ NUM_MTK_VENDOR_ATTRS_PP_CTRL,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0177-mtk-mt76-mt7996-disable-MAT-and-set-force-link-for-4.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0177-mtk-mt76-mt7996-disable-MAT-and-set-force-link-for-4.patch
new file mode 100644
index 0000000..64389e3
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0177-mtk-mt76-mt7996-disable-MAT-and-set-force-link-for-4.patch
@@ -0,0 +1,40 @@
+From 554f2dd335deaf511b9261603a3e6c62f1183639 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Mon, 8 Jul 2024 11:05:31 +0800
+Subject: [PATCH 177/199] mtk: mt76: mt7996: disable MAT and set force-link for
+ 4-addr NULL func data frame
+
+This is a temporary solution to solve a WDS connection problem.
+
+We found that WDS connection occasionally failed because of dropping
+of the 4-addr NULL func data frame, which is used by STA to enstablish
+WDS conection. It seems like the dropping is originated from the STA
+side HW's incorrect address translation.
+
+Disabling MAT can prevent the connection problem.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/mac.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 97cd5e23..a8985a3b 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -759,6 +759,12 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ (multicast || unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)) ||
+ info->flags & IEEE80211_TX_CTL_INJECTED))
+ txwi[5] |= cpu_to_le32(MT_TXD5_FL);
++
++ if (unlikely(ieee80211_is_nullfunc(fc)) && ieee80211_has_a4(fc) &&
++ ieee80211_vif_is_mld(info->control.vif)) {
++ txwi[5] |= cpu_to_le32(MT_TXD5_FL);
++ txwi[6] |= cpu_to_le32(MT_TXD6_DIS_MAT);
++ }
+ }
+
+ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0178-mtk-mt76-mt7996-add-per-STA-TX-MSDU-failed-and-retri.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0178-mtk-mt76-mt7996-add-per-STA-TX-MSDU-failed-and-retri.patch
new file mode 100644
index 0000000..eb0dbbc
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0178-mtk-mt76-mt7996-add-per-STA-TX-MSDU-failed-and-retri.patch
@@ -0,0 +1,249 @@
+From c9cc947b2922dde53c71ce871ac869039d740999 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Thu, 4 Jul 2024 14:00:16 +0800
+Subject: [PATCH 178/199] mtk: mt76: mt7996: add per-STA TX MSDU failed and
+ retried counts
+
+Record per-STA TX MSDU failed and retried counts for debugging.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt76.h | 2 ++
+ mt76_connac_mcu.h | 3 ++
+ mt7996/mac.c | 39 ++++++++++++++++++++++++-
+ mt7996/mcu.c | 74 +++++++++++------------------------------------
+ mt7996/mcu.h | 8 +++++
+ mt7996/mt7996.h | 1 -
+ 6 files changed, 68 insertions(+), 59 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index feb7bf16..fa4a3e70 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -360,6 +360,8 @@ struct mt76_sta_stats {
+ u64 tx_bytes;
+ /* WED TX */
+ u32 tx_packets; /* unit: MSDU */
++ u32 tx_packets_retried;
++ u32 tx_packets_failed;
+ u32 tx_mpdus;
+ u32 tx_retries;
+ u32 tx_failed;
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index c1becf7e..545de4ae 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1402,6 +1402,8 @@ enum {
+ UNI_OFFLOAD_OFFLOAD_BMC_RPY_DETECT,
+ };
+
++#define PER_STA_INFO_MAX_NUM 90
++
+ enum UNI_PER_STA_INFO_TAG {
+ UNI_PER_STA_RSSI,
+ UNI_PER_STA_CONTENTION_RX_RATE,
+@@ -1411,6 +1413,7 @@ enum UNI_PER_STA_INFO_TAG {
+ UNI_PER_STA_TX_CNT,
+ UNI_PER_STA_TID_SN_GET,
+ UNI_PER_STA_TID_SN_SET,
++ UNI_PER_STA_PKT_CNT,
+ UNI_PER_STA_MAX_NUM
+ };
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index a8985a3b..fae24cad 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -2431,6 +2431,43 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
+ rcu_read_unlock();
+ }
+
++static int mt7996_mac_sta_poll(struct mt76_dev *dev)
++{
++ u16 sta_list[PER_STA_INFO_MAX_NUM];
++ struct mt7996_link_sta *mlink;
++ int i, ret;
++
++ spin_lock_bh(&dev->sta_poll_lock);
++ for (i = 0; i < PER_STA_INFO_MAX_NUM; ++i) {
++ if (list_empty(&dev->sta_poll_list))
++ break;
++
++ mlink = list_first_entry(&dev->sta_poll_list,
++ struct mt7996_link_sta,
++ wcid.poll_list);
++ list_del_init(&mlink->wcid.poll_list);
++ sta_list[i] = mlink->wcid.idx;
++ }
++ spin_unlock_bh(&dev->sta_poll_lock);
++
++ if (i == 0)
++ return 0;
++
++ ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_RSSI, i, sta_list);
++ if (ret)
++ dev_err(dev->dev, "Failed to update RSSI of polled STAs.\n");
++
++ ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_SNR, i, sta_list);
++ if (ret)
++ dev_err(dev->dev, "Failed to update SNR of polled STAs.\n");
++
++ ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_PKT_CNT, i, sta_list);
++ if (ret)
++ dev_err(dev->dev, "Failed to update MSDU counts of polled STAs.\n");
++
++ return ret;
++}
++
+ void mt7996_mac_work(struct work_struct *work)
+ {
+ struct mt76_phy *mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
+@@ -2453,7 +2490,7 @@ void mt7996_mac_work(struct work_struct *work)
+ if (i == mphy->band_idx) {
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_RATE);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_AIRTIME);
+- mt7996_mcu_get_signal_status(mdev);
++ mt7996_mac_sta_poll(mdev);
+ // if (mtk_wed_device_active(&mdev->mmio.wed)) {
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 00bc675e..857d2826 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -6017,7 +6017,6 @@ int mt7996_mcu_set_rro(struct mt7996_dev *dev, u16 tag, u16 val)
+ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+ u16 sta_num, u16 *sta_list)
+ {
+-#define PER_STA_INFO_MAX_NUM 90
+ struct mt7996_mcu_per_sta_info_event *res;
+ struct mt7996_link_sta *mlink;
+ struct mt76_wcid *wcid;
+@@ -6097,6 +6096,23 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+ }
+ }
+ break;
++ case UNI_PER_STA_PKT_CNT:
++ for (i = 0; i < sta_num; ++i) {
++ wlan_idx = le16_to_cpu(res->msdu_cnt[i].wlan_idx);
++ wcid = rcu_dereference(dev->wcid[wlan_idx]);
++ if (wcid) {
++ u32 retries = le32_to_cpu(res->msdu_cnt[i].tx_retries),
++ drops = le32_to_cpu(res->msdu_cnt[i].tx_drops);
++
++ wcid->stats.tx_packets_retried += retries;
++ wcid->stats.tx_packets_failed += retries + drops;
++ } else {
++ ret = -EINVAL;
++ dev_err(dev->dev, "Failed to update MSDU counts for "
++ "invalid WCID: %hu\n", wlan_idx);
++ }
++ }
++ break;
+ default:
+ ret = -EINVAL;
+ dev_err(dev->dev, "Unknown UNI_PER_STA_INFO_TAG: %d\n", tag);
+@@ -6107,62 +6123,6 @@ out:
+ return ret;
+ }
+
+-int mt7996_mcu_get_signal_status(struct mt76_dev *dev)
+-{
+- u16 sta_list[PER_STA_INFO_MAX_NUM];
+- LIST_HEAD(sta_poll_list);
+- struct mt7996_link_sta *mlink;
+- int i, ret;
+- bool empty = false;
+-
+- spin_lock_bh(&dev->sta_poll_lock);
+- list_splice_init(&dev->sta_poll_list, &sta_poll_list);
+- spin_unlock_bh(&dev->sta_poll_lock);
+-
+- while (!empty) {
+- for (i = 0; i < PER_STA_INFO_MAX_NUM; ++i) {
+- spin_lock_bh(&dev->sta_poll_lock);
+- if (list_empty(&sta_poll_list)) {
+- spin_unlock_bh(&dev->sta_poll_lock);
+-
+- if (i == 0)
+- return 0;
+-
+- empty = true;
+- break;
+- }
+- mlink = list_first_entry(&sta_poll_list,
+- struct mt7996_link_sta,
+- wcid.poll_list);
+- list_del_init(&mlink->wcid.poll_list);
+- spin_unlock_bh(&dev->sta_poll_lock);
+-
+- sta_list[i] = mlink->wcid.idx;
+- }
+-
+- ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_RSSI,
+- i, sta_list);
+- if (ret)
+- break;
+-
+- ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_SNR,
+- i, sta_list);
+- if (ret)
+- break;
+- }
+-
+- if (ret) {
+- /* Add STAs, whose signal statuses have not been updated,
+- * back to polling list.
+- */
+- spin_lock_bh(&dev->sta_poll_lock);
+- list_splice(&sta_poll_list, &dev->sta_poll_list);
+- spin_unlock_bh(&dev->sta_poll_lock);
+- }
+-
+- return ret;
+-}
+-
+ int mt7996_mcu_get_all_sta_info(struct mt76_dev *dev, u16 tag)
+ {
+ struct {
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 01eb0ea1..739e357c 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -211,6 +211,13 @@ struct per_sta_snr {
+ s8 val[IEEE80211_MAX_CHAINS];
+ } __packed;
+
++struct per_sta_msdu_cnt {
++ __le16 wlan_idx;
++ u8 __rsv[2];
++ __le32 tx_drops;
++ __le32 tx_retries;
++} __packed;
++
+ struct mt7996_mcu_per_sta_info_event {
+ u8 __rsv[4];
+
+@@ -220,6 +227,7 @@ struct mt7996_mcu_per_sta_info_event {
+ union {
+ struct per_sta_rssi rssi[0];
+ struct per_sta_snr snr[0];
++ struct per_sta_msdu_cnt msdu_cnt[0];
+ };
+ } __packed;
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 74c32827..8b00b05b 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1134,7 +1134,6 @@ void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb);
+ void mt7996_mcu_exit(struct mt7996_dev *dev);
+ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag,
+ u16 sta_num, u16 *sta_list);
+-int mt7996_mcu_get_signal_status(struct mt76_dev *dev);
+ int mt7996_mcu_get_all_sta_info(struct mt76_dev *dev, u16 tag);
+ int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id);
+ int mt7996_mcu_set_tx_power_ctrl(struct mt7996_phy *phy, u8 power_ctrl_id, u8 data);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0179-mtk-mt76-mt7996-fill-in-sn-into-txd-for-MLD-multicas.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0179-mtk-mt76-mt7996-fill-in-sn-into-txd-for-MLD-multicas.patch
new file mode 100644
index 0000000..15c49bd
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0179-mtk-mt76-mt7996-fill-in-sn-into-txd-for-MLD-multicas.patch
@@ -0,0 +1,42 @@
+From 112a2fd7458a1ee1a23b236c024bbc858b9d935e Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Mon, 15 Jul 2024 11:42:47 +0800
+Subject: [PATCH 179/199] mtk: mt76: mt7996: fill in sn into txd for MLD
+ multicast packet
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/mac.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index fae24cad..c91c550d 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -681,6 +681,7 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ bool multicast = is_multicast_ether_addr(hdr->addr1);
+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
+ __le16 fc = hdr->frame_control, sc = hdr->seq_ctrl;
++ u16 seqno = le16_to_cpu(sc);
+ u8 fc_type, fc_stype;
+ u32 val;
+
+@@ -739,9 +740,13 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ txwi[3] |= cpu_to_le32(MT_TXD3_REM_TX_COUNT);
+ }
+
+- if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+- u16 seqno = le16_to_cpu(sc);
++ if (ieee80211_vif_is_mld(info->control.vif) && multicast) {
++ val = MT_TXD3_SN_VALID |
++ FIELD_PREP(MT_TXD3_SEQ, IEEE80211_SEQ_TO_SN(seqno));
++ txwi[3] |= cpu_to_le32(val);
++ }
+
++ if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+ if (ieee80211_is_back_req(hdr->frame_control)) {
+ struct ieee80211_bar *bar;
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0180-mtk-mt76-mt7996-fix-potential-null-pointer.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0180-mtk-mt76-mt7996-fix-potential-null-pointer.patch
new file mode 100644
index 0000000..d82d6f0
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0180-mtk-mt76-mt7996-fix-potential-null-pointer.patch
@@ -0,0 +1,91 @@
+From 0468bbdacaddcec089088bbb16e0d4b402d52aaa Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Tue, 9 Jul 2024 14:54:39 +0800
+Subject: [PATCH 180/199] mtk: mt76: mt7996: fix potential null pointer
+
+Fix more parts that might have null pointer access.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7996/mac.c | 3 +++
+ mt7996/main.c | 10 ++++++++++
+ mt7996/mcu.c | 3 +++
+ 3 files changed, 16 insertions(+)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index c91c550d..657a19c1 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1115,6 +1115,9 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb,
+
+ msta = (struct mt7996_sta *)sta->drv_priv;
+ mlink = rcu_dereference(msta->link[msta->pri_link]);
++ if (!mlink)
++ return;
++
+ if (!test_and_set_bit(tid, &mlink->wcid.ampdu_state))
+ ieee80211_start_tx_ba_session(sta, tid, 0);
+ }
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 032ef5f3..ff0b9c0e 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -518,9 +518,12 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
+
+ conf = link_conf_dereference_protected(vif, 0);
+ mconf = mconf_dereference_protected(mvif, 0);
++ if (!mconf || !conf)
++ goto out;
+
+ mt7996_remove_bss_conf(vif, conf, mconf);
+
++out:
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
+@@ -928,6 +931,9 @@ static void mt7996_vif_cfg_changed(struct ieee80211_hw *hw,
+ struct mt7996_link_sta *mlink =
+ mlink_dereference_protected(&mvif->sta, link_id);
+
++ if (!conf || !mconf || !mlink)
++ continue;
++
+ mt7996_mcu_add_bss_info(mconf->phy, conf, mconf, mlink, true);
+ mt7996_mcu_add_sta(dev, conf, mconf, NULL, mlink, true, false);
+ }
+@@ -1279,6 +1285,8 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ link_sta_dereference_protected(sta, link_id);
+ bool last_link = rem == sta->valid_links && link_id == __fls(rem);
+
++ if (!mconf || !mlink || !conf || !link_sta)
++ continue;
+ mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink, last_link);
+ }
+ }
+@@ -1415,6 +1423,8 @@ mt7996_sta_pre_rcu_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct mt7996_link_sta *mlink =
+ mlink_dereference_protected(msta, link_id);
+
++ if (!mlink)
++ continue;
+ rcu_assign_pointer(dev->mt76.wcid[mlink->wcid.idx], NULL);
+ }
+ spin_unlock_bh(&dev->mt76.status_lock);
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 857d2826..4310d35b 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -3027,6 +3027,9 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
+ mlink = mlink_dereference_protected(msta, link_id);
+ mconf = mconf_dereference_protected(msta->vif, link_id);
+
++ if (!mlink || !mconf)
++ continue;
++
+ mld_setup_link->wcid = cpu_to_le16(mlink->wcid.idx);
+ mld_setup_link->bss_idx = mconf->mt76.idx;
+ mt76_trace(vif, "link_id(%d) wcid(%d) bss_idx(%d)\n",
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0181-mtk-mt76-mt7996-Fix-legacy-action-frame-wrong-addres.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0181-mtk-mt76-mt7996-Fix-legacy-action-frame-wrong-addres.patch
new file mode 100644
index 0000000..e6819c5
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0181-mtk-mt76-mt7996-Fix-legacy-action-frame-wrong-addres.patch
@@ -0,0 +1,50 @@
+From 6d35d91b55b55134d3fca5a9f913121b2b8058eb Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Wed, 17 Jul 2024 11:36:11 +0800
+Subject: [PATCH 181/199] mtk: mt76: mt7996: Fix legacy action frame wrong
+ address translation
+
+For non-associated STA send unicast ANQP request, AP should use unicast
+to response, so mt76 sould tell fw not translate frames of this type.
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+---
+ mt7996/mac.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 657a19c1..e571bbfa 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -671,7 +671,8 @@ mt7996_mac_write_txwi_8023(struct mt7996_dev *dev, __le32 *txwi,
+
+ static void
+ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+- struct sk_buff *skb, struct ieee80211_key_conf *key)
++ struct sk_buff *skb, struct ieee80211_key_conf *key,
++ struct mt76_wcid *wcid)
+ {
+ struct mt76_phy *mphy =
+ mt76_dev_phy(&dev->mt76, le32_get_bits(txwi[1], MT_TXD1_TGID));
+@@ -770,6 +771,9 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
+ txwi[5] |= cpu_to_le32(MT_TXD5_FL);
+ txwi[6] |= cpu_to_le32(MT_TXD6_DIS_MAT);
+ }
++
++ if (!wcid->sta && ieee80211_is_action(fc))
++ txwi[6] |= cpu_to_le32(MT_TXD6_DIS_MAT);
+ }
+
+ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+@@ -863,7 +867,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+ if (is_8023)
+ mt7996_mac_write_txwi_8023(dev, txwi, skb, wcid);
+ else
+- mt7996_mac_write_txwi_80211(dev, txwi, skb, key);
++ mt7996_mac_write_txwi_80211(dev, txwi, skb, key, wcid);
+
+ if (txwi[1] & cpu_to_le32(MT_TXD1_FIXED_RATE)) {
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0182-mtk-mt76-mt7996-add-AP-affiliated-link-removal-suppo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0182-mtk-mt76-mt7996-add-AP-affiliated-link-removal-suppo.patch
new file mode 100644
index 0000000..b35da7b
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0182-mtk-mt76-mt7996-add-AP-affiliated-link-removal-suppo.patch
@@ -0,0 +1,564 @@
+From e61df790cc5ef66271a12e14af49f48ad097f7a6 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Fri, 31 May 2024 18:14:59 +0800
+Subject: [PATCH 182/199] mtk: mt76: mt7996: add AP affiliated link removal
+ support
+
+Add support for ap link removal of MLD reconfiguration.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt76_connac_mcu.h | 3 +
+ mt7996/main.c | 68 ++++++++++++---
+ mt7996/mcu.c | 217 ++++++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mcu.h | 89 ++++++++++++++++++-
+ mt7996/mt7996.h | 2 +
+ 5 files changed, 367 insertions(+), 12 deletions(-)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 545de4ae..fd1bf1d1 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1074,6 +1074,7 @@ enum {
+ MCU_UNI_EVENT_PP = 0x5a,
+ MCU_UNI_EVENT_PER_STA_INFO = 0x6d,
+ MCU_UNI_EVENT_ALL_STA_INFO = 0x6e,
++ MCU_UNI_EVENT_MLD = 0x81,
+ };
+
+ #define MCU_UNI_CMD_EVENT BIT(1)
+@@ -1319,6 +1320,7 @@ enum {
+ MCU_UNI_CMD_ALL_STA_INFO = 0x6e,
+ MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
+ MCU_UNI_CMD_PTA_3WIRE_CTRL = 0x78,
++ MCU_UNI_CMD_MLD = 0x82,
+ };
+
+ enum {
+@@ -1393,6 +1395,7 @@ enum {
+ UNI_BSS_INFO_PM_DISABLE = 27,
+ UNI_BSS_INFO_BCN_CRIT_UPDATE = 32,
+ UNI_BSS_INFO_BCN_STA_PROF_CSA = 37,
++ UNI_BSS_INFO_BCN_ML_RECONF = 38,
+ };
+
+ enum {
+diff --git a/mt7996/main.c b/mt7996/main.c
+index ff0b9c0e..fc6f4ef9 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -319,6 +319,21 @@ static void mt7996_remove_bss_conf(struct ieee80211_vif *vif,
+ list_del_init(&mlink->wcid.poll_list);
+ spin_unlock_bh(&dev->mt76.sta_poll_lock);
+
++ /* reassign a new bss wcid if the previous one was removed */
++ if (vif->txq && ieee80211_vif_is_mld(vif) &&
++ hweight16(vif->valid_links) > 1) {
++ struct mt76_txq *mtxq = (struct mt76_txq *)vif->txq->drv_priv;
++
++ if (mtxq->wcid == mlink->wcid.idx) {
++ u8 new_link = __ffs(vif->valid_links & ~BIT(link_id));
++ struct mt7996_link_sta *new_mlink =
++ mlink_dereference_protected(&mvif->sta, new_link);
++
++ if (new_mlink)
++ mtxq->wcid = new_mlink->wcid.idx;
++ }
++ }
++
+ mt76_wcid_cleanup(&dev->mt76, &mlink->wcid);
+
+ if (mlink != &mvif->sta.deflink)
+@@ -425,7 +440,7 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
+ mt7996_mac_wtbl_update(dev, idx,
+ MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
+
+- if (vif->txq) {
++ if (vif->txq && hweight16(vif->valid_links) <= 1) {
+ mtxq = (struct mt76_txq *)vif->txq->drv_priv;
+ mtxq->wcid = idx;
+ }
+@@ -1128,6 +1143,8 @@ static void mt7996_remove_link_sta(struct mt7996_dev *dev,
+ {
+ struct ieee80211_sta *sta = link_sta->sta;
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ u16 valid_links = sta->valid_links;
++ bool pri_changed;
+ int i;
+
+ if (!mlink)
+@@ -1148,6 +1165,7 @@ static void mt7996_remove_link_sta(struct mt7996_dev *dev,
+ mt7996_mac_twt_teardown_flow(dev, mlink, i);
+
+ rcu_assign_pointer(mlink->sta->link[mlink->wcid.link_id], NULL);
++ rcu_assign_pointer(dev->mt76.wcid[mlink->wcid.idx], NULL);
+
+ spin_lock_bh(&dev->mt76.sta_poll_lock);
+ if (!list_empty(&mlink->wcid.poll_list))
+@@ -1156,17 +1174,41 @@ static void mt7996_remove_link_sta(struct mt7996_dev *dev,
+ list_del_init(&mlink->rc_list);
+ spin_unlock_bh(&dev->mt76.sta_poll_lock);
+
+- /* TODO: update primary link */
+- if (sta->valid_links) {
+- if (mlink->wcid.link_id == msta->pri_link)
+- msta->pri_link = msta->sec_link;
++ valid_links &= ~BIT(mlink->wcid.link_id);
++ if (!valid_links)
++ goto done;
+
+- if (sta->valid_links & ~(BIT(msta->pri_link)))
+- msta->sec_link = __ffs(sta->valid_links & ~(BIT(msta->pri_link)));
+- else
+- msta->sec_link = msta->pri_link;
++ /* update primary and secondary link */
++ pri_changed = mlink->wcid.link_id == msta->pri_link;
++ if (pri_changed)
++ msta->pri_link = msta->sec_link;
++
++ if (valid_links & ~(BIT(msta->pri_link)))
++ msta->sec_link = __ffs(valid_links & ~(BIT(msta->pri_link)));
++ else
++ msta->sec_link = msta->pri_link;
++
++ if (pri_changed) {
++ struct mt7996_link_sta *mlink_new =
++ mlink_dereference_protected(msta, msta->pri_link);
++
++ if (!mlink_new)
++ goto done;
++
++ mlink_new->wcid.ampdu_state = mlink->wcid.ampdu_state;
++ for (i = 0; i < ARRAY_SIZE(mlink->wcid.aggr); i++)
++ rcu_assign_pointer(mlink_new->wcid.aggr[i], mlink->wcid.aggr[i]);
++ for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
++ struct mt76_txq *mtxq;
++
++ if (!sta->txq[i])
++ continue;
++ mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
++ mtxq->wcid = mlink_new->wcid.idx;
++ }
+ }
+
++done:
+ mt76_wcid_cleanup(&dev->mt76, &mlink->wcid);
+ mt76_wcid_mask_clear(dev->mt76.wcid_mask, mlink->wcid.idx);
+ mt76_wcid_mask_clear(dev->mt76.wcid_phy_mask, mlink->wcid.idx);
+@@ -3104,9 +3146,15 @@ mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ mt76_vif_dbg(vif, "STA %pM old=0x%x, new=0x%x\n", sta->addr, old_links, new_links);
+ mutex_lock(&dev->mt76.mutex);
+
+- if (rem)
++ if (rem) {
+ mt7996_mac_sta_remove_links(dev, vif, sta, rem);
+
++ /* Todo: update hw info of MLD STA */
++ /* ret = mt7996_mcu_add_mld_sta(dev, vif, sta, new_links); */
++ /* if (ret) */
++ /* goto remove; */
++ }
++
+ ret = mt7996_mac_sta_add_links(dev, vif, sta, add, false);
+ if (ret)
+ goto remove;
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 4310d35b..662e4f02 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -1350,6 +1350,48 @@ mt7996_mcu_pp_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ }
+ }
+
++static void
++mt7996_mcu_mld_reconf_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
++{
++ struct mt7996_mld_event_data *data = priv;
++ struct mt7996_mcu_mld_ap_reconf_event *reconf = (void *)data->data;
++
++ if (!ether_addr_equal(vif->addr, data->mld_addr))
++ return;
++
++ ieee80211_links_removed(vif, le16_to_cpu(reconf->link_bitmap));
++}
++
++static void
++mt7996_mcu_mld_event(struct mt7996_dev *dev, struct sk_buff *skb)
++{
++ struct mt7996_mcu_mld_event *event = (void *)skb->data;
++ struct mt7996_mld_event_data data = {};
++ struct tlv *tlv;
++ int len;
++
++ memcpy(data.mld_addr, event->mld_addr, ETH_ALEN);
++ skb_pull(skb, sizeof(*event));
++ tlv = (struct tlv *)skb->data;
++ len = skb->len;
++
++ while (len > 0 && le16_to_cpu(tlv->len) <= len) {
++ switch (le16_to_cpu(tlv->tag)) {
++ case UNI_EVENT_MLD_RECONF_AP_REM_TIMER:
++ data.data = (u8 *)tlv;
++ ieee80211_iterate_active_interfaces_atomic(dev->mt76.hw,
++ IEEE80211_IFACE_ITER_RESUME_ALL,
++ mt7996_mcu_mld_reconf_finish, &data);
++ break;
++ default:
++ break;
++ }
++
++ len -= le16_to_cpu(tlv->len);
++ tlv = (struct tlv *)((u8 *)(tlv) + le16_to_cpu(tlv->len));
++ }
++}
++
+ static void
+ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+@@ -1378,6 +1420,9 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ case MCU_UNI_EVENT_PP:
+ mt7996_mcu_pp_event(dev, skb);
+ break;
++ case MCU_UNI_EVENT_MLD:
++ mt7996_mcu_mld_event(dev, skb);
++ break;
+ #ifdef CONFIG_MTK_DEBUG
+ case MCU_UNI_EVENT_SR:
+ mt7996_mcu_rx_sr_event(dev, skb);
+@@ -3169,6 +3214,44 @@ out:
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+ }
+
++int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, unsigned long add)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ u8 link_id;
++
++ if (!sta->mlo)
++ return 0;
++
++ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++ struct mt7996_link_sta *mlink =
++ mlink_dereference_protected(msta, link_id);
++ struct sk_buff *skb;
++ int ret;
++
++ if (!mconf || !mlink)
++ continue;
++
++ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
++ &mlink->wcid,
++ MT7996_STA_UPDATE_MAX_SIZE);
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++ /* starec mld setup */
++ mt7996_mcu_sta_mld_setup_tlv(dev, skb, sta, add);
++ /* starec eht mld */
++ mt7996_mcu_sta_eht_mld_tlv(dev, skb, sta);
++ ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
++ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
++ if (ret)
++ return ret;
++ }
++ return 0;
++}
++
+ int mt7996_mcu_teardown_mld_sta(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
+ struct mt7996_link_sta *mlink)
+@@ -3381,6 +3464,51 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
+ &data, sizeof(data), true);
+ }
+
++static int
++mt7996_mcu_mld_reconf(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ u16 removed_links, u16 *removal_count)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mld_req_hdr hdr = { .mld_idx = 0xff };
++ struct mld_reconf_timer *rt;
++ struct sk_buff *skb;
++ struct tlv *tlv;
++ int len = sizeof(hdr) + sizeof(*rt);
++ unsigned long rem = removed_links;
++ u8 link_id;
++
++ memcpy(hdr.mld_addr, vif->addr, ETH_ALEN);
++
++ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, len);
++ if (!skb)
++ return -ENOMEM;
++
++ skb_put_data(skb, &hdr, sizeof(hdr));
++
++ tlv = mt7996_mcu_add_uni_tlv(skb, UNI_CMD_MLD_RECONF_AP_REM_TIMER, sizeof(*rt));
++ rt = (struct mld_reconf_timer *)tlv;
++ rt->link_bitmap = cpu_to_le16(removed_links);
++
++ for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct ieee80211_bss_conf *conf =
++ link_conf_dereference_protected(vif, link_id);
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++ u8 band_idx;
++ u16 to_sec;
++
++ if (!conf || !mconf)
++ continue;
++
++ band_idx = mconf->phy->mt76->band_idx;
++ to_sec = conf->beacon_int * removal_count[link_id] / 1000;
++ rt->to_sec[band_idx] = cpu_to_le16(to_sec);
++ rt->bss_idx[band_idx] = mconf->mt76.idx;
++ }
++
++ return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(MLD), true);
++}
++
+ static void
+ mt7996_mcu_beacon_cntdwn(struct ieee80211_bss_conf *conf, struct sk_buff *rskb,
+ struct sk_buff *skb,
+@@ -3575,6 +3703,94 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ mt7996_packet_log_to_host(dev, skb->data, skb->len, PKT_BIN_DEBUG_TX, 0);
+ }
+
++static void
++mt7996_mcu_beacon_ml_reconf(struct mt7996_dev *dev,
++ struct ieee80211_bss_conf *conf,
++ struct sk_buff *rskb, struct sk_buff *skb,
++ struct ieee80211_mutable_offsets *offs)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv;
++ struct bss_bcn_ml_reconf_tlv *reconf;
++ struct bss_bcn_ml_reconf_offset *reconf_offs;
++ const struct element *elem, *sub;
++ struct tlv *tlv;
++ u16 removal_offs[IEEE80211_MLD_MAX_NUM_LINKS] = {};
++ u16 removal_count[IEEE80211_MLD_MAX_NUM_LINKS] = {};
++ u16 tail_offset = offs->tim_offset + offs->tim_length;
++ unsigned long removed_links = 0;
++ bool has_reconf = false;
++ u8 link_id, *beacon_tail = skb->data + tail_offset;
++
++ if (!ieee80211_vif_is_mld(conf->vif))
++ return;
++
++ /* TODO: currently manually parse reconf info directly from the IE, it
++ * is expected to be passed from upper layer in the future.
++ */
++ for_each_element_extid(elem, WLAN_EID_EXT_EHT_MULTI_LINK,
++ beacon_tail, skb->len - tail_offset) {
++ if (ieee80211_mle_type_ok(elem->data + 1,
++ IEEE80211_ML_CONTROL_TYPE_RECONF,
++ elem->datalen - 1)) {
++ has_reconf = true;
++ break;
++ }
++ }
++
++ if (!has_reconf)
++ return;
++
++ for_each_mle_subelement(sub, elem->data + 1, elem->datalen - 1) {
++ struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data;
++ u8 *pos = prof->variable;
++ u16 control;
++
++ if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE)
++ continue;
++
++ if (!ieee80211_mle_reconf_sta_prof_size_ok(sub->data,
++ sub->datalen))
++ return;
++
++ control = le16_to_cpu(prof->control);
++ link_id = control & IEEE80211_MLE_STA_RECONF_CONTROL_LINK_ID;
++
++ removed_links |= BIT(link_id);
++
++ if (control & IEEE80211_MLE_STA_RECONF_CONTROL_STA_MAC_ADDR_PRESENT)
++ pos += 6;
++
++ if (control & IEEE80211_MLE_STA_RECONF_CONTROL_AP_REM_TIMER_PRESENT) {
++ removal_offs[link_id] = pos - skb->data;
++ removal_count[link_id] = le16_to_cpu(*(__le16 *)pos);
++ }
++ }
++
++ if (!removed_links)
++ return;
++
++ /* the first link to be removed */
++ if (conf->link_id == ffs(removed_links) - 1)
++ mt7996_mcu_mld_reconf(dev, conf->vif, removed_links, removal_count);
++
++ tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_ML_RECONF,
++ sizeof(*reconf) +
++ sizeof(*reconf_offs) * hweight16(removed_links));
++ reconf = (struct bss_bcn_ml_reconf_tlv *)tlv;
++ reconf->reconf_count = hweight16(removed_links);
++
++ reconf_offs = (struct bss_bcn_ml_reconf_offset *)reconf->offset;
++ for_each_set_bit(link_id, &removed_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++
++ reconf_offs->ap_removal_timer_offs =
++ cpu_to_le16(removal_offs[link_id]);
++ reconf_offs->bss_idx = mconf->mt76.idx;
++ reconf_offs++;
++ }
++}
++
+ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, int en)
+@@ -3628,6 +3844,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ mt7996_mcu_beacon_cntdwn(conf, rskb, skb, &offs);
+ mt7996_mcu_beacon_sta_prof_csa(rskb, conf, &offs);
+ mt7996_mcu_beacon_crit_update(rskb, skb, conf, mconf, &offs);
++ mt7996_mcu_beacon_ml_reconf(dev, conf, rskb, skb, &offs);
+ out:
+ dev_kfree_skb(skb);
+ return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 739e357c..7c559d2b 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -546,6 +546,20 @@ struct bss_bcn_sta_prof_cntdwn_tlv {
+ u8 pkt_content[9];
+ } __packed;
+
++struct bss_bcn_ml_reconf_tlv {
++ __le16 tag;
++ __le16 len;
++ u8 reconf_count;
++ u8 rsv[3];
++ u8 offset[];
++} __packed;
++
++struct bss_bcn_ml_reconf_offset {
++ __le16 ap_removal_timer_offs;
++ u8 bss_idx;
++ u8 rsv;
++} __packed;
++
+ struct bss_txcmd_tlv {
+ __le16 tag;
+ __le16 len;
+@@ -594,6 +608,17 @@ struct bss_mld_tlv {
+ u8 __rsv[3];
+ } __packed;
+
++struct bss_mld_link_op_tlv {
++ __le16 tag;
++ __le16 len;
++ u8 group_mld_id;
++ u8 own_mld_id;
++ u8 mac_addr[ETH_ALEN];
++ u8 remap_idx;
++ u8 link_operation;
++ u8 rsv[2];
++} __packed;
++
+ struct sta_rec_ht_uni {
+ __le16 tag;
+ __le16 len;
+@@ -1003,8 +1028,9 @@ enum {
+ sizeof(struct bss_bcn_cntdwn_tlv) + \
+ sizeof(struct bss_bcn_mbss_tlv) + \
+ sizeof(struct bss_bcn_crit_update_tlv) + \
+- sizeof(struct bss_bcn_sta_prof_cntdwn_tlv)) \
+-
++ sizeof(struct bss_bcn_sta_prof_cntdwn_tlv) + \
++ sizeof(struct bss_bcn_ml_reconf_tlv) + \
++ 3 * sizeof(struct bss_bcn_ml_reconf_offset))
+ #define MT7996_MAX_BSS_OFFLOAD_SIZE (MT7996_MAX_BEACON_SIZE + \
+ MT7996_BEACON_UPDATE_SIZE)
+
+@@ -1105,6 +1131,65 @@ enum {
+ UNI_CMD_THERMAL_PROTECT_DUTY_CONFIG,
+ };
+
++struct mld_req_hdr {
++ u8 ver;
++ u8 mld_addr[ETH_ALEN];
++ u8 mld_idx;
++ u8 flag;
++ u8 rsv[3];
++ u8 buf[];
++} __packed;
++
++struct mld_reconf_timer {
++ __le16 tag;
++ __le16 len;
++ __le16 link_bitmap;
++ __le16 to_sec[__MT_MAX_BAND]; /* timeout of reconf (second) */
++ u8 bss_idx[__MT_MAX_BAND];
++ u8 rsv;
++} __packed;
++
++struct mld_reconf_stop_link {
++ __le16 tag;
++ __le16 len;
++ __le16 link_bitmap;
++ u8 rsv[2];
++ u8 bss_idx[16];
++} __packed;
++
++enum {
++ UNI_CMD_MLD_RECONF_AP_REM_TIMER = 0x03,
++};
++
++struct mt7996_mcu_mld_event {
++ struct mt7996_mcu_rxd rxd;
++
++ /* fixed field */
++ u8 ver;
++ u8 mld_addr[ETH_ALEN];
++ u8 mld_idx;
++ u8 rsv[4];
++ /* tlv */
++ u8 buf[];
++} __packed;
++
++struct mt7996_mld_event_data {
++ u8 mld_addr[ETH_ALEN];
++ u8 *data;
++};
++
++struct mt7996_mcu_mld_ap_reconf_event {
++ __le16 tag;
++ __le16 len;
++ __le16 link_bitmap;
++ u8 bss_idx[3];
++ u8 rsv[3];
++} __packed;
++
++enum {
++ UNI_EVENT_MLD_RECONF_AP_REM_TIMER = 0x04,
++};
++
+ struct tx_power_ctrl {
+ u8 _rsv[4];
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 8b00b05b..6f9f82b7 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1083,6 +1083,8 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_link_sta *link_sta,
+ struct mt7996_link_sta *mlink, bool changed);
++int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, unsigned long add);
+ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef);
+ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag, bool sta);
+ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0183-mtk-mt76-mt7996-add-support-for-AP-A-TTLM.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0183-mtk-mt76-mt7996-add-support-for-AP-A-TTLM.patch
new file mode 100644
index 0000000..62f46d7
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0183-mtk-mt76-mt7996-add-support-for-AP-A-TTLM.patch
@@ -0,0 +1,356 @@
+From 35f9165b9c803d17bdf96668001f64461b9fa3e2 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 28 Jun 2024 13:45:15 +0800
+Subject: [PATCH 183/199] mtk: mt76: mt7996: add support for AP A-TTLM
+
+This add support for AP A-TTLM support by following actions
+1. request at2lm resource to FW and get switch time TSF value
+2. handle 2 events from FW and send notification to higher layer:
+ switch time erxpired and AT2LM end
+3. provide TTLM offset to FW if TTLM needs count down.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt76_connac_mcu.h | 1 +
+ mt7996/main.c | 14 +++++
+ mt7996/mcu.c | 152 +++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/mcu.h | 46 ++++++++++++++
+ mt7996/mt7996.h | 2 +
+ 5 files changed, 214 insertions(+), 1 deletion(-)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index fd1bf1d1..01dbe0e5 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1396,6 +1396,7 @@ enum {
+ UNI_BSS_INFO_BCN_CRIT_UPDATE = 32,
+ UNI_BSS_INFO_BCN_STA_PROF_CSA = 37,
+ UNI_BSS_INFO_BCN_ML_RECONF = 38,
++ UNI_BSS_INFO_BCN_ATTLM = 39,
+ };
+
+ enum {
+diff --git a/mt7996/main.c b/mt7996/main.c
+index fc6f4ef9..0e5e9a51 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -3167,6 +3167,19 @@ out:
+ return ret;
+ }
+
++static int
++mt7996_set_attlm(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ u16 disabled_links, u16 switch_time, u32 duration)
++{
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ int ret;
++
++ mutex_lock(&dev->mt76.mutex);
++ ret = mt7996_mcu_mld_set_attlm(dev, vif, disabled_links, switch_time, duration);
++ mutex_unlock(&dev->mt76.mutex);
++ return ret;
++}
++
+ static void
+ mt7996_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ const struct ieee80211_event *event)
+@@ -3327,4 +3340,5 @@ const struct ieee80211_ops mt7996_ops = {
+ .change_vif_links = mt7996_change_vif_links,
+ .change_sta_links = mt7996_change_sta_links,
+ .set_qos_map = mt7996_set_qos_map,
++ .set_attlm = mt7996_set_attlm,
+ };
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 662e4f02..ce2168e8 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -1362,6 +1362,22 @@ mt7996_mcu_mld_reconf_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ ieee80211_links_removed(vif, le16_to_cpu(reconf->link_bitmap));
+ }
+
++static void
++mt7996_mcu_mld_attlm_event(void *priv, u8 *mac, struct ieee80211_vif *vif)
++{
++ struct mt7996_mld_event_data *data = priv;
++ struct mt7996_mcu_mld_attlm_timeout_event *ttlm = (void *)data->data;
++
++ if (!ether_addr_equal(vif->addr, data->mld_addr))
++ return;
++
++ /*
++ * TODO: Remap the FW event type to MAC80211 event type.
++ * For now, we align it because this is a proprietary implementation.
++ */
++ ieee80211_attlm_notify(vif, 0, ttlm->event_type, GFP_ATOMIC);
++}
++
+ static void
+ mt7996_mcu_mld_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+@@ -1376,9 +1392,15 @@ mt7996_mcu_mld_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ len = skb->len;
+
+ while (len > 0 && le16_to_cpu(tlv->len) <= len) {
++ data.data = (u8 *)tlv;
++
+ switch (le16_to_cpu(tlv->tag)) {
++ case UNI_EVENT_MLD_ATTLM_TIMEOUT:
++ ieee80211_iterate_active_interfaces_atomic(dev->mt76.hw,
++ IEEE80211_IFACE_ITER_RESUME_ALL,
++ mt7996_mcu_mld_attlm_event, &data);
++ break;
+ case UNI_EVENT_MLD_RECONF_AP_REM_TIMER:
+- data.data = (u8 *)tlv;
+ ieee80211_iterate_active_interfaces_atomic(dev->mt76.hw,
+ IEEE80211_IFACE_ITER_RESUME_ALL,
+ mt7996_mcu_mld_reconf_finish, &data);
+@@ -3509,6 +3531,91 @@ mt7996_mcu_mld_reconf(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(MLD), true);
+ }
+
++int mt7996_mcu_mld_set_attlm(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ u16 disabled_links, u16 switch_time, u32 duration)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mld_req_hdr hdr = { .mld_idx = 0xff };
++ struct mld_attlm_req *req;
++ struct mt7996_mcu_mld_attlm_resp_event *resp;
++ struct sk_buff *skb, *rskb;
++ struct tlv *tlv;
++ int len = sizeof(hdr) + sizeof(*req), ret;
++ unsigned long valid_disabled_links =
++ (unsigned long) vif->valid_links & disabled_links;
++ u8 link_id;
++ bool bss_idx_set = false;
++
++ memcpy(hdr.mld_addr, vif->addr, ETH_ALEN);
++
++ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, len);
++ if (!skb)
++ return -ENOMEM;
++
++ skb_put_data(skb, &hdr, sizeof(hdr));
++ tlv = mt7996_mcu_add_uni_tlv(skb, UNI_CMD_MLD_ATTLM_RES_REQ, sizeof(*req));
++ req = (struct mld_attlm_req *)tlv;
++
++ req->attlm_idx = 0;
++ req->mst_timer = 1;
++ req->e_timer = 1;
++ req->mst_timer_adv_time = cpu_to_le16(50);
++ req->e_timer_adv_time = cpu_to_le16(0);
++ req->mst_duration = cpu_to_le32(switch_time * USEC_PER_MSEC);
++ req->e_duration = cpu_to_le32(duration * USEC_PER_MSEC);
++ req->disabled_link_bitmap = cpu_to_le16(valid_disabled_links);
++ for_each_set_bit(link_id, &valid_disabled_links,
++ IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++
++ if (!mconf)
++ continue;
++
++ if (!bss_idx_set) {
++ req->bss_idx = mconf->mt76.idx;
++ bss_idx_set = true;
++ }
++
++ req->disabled_bss_idx[link_id] = mconf->mt76.idx;
++ }
++
++ if (!bss_idx_set) {
++ dev_kfree_skb(skb);
++ return -ENOLINK;
++ }
++
++ ret = mt76_mcu_skb_send_and_get_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(MLD),
++ true, &rskb);
++
++ if (ret)
++ return ret;
++
++ skb_pull(rskb, sizeof(struct mt7996_mcu_mld_event) - sizeof(struct mt7996_mcu_rxd));
++ resp = (struct mt7996_mcu_mld_attlm_resp_event *)rskb->data;
++ switch(le16_to_cpu(resp->tag)) {
++ case UNI_EVENT_MLD_ATTLM_RES_RSP: {
++ u32 tsf_0, tsf_1;
++ u64 switch_time_tsf;
++ u16 switch_time_tsf_tu;
++
++ tsf_0 = le32_to_cpu(resp->switch_time_tsf[0]);
++ tsf_1 = le32_to_cpu(resp->switch_time_tsf[1]);
++ switch_time_tsf = (u64)tsf_0 + ((u64)tsf_1 << 32);
++ switch_time_tsf_tu = (u16)u64_get_bits(switch_time_tsf,
++ GENMASK_ULL(25, 10));
++ ieee80211_attlm_notify(vif, switch_time_tsf_tu,
++ NL80211_ATTLM_STARTED, GFP_KERNEL);
++ break;
++ }
++ default:
++ break;
++ }
++
++ dev_kfree_skb(rskb);
++ return ret;
++}
++
+ static void
+ mt7996_mcu_beacon_cntdwn(struct ieee80211_bss_conf *conf, struct sk_buff *rskb,
+ struct sk_buff *skb,
+@@ -3791,6 +3898,48 @@ mt7996_mcu_beacon_ml_reconf(struct mt7996_dev *dev,
+ }
+ }
+
++static void
++mt7996_mcu_beacon_ttlm(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
++ struct sk_buff *rskb, struct sk_buff *skb,
++ struct ieee80211_mutable_offsets *offs)
++{
++ u16 offset = 0, tail_offset = offs->tim_offset + offs->tim_length;
++ struct bss_bcn_attlm_offset_tlv *attlm_offset;
++ u8 *beacon_tail = skb->data + tail_offset;
++ const struct element *elem;
++ struct ieee80211_ttlm_elem *ttlm;
++ bool cntdown_ttlm = false;
++ struct tlv *tlv;
++
++ if (!ieee80211_vif_is_mld(conf->vif))
++ return;
++
++ for_each_element_extid(elem, WLAN_EID_EXT_TID_TO_LINK_MAPPING,
++ beacon_tail, skb->len - tail_offset) {
++ if (ieee80211_tid_to_link_map_size_ok(elem->data + 1,
++ elem->datalen - 1)) {
++ ttlm = (struct ieee80211_ttlm_elem *)elem->data + 1;
++ if (!(ttlm->control &
++ IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT) &&
++ (ttlm->control &
++ IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT)) {
++ offset = (u8 *)elem - skb->data;
++ cntdown_ttlm = true;
++ break;
++ }
++ }
++ }
++
++ if (!cntdown_ttlm)
++ return;
++
++ tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_ATTLM,
++ sizeof(*attlm_offset));
++ attlm_offset = (struct bss_bcn_attlm_offset_tlv *)tlv;
++ attlm_offset->valid_id_bitmap = BIT(0);
++ attlm_offset->offset = cpu_to_le16(offset);
++}
++
+ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, int en)
+@@ -3845,6 +3994,7 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ mt7996_mcu_beacon_sta_prof_csa(rskb, conf, &offs);
+ mt7996_mcu_beacon_crit_update(rskb, skb, conf, mconf, &offs);
+ mt7996_mcu_beacon_ml_reconf(dev, conf, rskb, skb, &offs);
++ mt7996_mcu_beacon_ttlm(dev, conf, rskb, skb, &offs);
+ out:
+ dev_kfree_skb(skb);
+ return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 7c559d2b..0f2695eb 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -560,6 +560,14 @@ struct bss_bcn_ml_reconf_offset {
+ u8 rsv;
+ } __packed;
+
++struct bss_bcn_attlm_offset_tlv {
++ __le16 tag;
++ __le16 len;
++ u8 valid_id_bitmap;
++ u8 rsv;
++ __le16 offset;
++} __packed;
++
+ struct bss_txcmd_tlv {
+ __le16 tag;
+ __le16 len;
+@@ -1140,6 +1148,22 @@ struct mld_req_hdr {
+ u8 buf[];
+ } __packed;
+
++struct mld_attlm_req {
++ __le16 tag;
++ __le16 len;
++ u8 attlm_idx;
++ u8 bss_idx;
++ u8 mst_timer;
++ u8 e_timer;
++ __le16 mst_timer_adv_time;
++ __le16 e_timer_adv_time;
++ __le32 mst_duration;
++ __le32 e_duration;
++ __le16 disabled_link_bitmap;
++ u8 disabled_bss_idx[16];
++ u8 rsv[2];
++} __packed;
++
+ struct mld_reconf_timer {
+ __le16 tag;
+ __le16 len;
+@@ -1158,6 +1182,7 @@ struct mld_reconf_stop_link {
+ } __packed;
+
+ enum {
++ UNI_CMD_MLD_ATTLM_RES_REQ = 0x02,
+ UNI_CMD_MLD_RECONF_AP_REM_TIMER = 0x03,
+ };
+
+@@ -1178,6 +1203,25 @@ struct mt7996_mld_event_data {
+ u8 *data;
+ };
+
++struct mt7996_mcu_mld_attlm_resp_event {
++ __le16 tag;
++ __le16 len;
++ u8 status;
++ u8 attlm_idx;
++ u8 bss_idx;
++ u8 rsv;
++ __le32 switch_time_tsf[2];
++ __le32 end_tsf[2];
++} __packed;
++
++struct mt7996_mcu_mld_attlm_timeout_event {
++ __le16 tag;
++ __le16 len;
++ u8 attlm_idx;
++ u8 event_type;
++ u8 rsv[2];
++} __packed;
++
+ struct mt7996_mcu_mld_ap_reconf_event {
+ __le16 tag;
+ __le16 len;
+@@ -1187,6 +1231,8 @@ struct mt7996_mcu_mld_ap_reconf_event {
+ } __packed;
+
+ enum {
++ UNI_EVENT_MLD_ATTLM_RES_RSP = 0x02,
++ UNI_EVENT_MLD_ATTLM_TIMEOUT = 0x03,
+ UNI_EVENT_MLD_RECONF_AP_REM_TIMER = 0x04,
+ };
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 6f9f82b7..2ee46583 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1154,6 +1154,8 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
+ enum vow_drr_ctrl_id id);
+ int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy);
+ void mt7996_mcu_wmm_pbc_work(struct work_struct *work);
++int mt7996_mcu_mld_set_attlm(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ u16 disabled_links, u16 switch_time, u32 duration);
+
+ static inline u8 mt7996_max_interface_num(struct mt7996_dev *dev)
+ {
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0184-mtk-mt76-mt7996-leave-ps-when-4-address-is-establish.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0184-mtk-mt76-mt7996-leave-ps-when-4-address-is-establish.patch
new file mode 100644
index 0000000..de63b5e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0184-mtk-mt76-mt7996-leave-ps-when-4-address-is-establish.patch
@@ -0,0 +1,108 @@
+From 68822b5e5ef48ad096a57a2366b231b7ee9af9c6 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Thu, 18 Jul 2024 10:29:22 +0800
+Subject: [PATCH 184/199] mtk: mt76: mt7996: leave ps when 4 address is
+ established
+
+Because the 4 address non-amsdu packet does not have bssid field, the
+hardware cannot get the bssid. Without bssid, the station's are not able
+leave PS mode due to HW design. Wake up non-setup link when receiving
+4 address null data to prevent this issue.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76_connac_mcu.h | 1 +
+ mt7996/main.c | 3 +++
+ mt7996/mcu.c | 18 ++++++++++++++++++
+ mt7996/mcu.h | 6 ++++++
+ mt7996/mt7996.h | 2 ++
+ 5 files changed, 30 insertions(+)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 01dbe0e5..eb738f4f 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -838,6 +838,7 @@ enum {
+ STA_REC_EML_OP = 0x29,
+ STA_REC_HDR_TRANS = 0x2B,
+ STA_REC_TX_CAP = 0x2f,
++ STA_REC_PS_LEAVE = 0x45,
+ STA_REC_MAX_NUM
+ };
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 0e5e9a51..8398151d 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2077,6 +2077,9 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
+ clear_bit(MT_WCID_FLAG_4ADDR, &mlink->wcid.flags);
+
+ mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, mlink);
++
++ if (msta->pri_link != link_id && is_mt7996(&dev->mt76))
++ mt7996_mcu_ps_leave(dev, mconf, mlink);
+ }
+ mutex_unlock(&dev->mt76.mutex);
+ }
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index ce2168e8..0af0ca82 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -6247,6 +6247,24 @@ int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+ }
+
++int mt7996_mcu_ps_leave(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf,
++ struct mt7996_link_sta *mlink)
++{
++ struct sk_buff *skb;
++
++ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
++ &mlink->wcid,
++ MT7996_STA_UPDATE_MAX_SIZE);
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++
++ mt76_connac_mcu_add_tlv(skb, STA_REC_PS_LEAVE,
++ sizeof(struct sta_rec_ps_leave));
++
++ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
++ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
++}
++
+ int mt7996_mcu_set_fixed_rate_table(struct mt7996_phy *phy, u8 table_idx,
+ u16 rate_idx, bool beacon)
+ {
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 0f2695eb..ffa574b8 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -775,6 +775,12 @@ struct sta_rec_hdr_trans {
+ u8 mesh;
+ } __packed;
+
++struct sta_rec_ps_leave {
++ __le16 tag;
++ __le16 len;
++ u8 __rsv[4];
++} __packed;
++
+ struct sta_rec_mld_setup {
+ __le16 tag;
+ __le16 len;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 2ee46583..c1823759 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1277,6 +1277,8 @@ int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
+ struct ieee80211_vif *vif,
+ struct mt7996_bss_conf *mconf,
+ struct mt7996_link_sta *mlink);
++int mt7996_mcu_ps_leave(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf,
++ struct mt7996_link_sta *mlink);
+ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
+ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
+ int mt7996_mcu_set_pp_sta_dscb(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0185-mtk-mt76-mt7996-add-debugfs-knob-to-set-and-dump-txo.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0185-mtk-mt76-mt7996-add-debugfs-knob-to-set-and-dump-txo.patch
new file mode 100644
index 0000000..222353c
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0185-mtk-mt76-mt7996-add-debugfs-knob-to-set-and-dump-txo.patch
@@ -0,0 +1,156 @@
+From 32991b1ffa0cefe38be1adc97c2effb4a27bcc28 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Wed, 17 Jul 2024 16:57:24 +0800
+Subject: [PATCH 185/199] mtk: mt76: mt7996: add debugfs knob to set and dump
+ txop
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/mtk_debug_i.h | 8 ++++
+ mt7996/mtk_debugfs_i.c | 104 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 112 insertions(+)
+
+diff --git a/mt7996/mtk_debug_i.h b/mt7996/mtk_debug_i.h
+index cec8d57e..01023e16 100644
+--- a/mt7996/mtk_debug_i.h
++++ b/mt7996/mtk_debug_i.h
+@@ -1006,6 +1006,14 @@
+ /* AGG */
+ #define MT_AGG_REMAP_CTRL(_band) MT_WF_AGG(_band, 0x094)
+ #define MT_AGG_REMAP_CTRL_OM_REMAP GENMASK(5, 0)
++
++/* TMAC */
++#define MT_WF_TMAC_WMM0_OFFSET 0x0c4
++#define MT_WF_TMAC_WMM1_OFFSET 0x364
++#define MT_WF_TMAC_WMM2_OFFSET 0x36c
++#define MT_WF_TMAC_WMM3_OFFSET 0x374
++#define MT_WF_TMAC_WMM_TXOP_MASK GENMASK(31, 16)
++#define MT_WF_TMAC_WMM_TXOP_SHIFT 16
+ #endif
+
+ #endif
+diff --git a/mt7996/mtk_debugfs_i.c b/mt7996/mtk_debugfs_i.c
+index 852d1b12..c9224eee 100644
+--- a/mt7996/mtk_debugfs_i.c
++++ b/mt7996/mtk_debugfs_i.c
+@@ -824,6 +824,109 @@ static const struct file_operations fops_mlo_agc_tx = {
+ .llseek = default_llseek,
+ };
+
++static ssize_t mt7996_be_txop_set(struct file *file,
++ const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_dev *dev = file->private_data;
++ char buf[100], role[4];
++ u32 ofs;
++ u16 txop, decimal;
++ int i = 0;
++
++ if (count >= sizeof(buf))
++ return -EINVAL;
++
++ if (copy_from_user(buf, user_buf, count))
++ return -EFAULT;
++
++ if (count && buf[count - 1] == '\n')
++ buf[count - 1] = '\0';
++ else
++ buf[count] = '\0';
++
++ if (sscanf(buf, "%3s %hu.%hu", role, &txop, &decimal) != 3)
++ goto err;
++
++ if (!strncmp(role, "ap", 2))
++ ofs = MT_WF_TMAC_WMM0_OFFSET;
++ else if (!strncmp(role, "sta", 3))
++ ofs = MT_WF_TMAC_WMM3_OFFSET;
++ else
++ goto err;
++
++ /* Change unit to 32 us */
++ txop = (txop * 1000 + decimal * 100 + 16) >> 5;
++
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ if (!dev->mt76.phys[i])
++ continue;
++
++ mt76_rmw(dev, MT_WF_TMAC(i, ofs), MT_WF_TMAC_WMM_TXOP_MASK,
++ txop << MT_WF_TMAC_WMM_TXOP_SHIFT);
++ }
++
++ return count;
++err:
++ dev_warn(dev->mt76.dev,
++ "format: [ap|sta] [tx_queue_data2_burst]\n");
++ return -EINVAL;
++}
++
++static ssize_t mt7996_be_txop_dump(struct file *file, char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct mt7996_dev *dev = file->private_data;
++ static const size_t size = 2048;
++ int len = 0, i, ret;
++ char *buf;
++ enum {
++ AP,
++ STA,
++ MAX_IF_TYPE,
++ };
++
++ buf = kzalloc(size, GFP_KERNEL);
++ if (!buf)
++ return -ENOMEM;
++
++ len += scnprintf(buf + len, size - len, "Band\tAP (WMM0)\t\tSTA (WMM3)\n");
++
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ u32 txop[MAX_IF_TYPE], tx_burst[MAX_IF_TYPE];
++
++ if (!dev->mt76.phys[i])
++ continue;
++
++#define MT7996_READ_TXOP(role, base) \
++do { \
++ txop[role] = mt76_rr(dev, MT_WF_TMAC(i, base)); \
++ tx_burst[role] = u32_get_bits(txop[role], MT_WF_TMAC_WMM_TXOP_MASK); \
++ tx_burst[role] = tx_burst[role] ? ((tx_burst[role] << 5) - 16) / 100 : 0;\
++} while (0)
++ MT7996_READ_TXOP(AP, MT_WF_TMAC_WMM0_OFFSET);
++ MT7996_READ_TXOP(STA, MT_WF_TMAC_WMM3_OFFSET);
++#undef MT7996_READ_TXOP
++
++ len += scnprintf(buf + len, size - len,
++ "%d\t0x%08x (%1u.%1u) \t0x%08x (%1u.%1u)\n", i,
++ txop[AP], tx_burst[AP] / 10, tx_burst[AP] % 10,
++ txop[STA], tx_burst[STA] / 10, tx_burst[STA] % 10);
++ }
++ ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
++
++ kfree(buf);
++ return ret;
++}
++
++static const struct file_operations fops_mt7996_txop = {
++ .write = mt7996_be_txop_set,
++ .read = mt7996_be_txop_dump,
++ .open = simple_open,
++ .owner = THIS_MODULE,
++ .llseek = default_llseek,
++};
++
+ static ssize_t mt7996_mlo_agc_trig_set(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+@@ -893,6 +996,7 @@ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *
+ mt7996_pse_fid_read);
+
+ debugfs_create_u8("dump_ple_txd", 0600, dir, &dev->dbg.dump_ple_txd);
++ debugfs_create_file("txop", 0600, dir, dev, &fops_mt7996_txop);
+
+ /* MLO related Table */
+ debugfs_create_file("mat_table", 0400, dir, dev, &mt7996_mat_table_fops);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0186-mtk-mt76-mt7996-add-mcu-command-to-set-bssid-mapping.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0186-mtk-mt76-mt7996-add-mcu-command-to-set-bssid-mapping.patch
new file mode 100644
index 0000000..1530414
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0186-mtk-mt76-mt7996-add-mcu-command-to-set-bssid-mapping.patch
@@ -0,0 +1,107 @@
+From 073ba6d0288ea53059ec280b7789a2cbf25ba03f Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Mon, 22 Jul 2024 10:47:45 +0800
+Subject: [PATCH 186/199] mtk: mt76: mt7996: add mcu command to set bssid
+ mapping address
+
+When receiving 4 address non-amsdu packet, there is no bssid in the address
+field. Set mcu command to use A1 as bssid when receiving 4 address non-amsdu
+packet.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt7996/init.c | 7 +++++++
+ mt7996/mcu.c | 26 ++++++++++++++++++++++++++
+ mt7996/mcu.h | 1 +
+ mt7996/mt7996.h | 1 +
+ 4 files changed, 35 insertions(+)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index f923ce66..25f772af 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -539,6 +539,9 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band)
+ {
+ u32 mask, set;
+
++ if (!mt7996_band_valid(dev, band))
++ return;
++
+ /* clear estimated value of EIFS for Rx duration & OBSS time */
+ mt76_wr(dev, MT_WF_RMAC_RSVD0(band), MT_WF_RMAC_RSVD0_EIFS_CLR);
+
+@@ -566,6 +569,10 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band)
+ * MT_AGG_ACR_PPDU_TXS2H (PPDU format) even though ACR bit is set.
+ */
+ mt76_set(dev, MT_AGG_ACR4(band), MT_AGG_ACR_PPDU_TXS2H);
++
++
++ if (!is_mt7996(&dev->mt76))
++ mt7996_mcu_set_bssid_mapping_addr(&dev->mt76, band);
+ }
+
+ static void mt7996_mac_init_basic_rates(struct mt7996_dev *dev)
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 0af0ca82..ead9ff4f 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -6117,6 +6117,32 @@ int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
+ &req, sizeof(req), true);
+ }
+
++int mt7996_mcu_set_bssid_mapping_addr(struct mt76_dev *dev, u8 band_idx)
++{
++ enum {
++ BSSID_MAPPING_ADDR1,
++ BSSID_MAPPING_ADDR2,
++ BSSID_MAPPING_ADDR3,
++ };
++ struct {
++ u8 band_idx;
++ u8 _rsv1[3];
++
++ __le16 tag;
++ __le16 len;
++ u8 addr;
++ u8 _rsv2[3];
++ } __packed req = {
++ .band_idx = band_idx,
++ .tag = cpu_to_le16(UNI_BAND_CONFIG_BSSID_MAPPING_ADDR),
++ .len = cpu_to_le16(sizeof(req) - 4),
++ .addr = BSSID_MAPPING_ADDR1,
++ };
++
++ return mt76_mcu_send_msg(dev, MCU_WM_UNI_CMD(BAND_CONFIG),
++ &req, sizeof(req), true);
++}
++
+ int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val)
+ {
+ struct {
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index ffa574b8..5d4625c8 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1067,6 +1067,7 @@ enum {
+ UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08,
+ UNI_BAND_CONFIG_RTS_SIGTA_EN = 0x09,
+ UNI_BAND_CONFIG_DIS_SECCH_CCA_DET = 0x0a,
++ UNI_BAND_CONFIG_BSSID_MAPPING_ADDR = 0x12,
+ };
+
+ enum {
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index c1823759..e1e1160a 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1108,6 +1108,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index,
+ const struct mt7996_dfs_pattern *pattern);
+ int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable);
+ int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val);
++int mt7996_mcu_set_bssid_mapping_addr(struct mt76_dev *dev, u8 band);
+ int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct mt7996_bss_conf *mconf);
+ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch);
+ int mt7996_mcu_get_temperature(struct mt7996_phy *phy);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0187-mtk-mt76-mt7996-Temporary-fix-init-txpwoer-for-singl.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0187-mtk-mt76-mt7996-Temporary-fix-init-txpwoer-for-singl.patch
new file mode 100644
index 0000000..2941c99
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0187-mtk-mt76-mt7996-Temporary-fix-init-txpwoer-for-singl.patch
@@ -0,0 +1,51 @@
+From 3cc44ab9e52f4c5543dcf0e0dc7cd6364aa36b3d Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Mon, 22 Jul 2024 19:33:07 +0800
+Subject: [PATCH 187/199] mtk: mt76: mt7996: Temporary fix init txpwoer for
+ single wiphy
+
+This patch can be removed after the real single wiphy finished.
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+---
+ mt7996/init.c | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 25f772af..e0cbcaaa 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -373,15 +373,24 @@ static void __mt7996_init_txpower(struct mt7996_phy *phy,
+
+ void mt7996_init_txpower(struct mt7996_phy *phy)
+ {
++ struct ieee80211_hw *hw;
++ struct mt7996_phy *phy_2g, *phy_5g, *phy_6g;
++
+ if (!phy)
+ return;
+
+- if (phy->mt76->cap.has_2ghz)
+- __mt7996_init_txpower(phy, &phy->mt76->sband_2g.sband);
+- if (phy->mt76->cap.has_5ghz)
+- __mt7996_init_txpower(phy, &phy->mt76->sband_5g.sband);
+- if (phy->mt76->cap.has_6ghz)
+- __mt7996_init_txpower(phy, &phy->mt76->sband_6g.sband);
++ hw = phy->mt76->hw;
++ /* FIXME refactor after single wiphy multiple radios merged */
++ phy_2g = mt7996_band_phy(hw, NL80211_BAND_2GHZ);
++ phy_5g = mt7996_band_phy(hw, NL80211_BAND_5GHZ);
++ phy_6g = mt7996_band_phy(hw, NL80211_BAND_6GHZ);
++
++ if (phy_2g && phy_2g->mt76->cap.has_2ghz)
++ __mt7996_init_txpower(phy_2g, &phy_2g->mt76->sband_2g.sband);
++ if (phy_5g && phy_5g->mt76->cap.has_5ghz)
++ __mt7996_init_txpower(phy_5g, &phy_5g->mt76->sband_5g.sband);
++ if (phy_6g && phy_6g->mt76->cap.has_6ghz)
++ __mt7996_init_txpower(phy_6g, &phy_6g->mt76->sband_6g.sband);
+ }
+
+ static void
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0188-mtk-mt76-mt7996-Add-lpi-support-with-sku_idx-and-enh.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0188-mtk-mt76-mt7996-Add-lpi-support-with-sku_idx-and-enh.patch
new file mode 100644
index 0000000..64f6af0
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0188-mtk-mt76-mt7996-Add-lpi-support-with-sku_idx-and-enh.patch
@@ -0,0 +1,647 @@
+From 5a12177572a884d35a44d9988aa8777ef4bc52d2 Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Fri, 12 Jul 2024 16:58:57 +0800
+Subject: [PATCH 188/199] mtk: mt76: mt7996: Add lpi support with sku_idx and
+ enhancement
+
+Add lpi support with sku_idx and enhancement.
+1. Add sku index for lpi sku table
+2. Add lpi psd limit for psd country and compensate power by fw.
+3. Add lpi mode mamangement from enhancement that use 1T to transmit mgmt
+from in 80 MHz.
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+---
+ eeprom.c | 13 +++--
+ mt76.h | 7 ++-
+ mt76_connac3_mac.h | 12 +++++
+ mt7996/init.c | 2 +-
+ mt7996/mac.c | 5 ++
+ mt7996/main.c | 5 +-
+ mt7996/mcu.c | 120 +++++++++++++++++++++++++++++++++++++++----
+ mt7996/mcu.h | 1 +
+ mt7996/mt7996.h | 3 +-
+ mt7996/mtk_debugfs.c | 3 +-
+ mt7996/testmode.c | 2 +-
+ mt7996/testmode.h | 12 -----
+ mt7996/vendor.c | 116 +++++++++++++++++++++++++++++++++++++++++
+ mt7996/vendor.h | 15 ++++++
+ 14 files changed, 286 insertions(+), 30 deletions(-)
+
+diff --git a/eeprom.c b/eeprom.c
+index 3da94926..888e2d92 100644
+--- a/eeprom.c
++++ b/eeprom.c
+@@ -218,8 +218,9 @@ static bool mt76_string_prop_find(struct property *prop, const char *str)
+ }
+
+ struct device_node *
+-mt76_find_power_limits_node(struct mt76_dev *dev)
++mt76_find_power_limits_node(struct mt76_phy *phy)
+ {
++ struct mt76_dev *dev = phy->dev;
+ struct device_node *np = dev->dev->of_node;
+ const char *const region_names[] = {
+ [NL80211_DFS_UNSET] = "ww",
+@@ -229,6 +230,7 @@ mt76_find_power_limits_node(struct mt76_dev *dev)
+ };
+ struct device_node *cur, *fallback = NULL;
+ const char *region_name = NULL;
++ char index[4] = {0};
+
+ if (dev->region < ARRAY_SIZE(region_names))
+ region_name = region_names[dev->region];
+@@ -237,15 +239,20 @@ mt76_find_power_limits_node(struct mt76_dev *dev)
+ if (!np)
+ return NULL;
+
++ snprintf(index, sizeof(index), "%d", phy->sku_idx);
+ for_each_child_of_node(np, cur) {
+ struct property *country = of_find_property(cur, "country", NULL);
+ struct property *regd = of_find_property(cur, "regdomain", NULL);
++ struct property *sku_index = of_find_property(cur, "sku-index", NULL);
+
+ if (!country && !regd) {
+ fallback = cur;
+ continue;
+ }
+
++ if (phy->sku_idx && !mt76_string_prop_find(sku_index, index))
++ continue;
++
+ if (mt76_string_prop_find(country, dev->alpha2) ||
+ mt76_string_prop_find(regd, region_name)) {
+ of_node_put(np);
+@@ -322,7 +329,7 @@ mt76_apply_array_limit(s8 *pwr, size_t pwr_len, const __be32 *data,
+
+ for (i = 0; i < pwr_len; i++) {
+ pwr[i] = min_t(s8, target_power,
+- be32_to_cpu(data[i]) + nss_delta);
++ (s8)be32_to_cpu(data[i]) + nss_delta);
+ *max_power = max(*max_power, pwr[i]);
+ }
+ }
+@@ -387,7 +394,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
+ if (!IS_ENABLED(CONFIG_OF))
+ return target_power;
+
+- np = mt76_find_power_limits_node(dev);
++ np = mt76_find_power_limits_node(phy);
+ if (!np)
+ return target_power;
+
+diff --git a/mt76.h b/mt76.h
+index fa4a3e70..1858f542 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -933,6 +933,7 @@ struct mt76_phy {
+ u8 macaddr[ETH_ALEN];
+
+ int txpower_cur;
++ u8 sku_idx;
+ u8 antenna_mask;
+ u16 chainmask;
+
+@@ -1047,6 +1048,10 @@ struct mt76_dev {
+
+ u32 rxfilter;
+
++ bool lpi_psd;
++ bool lpi_bcn_enhance;
++ bool mgmt_pwr_enhance;
++
+ #ifdef CONFIG_NL80211_TESTMODE
+ const struct mt76_testmode_ops *test_ops;
+ struct {
+@@ -1810,7 +1815,7 @@ mt76_mcu_skb_send_msg(struct mt76_dev *dev, struct sk_buff *skb, int cmd,
+ void mt76_set_irq_mask(struct mt76_dev *dev, u32 addr, u32 clear, u32 set);
+
+ struct device_node *
+-mt76_find_power_limits_node(struct mt76_dev *dev);
++mt76_find_power_limits_node(struct mt76_phy *phy);
+ struct device_node *
+ mt76_find_channel_node(struct device_node *np, struct ieee80211_channel *chan);
+
+diff --git a/mt76_connac3_mac.h b/mt76_connac3_mac.h
+index ad8392cd..7bc41047 100644
+--- a/mt76_connac3_mac.h
++++ b/mt76_connac3_mac.h
+@@ -209,6 +209,18 @@ enum {
+ MT_TXS_PPDU_FMT = 2,
+ };
+
++/* BW defined in FW hal_cal_flow_rom.h */
++enum {
++ FW_CDBW_20MHZ,
++ FW_CDBW_40MHZ,
++ FW_CDBW_80MHZ,
++ FW_CDBW_160MHZ,
++ FW_CDBW_320MHZ,
++ FW_CDBW_5MHZ,
++ FW_CDBW_10MHZ,
++ FW_CDBW_8080MHZ,
++};
++
+ #define MT_CT_INFO_APPLY_TXD BIT(0)
+ #define MT_CT_INFO_COPY_HOST_TXD_ALL BIT(1)
+ #define MT_CT_INFO_MGMT_FRAME BIT(2)
+diff --git a/mt7996/init.c b/mt7996/init.c
+index e0cbcaaa..f1b9b0e0 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -347,7 +347,7 @@ static void __mt7996_init_txpower(struct mt7996_phy *phy,
+
+ phy->sku_limit_en = true;
+ phy->sku_path_en = true;
+- np = mt76_find_power_limits_node(&dev->mt76);
++ np = mt76_find_power_limits_node(phy->mt76);
+ for (i = 0; i < sband->n_channels; i++) {
+ struct ieee80211_channel *chan = &sband->channels[i];
+ int target_power = mt7996_eeprom_get_target_power(dev, chan);
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index e571bbfa..32f5b859 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -885,8 +885,13 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+ }
+
+ val = FIELD_PREP(MT_TXD6_TX_RATE, idx) | MT_TXD6_FIXED_BW;
++
+ if (mcast)
+ val |= MT_TXD6_DIS_MAT;
++ if (dev->mt76.phys[band_idx]->cap.has_6ghz &&
++ dev->mt76.lpi_bcn_enhance &&
++ ieee80211_is_mgmt(hdr->frame_control))
++ val |= FIELD_PREP(MT_TXD6_BW, FW_CDBW_80MHZ);
+ txwi[6] |= cpu_to_le32(val);
+ txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
+ }
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 8398151d..4b48a870 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -878,6 +878,7 @@ static u8
+ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, bool beacon, bool mcast)
+ {
++#define FR_RATE_IDX_OFDM_6M 0x004b
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt76_phy *mphy = mconf->phy->mt76;
+ u16 rate;
+@@ -890,6 +891,8 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+
+ if (dev->cert_mode && phy->mt76->band_idx == MT_BAND2)
+ rate = 0x0200;
++ else if (mphy->dev->lpi_bcn_enhance)
++ rate = FR_RATE_IDX_OFDM_6M;
+
+ /* odd index for driver, even index for firmware */
+ idx = MT7996_BEACON_RATES_TBL + 2 * phy->mt76->band_idx;
+@@ -1035,7 +1038,7 @@ static void mt7996_link_info_changed(struct ieee80211_hw *hw,
+ mt7996_update_mu_group(hw, info, mconf);
+
+ if (changed & BSS_CHANGED_TXPOWER)
+- mt7996_mcu_set_txpower_sku(phy, info);
++ mt7996_mcu_set_txpower_sku(phy, info->txpower);
+
+ out:
+ mutex_unlock(&dev->mt76.mutex);
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index ead9ff4f..0439157c 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -6310,7 +6310,7 @@ int mt7996_mcu_set_fixed_rate_table(struct mt7996_phy *phy, u8 table_idx,
+
+ if (beacon) {
+ req.spe_idx_sel = SPE_IXD_SELECT_TXD;
+- req.spe_idx = 24 + band_idx;
++ req.spe_idx = dev->mt76.mgmt_pwr_enhance ? 0 : 24 + band_idx;
+ phy->beacon_rate = rate_idx;
+ } else {
+ req.spe_idx_sel = SPE_IXD_SELECT_BMC_WTBL;
+@@ -6593,14 +6593,29 @@ mt7996_update_max_txpower_cur(struct mt7996_phy *phy, int tx_power)
+ mphy->txpower_cur = e2p_power_limit;
+ }
+
++bool mt7996_is_psd_country(char *country)
++{
++ char psd_country_list[][3] = {"US", "KR", "BR", "CL", "MY", ""};
++ int i;
++
++ if (strlen(country) != 2)
++ return 0;
++
++ for (i = 0; psd_country_list[i][0] != '\0'; i++) {
++ if (!strncmp(country, psd_country_list[i], 2))
++ return 1;
++ }
++
++ return 0;
++}
++
+ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+- struct ieee80211_bss_conf *conf)
++ int txpower_setting)
+ {
+ #define TX_POWER_LIMIT_TABLE_RATE 0
+ #define TX_POWER_LIMIT_TABLE_PATH 1
+ struct mt7996_dev *dev = phy->dev;
+ struct mt76_phy *mphy = phy->mt76;
+- struct ieee80211_hw *hw = mphy->hw;
+ struct tx_power_limit_table_ctrl {
+ u8 __rsv1[4];
+
+@@ -6621,9 +6636,9 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ struct sk_buff *skb;
+ int i, ret, txpower_limit;
+
+- if (hw->conf.power_level == INT_MIN)
+- hw->conf.power_level = 127;
+- txpower_limit = mt7996_get_power_bound(phy, conf->txpower);
++ if (txpower_setting == INT_MIN || txpower_setting > 127)
++ txpower_setting = 127;
++ txpower_limit = mt7996_get_power_bound(phy, txpower_setting);
+
+ if (phy->sku_limit_en) {
+ txpower_limit = mt76_get_rate_power_limits(mphy, mphy->chandef.chan,
+@@ -6642,7 +6657,36 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ skb_put_data(skb, &req, sizeof(req));
+ /* cck and ofdm */
+ skb_put_data(skb, &la.cck, sizeof(la.cck));
+- skb_put_data(skb, &la.ofdm, sizeof(la.ofdm));
++
++ /* FW would compensate for PSD countries
++ * driver doesn't need to do it
++ */
++ if (phy->mt76->cap.has_6ghz && mphy->dev->lpi_psd &&
++ !mt7996_is_psd_country(dev->mt76.alpha2)) {
++ switch (mphy->chandef.width) {
++ case NL80211_CHAN_WIDTH_20:
++ skb_put_data(skb, &la.eht[3], sizeof(la.ofdm));
++ break;
++ case NL80211_CHAN_WIDTH_40:
++ skb_put_data(skb, &la.eht[4], sizeof(la.ofdm));
++ break;
++ case NL80211_CHAN_WIDTH_80:
++ skb_put_data(skb, &la.eht[5], sizeof(la.ofdm));
++ break;
++ case NL80211_CHAN_WIDTH_160:
++ skb_put_data(skb, &la.eht[6], sizeof(la.ofdm));
++ break;
++ case NL80211_CHAN_WIDTH_320:
++ skb_put_data(skb, &la.eht[7], sizeof(la.ofdm));
++ break;
++ default:
++ skb_put_data(skb, &la.ofdm, sizeof(la.ofdm));
++ break;
++ }
++ } else {
++ skb_put_data(skb, &la.ofdm, sizeof(la.ofdm));
++ }
++
+ /* ht20 */
+ skb_put_data(skb, &la.mcs[0], 8);
+ /* ht40 */
+@@ -6679,8 +6723,41 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+
+ skb_put_data(skb, &req, sizeof(req));
+ skb_put_data(skb, &la_path.cck, sizeof(la_path.cck));
+- skb_put_data(skb, &la_path.ofdm, sizeof(la_path.ofdm));
+- skb_put_data(skb, &la_path.ofdm_bf, sizeof(la_path.ofdm_bf));
++
++ /* FW would NOT compensate in the case of BF backoff table
++ * driver needs to compensate for LPI PSD
++ */
++ if (phy->mt76->cap.has_6ghz && mphy->dev->lpi_psd) {
++ switch (mphy->chandef.width) {
++ case NL80211_CHAN_WIDTH_20:
++ skb_put_data(skb, &la_path.ru[5], sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ru_bf[5], sizeof(la_path.ofdm_bf));
++ break;
++ case NL80211_CHAN_WIDTH_40:
++ skb_put_data(skb, &la_path.ru[6], sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ru_bf[6], sizeof(la_path.ofdm_bf));
++ break;
++ case NL80211_CHAN_WIDTH_80:
++ skb_put_data(skb, &la_path.ru[8], sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ru_bf[8], sizeof(la_path.ofdm_bf));
++ break;
++ case NL80211_CHAN_WIDTH_160:
++ skb_put_data(skb, &la_path.ru[11], sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ru_bf[11], sizeof(la_path.ofdm_bf));
++ break;
++ case NL80211_CHAN_WIDTH_320:
++ skb_put_data(skb, &la_path.ru[15], sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ru_bf[15], sizeof(la_path.ofdm_bf));
++ break;
++ default:
++ skb_put_data(skb, &la_path.ofdm, sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ofdm_bf, sizeof(la_path.ofdm_bf));
++ break;
++ }
++ } else {
++ skb_put_data(skb, &la_path.ofdm, sizeof(la_path.ofdm));
++ skb_put_data(skb, &la_path.ofdm_bf, sizeof(la_path.ofdm_bf));
++ }
+
+ for (i = 0; i < 32; i++) {
+ bool bf = i % 2;
+@@ -6694,6 +6771,31 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ MCU_WM_UNI_CMD(TXPOWER), true);
+ }
+
++int mt7996_mcu_set_lpi_psd(struct mt7996_phy *phy, u8 enable)
++{
++ struct mt7996_dev *dev = phy->dev;
++
++ struct {
++ u8 band_idx;
++ u8 _rsv[3];
++
++ __le16 tag;
++ __le16 len;
++ u8 lpi_enable;
++ u8 psd_limit;
++ u8 _rsv2[2];
++ } __packed req = {
++ .band_idx = phy->mt76->band_idx,
++ .tag = cpu_to_le16(UNI_BAND_CONFIG_LPI_CTRL),
++ .len = cpu_to_le16(sizeof(req) - 4),
++ .lpi_enable = enable,
++ .psd_limit = enable ? mt7996_is_psd_country(dev->mt76.alpha2) : 0,
++ };
++
++ return mt76_mcu_send_msg(&phy->dev->mt76, MCU_WM_UNI_CMD(BAND_CONFIG),
++ &req, sizeof(req), false);
++}
++
+ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode)
+ {
+ __le32 cp_mode;
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index 5d4625c8..a5818f95 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1067,6 +1067,7 @@ enum {
+ UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08,
+ UNI_BAND_CONFIG_RTS_SIGTA_EN = 0x09,
+ UNI_BAND_CONFIG_DIS_SECCH_CCA_DET = 0x0a,
++ UNI_BAND_CONFIG_LPI_CTRL = 0x0d,
+ UNI_BAND_CONFIG_BSSID_MAPPING_ADDR = 0x12,
+ };
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index e1e1160a..67ac7a91 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1115,7 +1115,7 @@ int mt7996_mcu_get_temperature(struct mt7996_phy *phy);
+ int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state);
+ int mt7996_mcu_set_thermal_protect(struct mt7996_phy *phy, bool enable);
+ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+- struct ieee80211_bss_conf *conf);
++ int txpower_setting);
+ int mt7996_mcu_rdd_cmd(struct mt7996_dev *dev, int cmd, u8 index,
+ u8 rx_sel, u8 val);
+ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev,
+@@ -1315,6 +1315,7 @@ void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif);
+ int mt7996_mcu_set_csi(struct mt7996_phy *phy, u8 mode,
+ u8 cfg, u8 v1, u32 v2, u8 *mac_addr);
+ int mt7996_vendor_pp_bitmap_update(struct mt7996_phy *phy, u16 bitmap);
++int mt7996_mcu_set_lpi_psd(struct mt7996_phy *phy, u8 enable);
+ #endif
+
+ int mt7996_mcu_edcca_enable(struct mt7996_phy *phy, bool enable);
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index 093f3c69..fa8de2db 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -2509,7 +2509,7 @@ mt7996_get_txpower_info(struct file *file, char __user *user_buf,
+ len += scnprintf(buf + len, size - len,
+ " Theraml Compensation Value: %d\n",
+ basic_info->thermal_compensate_value);
+- np = mt76_find_power_limits_node(phy->mt76->dev);
++ np = mt76_find_power_limits_node(phy->mt76);
+ len += scnprintf(buf + len, size - len,
+ " RegDB: %s\n",
+ !np ? "enable" : "disable");
+@@ -4505,6 +4505,7 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+ debugfs_create_file("rx_drop_stats", 0400, dir, dev, &mt7996_rx_drop_fops);
+
+ debugfs_create_file("muru_dbg", 0200, dir, dev, &fops_muru_dbg_info);
++ debugfs_create_bool("mgmt_pwr_enhance", 0600, dir, &dev->mt76.mgmt_pwr_enhance);
+ }
+
+ #endif
+diff --git a/mt7996/testmode.c b/mt7996/testmode.c
+index b956915e..cf9ec9ac 100644
+--- a/mt7996/testmode.c
++++ b/mt7996/testmode.c
+@@ -1853,7 +1853,7 @@ mt7996_tm_update_params(struct mt7996_phy *phy, u32 changed)
+ mt7996_tm_update_channel(phy);
+ mt7996_mcu_set_tx_power_ctrl(phy, POWER_CTRL(SKU_POWER_LIMIT), td->sku_en);
+ mt7996_mcu_set_tx_power_ctrl(phy, POWER_CTRL(BACKOFF_POWER_LIMIT), td->sku_en);
+- mt7996_mcu_set_txpower_sku(phy, &phy->monitor_vif->bss_conf);
++ mt7996_mcu_set_txpower_sku(phy, phy->monitor_vif->bss_conf.txpower);
+ }
+ if (changed & BIT(TM_CHANGED_TX_LENGTH)) {
+ mt7996_tm_set(dev, SET_ID(TX_LEN), td->tx_mpdu_len);
+diff --git a/mt7996/testmode.h b/mt7996/testmode.h
+index ba1767ae..5c720da7 100644
+--- a/mt7996/testmode.h
++++ b/mt7996/testmode.h
+@@ -15,18 +15,6 @@ enum {
+ TM_CBW_320MHZ = 12,
+ };
+
+-/* BW defined in FW hal_cal_flow_rom.h */
+-enum {
+- FW_CDBW_20MHZ,
+- FW_CDBW_40MHZ,
+- FW_CDBW_80MHZ,
+- FW_CDBW_160MHZ,
+- FW_CDBW_320MHZ,
+- FW_CDBW_5MHZ,
+- FW_CDBW_10MHZ,
+- FW_CDBW_8080MHZ,
+-};
+-
+ enum {
+ BF_CDBW_20MHZ,
+ BF_CDBW_40MHZ,
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index d7973c5e..e75c163e 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -145,6 +145,14 @@ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
+ [MTK_VENDOR_ATTR_CSI_CTRL_DATA] = { .type = NLA_NESTED },
+ };
+
++static struct nla_policy
++txpower_ctrl_policy[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL] = {
++ [MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_PSD] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_BCN_ENHANCE] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_TXPOWER_CTRL_LINK_ID] = { .type = NLA_U8 },
++};
++
+ struct mt7996_amnt_data {
+ u8 idx;
+ u8 addr[ETH_ALEN];
+@@ -1378,6 +1386,103 @@ out:
+ return err;
+ }
+
++static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
++ struct wireless_dev *wdev,
++ const void *data,
++ int data_len)
++{
++#define FR_RATE_IDX_OFDM_6M 0x004b
++ struct mt7996_dev *dev;
++ struct mt7996_phy *phy;
++ struct mt76_phy *mphy;
++ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_bss_conf *mconf;
++ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL];
++ struct mt76_power_limits la = {};
++ struct mt76_power_path_limits la_path = {};
++ int err, current_txpower, delta;
++ u8 val, link_id = 0, idx;
++
++ err = nla_parse(tb, MTK_VENDOR_ATTR_TXPOWER_CTRL_MAX, data, data_len,
++ txpower_ctrl_policy, NULL);
++ if (err)
++ return err;
++
++
++ if (ieee80211_vif_is_mld(vif) && tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LINK_ID]) {
++ link_id = nla_get_u8(tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LINK_ID]);
++
++ if (link_id >= IEEE80211_LINK_UNSPECIFIED)
++ return -EINVAL;
++ }
++
++ rcu_read_lock();
++ mconf = rcu_dereference(mvif->link[link_id]);
++ if (!mconf || !mconf->phy) {
++ rcu_read_unlock();
++ return -EINVAL;
++ }
++
++ phy = mconf->phy;
++ rcu_read_unlock();
++
++ mphy = phy->mt76;
++
++ if (mphy->cap.has_6ghz &&
++ tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_PSD]) {
++ val = nla_get_u8(tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_PSD]);
++ mphy->dev->lpi_psd = val;
++
++ err = mt7996_mcu_set_lpi_psd(phy, val);
++ if (err)
++ return err;
++ }
++
++ if (tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX]) {
++ mphy->sku_idx = nla_get_u8(tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX]);
++
++ if (mt76_find_power_limits_node(mphy) == NULL)
++ mphy->sku_idx = 0;
++
++ phy->sku_limit_en = true;
++ phy->sku_path_en = true;
++ mt76_get_rate_power_limits(mphy, mphy->chandef.chan, &la, &la_path, 127);
++ if (!la_path.ofdm[0])
++ phy->sku_path_en = false;
++
++ dev = phy->dev;
++ err = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_SKU_POWER_LIMIT_CTRL,
++ dev->dbg.sku_disable ? 0 : phy->sku_limit_en);
++ if (err)
++ return err;
++ err = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_BACKOFF_POWER_LIMIT_CTRL,
++ dev->dbg.sku_disable ? 0 : phy->sku_path_en);
++ if (err)
++ return err;
++ }
++
++ if (mphy->cap.has_6ghz &&
++ tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_BCN_ENHANCE]) {
++ val = nla_get_u8(tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_BCN_ENHANCE]);
++ mphy->dev->lpi_bcn_enhance = val;
++ idx = MT7996_BEACON_RATES_TBL + 2 * phy->mt76->band_idx;
++
++ err = mt7996_mcu_set_fixed_rate_table(phy, idx, FR_RATE_IDX_OFDM_6M, true);
++ if (err)
++ return err;
++ }
++
++ delta = mt76_tx_power_nss_delta(hweight16(mphy->chainmask));
++ current_txpower = DIV_ROUND_UP(mphy->txpower_cur + delta, 2);
++
++ err = mt7996_mcu_set_txpower_sku(phy, current_txpower);
++ if (err)
++ return err;
++
++ return 0;
++}
++
+ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+ {
+ .info = {
+@@ -1528,6 +1633,17 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+ .policy = eml_ctrl_policy,
+ .maxattr = MTK_VENDOR_ATTR_EML_CTRL_MAX,
+ },
++ {
++ .info = {
++ .vendor_id = MTK_NL80211_VENDOR_ID,
++ .subcmd = MTK_NL80211_VENDOR_SUBCMD_TXPOWER_CTRL,
++ },
++ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
++ WIPHY_VENDOR_CMD_NEED_RUNNING,
++ .doit = mt7996_vendor_txpower_ctrl,
++ .policy = txpower_ctrl_policy,
++ .maxattr = MTK_VENDOR_ATTR_TXPOWER_CTRL_MAX,
++ },
+ };
+
+ static const struct nl80211_vendor_cmd_info mt7996_vendor_events[] = {
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index ca4f00ad..515f77a6 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -18,6 +18,7 @@ enum mtk_nl80211_vendor_subcmds {
+ MTK_NL80211_VENDOR_SUBCMD_BACKGROUND_RADAR_CTRL = 0xcb,
+ MTK_NL80211_VENDOR_SUBCMD_PP_CTRL = 0xcc,
+ MTK_NL80211_VENDOR_SUBCMD_BEACON_CTRL = 0xcd,
++ MTK_NL80211_VENDOR_SUBCMD_TXPOWER_CTRL = 0xce,
+ MTK_NL80211_VENDOR_SUBCMD_EML_CTRL = 0xd3,
+ };
+
+@@ -312,6 +313,20 @@ enum mtk_vendor_attr_csi_data {
+ MTK_VENDOR_ATTR_CSI_DATA_MAX =
+ NUM_MTK_VENDOR_ATTRS_CSI_DATA - 1
+ };
++
++enum mtk_vendor_attr_txpower_ctrl {
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_UNSPEC,
++
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_PSD,
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX,
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_BCN_ENHANCE,
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_LINK_ID,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL,
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_MAX =
++ NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL - 1
++};
+ #endif
+
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0189-mtk-mt76-mt7996-Add-Triggered-Uplink-Access-Optimiza.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0189-mtk-mt76-mt7996-Add-Triggered-Uplink-Access-Optimiza.patch
new file mode 100644
index 0000000..16d8cae
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0189-mtk-mt76-mt7996-Add-Triggered-Uplink-Access-Optimiza.patch
@@ -0,0 +1,309 @@
+From c21cbc5f70b521cf05abb63c63d9a753076adb24 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Tue, 2 Jul 2024 10:06:26 +0800
+Subject: [PATCH 189/199] mtk: mt76: mt7996: Add Triggered Uplink Access
+ Optimization support
+
+Add TUAO feature, which is a subset of SCS procedure support.
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7996/init.c | 25 ++++++++++-----
+ mt7996/mt7996.h | 3 ++
+ mt7996/mtk_mcu.c | 49 ++++++++++++++++++++++++++++++
+ mt7996/mtk_mcu.h | 7 +++++
+ mt7996/vendor.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
+ mt7996/vendor.h | 17 +++++++++++
+ 6 files changed, 173 insertions(+), 7 deletions(-)
+
+diff --git a/mt7996/init.c b/mt7996/init.c
+index f1b9b0e0..2f43c0ff 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -62,7 +62,14 @@ static const struct ieee80211_iface_combination if_comb_7992[] = {
+ }
+ };
+
+-static const u8 mt7996_if_types_ext_capa[] = {
++static const u8 mt7996_if_types_ext_capa_ap[] = {
++ [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
++ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
++ [6] = WLAN_EXT_CAPA7_SCS_SUPPORT,
++ [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
++};
++
++static const u8 mt7996_if_types_ext_capa_sta[] = {
+ [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
+ [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
+@@ -71,16 +78,16 @@ static const u8 mt7996_if_types_ext_capa[] = {
+ static const struct wiphy_iftype_ext_capab mt7996_iftypes_ext_capa[] = {
+ {
+ .iftype = NL80211_IFTYPE_STATION,
+- .extended_capabilities = mt7996_if_types_ext_capa,
+- .extended_capabilities_mask = mt7996_if_types_ext_capa,
+- .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa),
++ .extended_capabilities = mt7996_if_types_ext_capa_sta,
++ .extended_capabilities_mask = mt7996_if_types_ext_capa_sta,
++ .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa_sta),
+ .mld_capa_and_ops = 2,
+ },
+ {
+ .iftype = NL80211_IFTYPE_AP,
+- .extended_capabilities = mt7996_if_types_ext_capa,
+- .extended_capabilities_mask = mt7996_if_types_ext_capa,
+- .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa),
++ .extended_capabilities = mt7996_if_types_ext_capa_ap,
++ .extended_capabilities_mask = mt7996_if_types_ext_capa_ap,
++ .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa_ap),
+ .eml_capabilities = IEEE80211_EML_CAP_EMLSR_SUPP,
+ .mld_capa_and_ops = 2,
+ /* the max number of simultaneous links is defined as the
+@@ -1573,6 +1580,10 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
+ u8_encode_bits(IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454,
+ IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK);
+
++ if (iftype == NL80211_IFTYPE_AP)
++ eht_cap_elem->mac_cap_info[0] |=
++ IEEE80211_EHT_MAC_CAP0_SCS_TRAFFIC_DESC;
++
+ eht_cap_elem->phy_cap_info[0] =
+ IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI |
+ IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER |
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 67ac7a91..fa884316 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -524,6 +524,9 @@ struct csi_data {
+ };
+
+ int mt7996_set_coding_type(struct ieee80211_hw *hw, u8 coding_type, u8 link_id);
++
++int mt7996_mcu_set_muru_qos_cfg(struct mt7996_dev *dev, u16 wlan_idx, u8 dir,
++ u8 scs_id, u8 req_type, u8 *qos_ie, u8 qos_ie_len);
+ #endif
+
+ struct mt7996_rro_ba_session {
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 8bacf29d..9ec4bc9a 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -1429,4 +1429,53 @@ int mt7996_set_coding_type(struct ieee80211_hw *hw, u8 coding_type, u8 link_id)
+
+ return 0;
+ }
++
++int mt7996_mcu_set_muru_qos_cfg(struct mt7996_dev *dev, u16 wlan_idx, u8 dir,
++ u8 scs_id, u8 req_type, u8 *qos_ie, u8 qos_ie_len)
++{
++#define QOS_FLAG_UPDATE 20
++#define QOS_FLAG_DELETE 21
++
++ struct {
++ u8 _rsv[4];
++
++ __le16 tag;
++ __le16 len;
++
++ __le32 qos_flag;
++ __le16 wlan_idx;
++ u8 __rsv2[12];
++ u8 dir;
++ u8 _rsv3[4];
++ u8 scs_id;
++ u8 qos_ie[44];
++ } __packed req = {
++ .tag = cpu_to_le16(UNI_CMD_MURU_SET_QOS_CFG),
++ .len = cpu_to_le16(sizeof(req) - 4),
++ .wlan_idx = cpu_to_le16(wlan_idx),
++ .scs_id = scs_id,
++ };
++
++ switch (req_type) {
++ case SCS_REQ_TYPE_ADD:
++ case SCS_REQ_TYPE_CHANGE:
++ req.qos_flag = cpu_to_le32(QOS_FLAG_UPDATE);
++ req.dir = dir;
++
++ if (qos_ie_len > sizeof(req.qos_ie))
++ return -EINVAL;
++
++ memcpy(req.qos_ie, qos_ie, qos_ie_len);
++ break;
++ case SCS_REQ_TYPE_REMOVE:
++ req.qos_flag = cpu_to_le32(QOS_FLAG_DELETE);
++ break;
++ default:
++ dev_err(dev->mt76.dev, "Unsupported req_type %u\n", req_type);
++ return -EINVAL;
++ }
++
++ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req,
++ sizeof(req), true);
++}
+ #endif
+diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
+index 8ba261a7..711903e0 100644
+--- a/mt7996/mtk_mcu.h
++++ b/mt7996/mtk_mcu.h
+@@ -134,6 +134,7 @@ enum {
+ UNI_CMD_MURU_PROT_FRAME_THR = 0xCC,
+ UNI_CMD_MURU_SET_CERT_MU_EDCA_OVERRIDE,
+ UNI_CMD_MURU_SET_TRIG_VARIANT = 0xD5,
++ UNI_CMD_MURU_SET_QOS_CFG = 0xFE,
+ };
+
+ struct bf_pfmu_tag {
+@@ -1165,4 +1166,10 @@ enum {
+ VOW_DRR_DBG_PRN)
+ #endif
+
++enum {
++ SCS_REQ_TYPE_ADD,
++ SCS_REQ_TYPE_REMOVE,
++ SCS_REQ_TYPE_CHANGE,
++};
++
+ #endif
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index e75c163e..e13a148a 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -132,6 +132,17 @@ eml_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EML_CTRL] = {
+ [MTK_VENDOR_ATTR_EML_CTRL_STRUCT] = { .type = NLA_BINARY },
+ };
+
++
++static const struct nla_policy
++scs_ctrl_policy[NUM_MTK_VENDOR_ATTRS_SCS_CTRL] = {
++ [MTK_VENDOR_ATTR_SCS_ID] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_SCS_REQ_TYPE] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_SCS_DIR] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_SCS_QOS_IE] = { .type = NLA_BINARY },
++ [MTK_VENDOR_ATTR_SCS_MAC_ADDR] = NLA_POLICY_ETH_ADDR,
++ [MTK_VENDOR_ATTR_SCS_LINK_ID] = { .type = NLA_U8 },
++};
++
+ static const struct nla_policy
+ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
+ [MTK_VENDOR_ATTR_CSI_CTRL_BAND_IDX] = { .type = NLA_U8 },
+@@ -1164,6 +1175,63 @@ static int mt7996_vendor_eml_ctrl(struct wiphy *wiphy, struct wireless_dev *wdev
+
+ return err;
+ }
++static int mt7996_vendor_scs_ctrl(struct wiphy *wiphy, struct wireless_dev *wdev,
++ const void *data, int data_len)
++{
++ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ struct ieee80211_sta *sta;
++ struct mt7996_sta *msta;
++ struct mt7996_link_sta *mlink;
++ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_SCS_CTRL];
++ u8 sta_addr[ETH_ALEN];
++ u8 scs_id, req_type, dir, link_id, qos_ie_len;
++ u8 *qos_ie = NULL;
++ int err;
++
++ err = nla_parse(tb, MTK_VENDOR_ATTR_SCS_CTRL_MAX, data, data_len,
++ scs_ctrl_policy, NULL);
++ if (err)
++ return err;
++
++ if (!tb[MTK_VENDOR_ATTR_SCS_ID] || !tb[MTK_VENDOR_ATTR_SCS_REQ_TYPE] ||
++ !tb[MTK_VENDOR_ATTR_SCS_MAC_ADDR] || !tb[MTK_VENDOR_ATTR_SCS_LINK_ID])
++ return -EINVAL;
++
++ scs_id = nla_get_u8(tb[MTK_VENDOR_ATTR_SCS_ID]);
++ req_type = nla_get_u8(tb[MTK_VENDOR_ATTR_SCS_REQ_TYPE]);
++ nla_memcpy(sta_addr, tb[MTK_VENDOR_ATTR_SCS_MAC_ADDR], ETH_ALEN);
++ link_id = nla_get_u8(tb[MTK_VENDOR_ATTR_SCS_LINK_ID]);
++
++ sta = ieee80211_find_sta_by_ifaddr(hw, sta_addr, NULL);
++ if (!sta)
++ return -EINVAL;
++
++ msta = (struct mt7996_sta *)sta->drv_priv;
++ mlink = mlink_dereference_protected(msta, link_id);
++ if (!mlink)
++ return -EINVAL;
++
++ if (req_type == SCS_REQ_TYPE_ADD || req_type == SCS_REQ_TYPE_CHANGE) {
++ if (!tb[MTK_VENDOR_ATTR_SCS_DIR] || !tb[MTK_VENDOR_ATTR_SCS_QOS_IE])
++ return -EINVAL;
++
++ dir = nla_get_u8(tb[MTK_VENDOR_ATTR_SCS_DIR]);
++ qos_ie_len = nla_len(tb[MTK_VENDOR_ATTR_SCS_QOS_IE]);
++ qos_ie = kzalloc(qos_ie_len, GFP_KERNEL);
++ if (!qos_ie)
++ return -ENOMEM;
++
++ nla_memcpy(qos_ie, tb[MTK_VENDOR_ATTR_SCS_QOS_IE], qos_ie_len);
++ }
++
++ err = mt7996_mcu_set_muru_qos_cfg(dev, mlink->wcid.idx, dir, scs_id,
++ req_type, qos_ie, qos_ie_len);
++
++ kfree(qos_ie);
++
++ return err;
++}
+
+ static int mt7996_vendor_csi_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+@@ -1644,6 +1712,17 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+ .policy = txpower_ctrl_policy,
+ .maxattr = MTK_VENDOR_ATTR_TXPOWER_CTRL_MAX,
+ },
++ {
++ .info = {
++ .vendor_id = MTK_NL80211_VENDOR_ID,
++ .subcmd = MTK_NL80211_VENDOR_SUBCMD_SCS_CTRL,
++ },
++ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
++ WIPHY_VENDOR_CMD_NEED_RUNNING,
++ .doit = mt7996_vendor_scs_ctrl,
++ .policy = scs_ctrl_policy,
++ .maxattr = MTK_VENDOR_ATTR_SCS_CTRL_MAX,
++ },
+ };
+
+ static const struct nl80211_vendor_cmd_info mt7996_vendor_events[] = {
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index 515f77a6..71800590 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -19,6 +19,7 @@ enum mtk_nl80211_vendor_subcmds {
+ MTK_NL80211_VENDOR_SUBCMD_PP_CTRL = 0xcc,
+ MTK_NL80211_VENDOR_SUBCMD_BEACON_CTRL = 0xcd,
+ MTK_NL80211_VENDOR_SUBCMD_TXPOWER_CTRL = 0xce,
++ MTK_NL80211_VENDOR_SUBCMD_SCS_CTRL = 0xd0,
+ MTK_NL80211_VENDOR_SUBCMD_EML_CTRL = 0xd3,
+ };
+
+@@ -262,6 +263,22 @@ enum mtk_vendor_attr_eml_ctrl {
+ NUM_MTK_VENDOR_ATTRS_EML_CTRL - 1
+ };
+
++enum mtk_vendor_attr_scs_ctrl {
++ MTK_VENDOR_ATTR_SCS_CTRL_UNSPEC,
++
++ MTK_VENDOR_ATTR_SCS_ID,
++ MTK_VENDOR_ATTR_SCS_REQ_TYPE,
++ MTK_VENDOR_ATTR_SCS_DIR,
++ MTK_VENDOR_ATTR_SCS_QOS_IE,
++ MTK_VENDOR_ATTR_SCS_MAC_ADDR,
++ MTK_VENDOR_ATTR_SCS_LINK_ID,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_SCS_CTRL,
++ MTK_VENDOR_ATTR_SCS_CTRL_MAX =
++ NUM_MTK_VENDOR_ATTRS_SCS_CTRL - 1
++};
++
+ enum mtk_vendor_attr_csi_ctrl {
+ MTK_VENDOR_ATTR_CSI_CTRL_UNSPEC,
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0190-mtk-mt76-mt7996-add-per-band-token-limit.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0190-mtk-mt76-mt7996-add-per-band-token-limit.patch
new file mode 100644
index 0000000..78737b8
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0190-mtk-mt76-mt7996-add-per-band-token-limit.patch
@@ -0,0 +1,200 @@
+From 08bab29bc70a7b21150167f2ae502d8e5538c743 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Tue, 30 Jul 2024 19:49:39 +0800
+Subject: [PATCH 190/199] mtk: mt76: mt7996: add per-band token limit
+
+Add a threshold for per-band token count.
+The bands use the same token pool so a band cannot transmit if
+the other band occupy too many tokens. With this patch, we can
+prevent a band from interfering with the other band.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76.h | 6 +++++-
+ mt7996/init.c | 2 ++
+ mt7996/mac.c | 5 ++++-
+ mt7996/mt7996.h | 1 +
+ mt7996/mtk_debugfs.c | 14 ++++++++++++--
+ tx.c | 19 ++++++++++++++++---
+ 6 files changed, 40 insertions(+), 7 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index 1858f542..e5e5529d 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -462,6 +462,7 @@ struct mt76_txwi_cache {
+ dma_addr_t dma_addr;
+
+ unsigned long jiffies;
++ u8 phy_idx;
+
+ struct sk_buff *skb;
+ };
+@@ -960,6 +961,7 @@ struct mt76_phy {
+ } leds;
+ struct mt76_tx_debug tx_dbg_stats;
+ struct mt76_rx_debug rx_dbg_stats;
++ int tokens;
+ };
+
+ struct mt76_dev {
+@@ -1009,6 +1011,7 @@ struct mt76_dev {
+ u16 wed_token_count;
+ u16 token_count;
+ u16 token_size;
++ u16 token_threshold;
+
+ spinlock_t rx_token_lock;
+ struct idr rx_token;
+@@ -1879,7 +1882,8 @@ static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
+
+ struct mt76_txwi_cache *
+ mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
+-int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi);
++int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi,
++ u8 phy_idx);
+ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
+ struct mt76_rxwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
+ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
+diff --git a/mt7996/init.c b/mt7996/init.c
+index 2f43c0ff..bad4b1b7 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -1770,6 +1770,8 @@ int mt7996_register_device(struct mt7996_dev *dev)
+ if (ret)
+ return ret;
+
++ dev->mt76.token_threshold = MT7996_PER_BAND_TOKEN_SIZE;
++
+ ret = mt7996_init_dev_debugfs(&dev->phy);
+ if (ret)
+ goto error;
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 32f5b859..f9344f28 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -959,7 +959,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
+ t->skb = tx_info->skb;
+
+- id = mt76_token_consume(mdev, &t);
++ id = mt76_token_consume(mdev, &t, mconf->mt76.band_idx);
+ if (id < 0) {
+ mdev->tx_dbg_stats.tx_drop[MT_TX_DROP_GET_TOKEN_FAIL]++;
+ return id;
+@@ -1683,8 +1683,11 @@ void mt7996_tx_token_put(struct mt7996_dev *dev)
+
+ spin_lock_bh(&dev->mt76.token_lock);
+ idr_for_each_entry(&dev->mt76.token, txwi, id) {
++ struct mt76_phy *phy = mt76_dev_phy(&dev->mt76, txwi->phy_idx);
++
+ mt7996_txwi_free(dev, txwi, NULL, NULL, NULL);
+ dev->mt76.token_count--;
++ phy->tokens--;
+ }
+ spin_unlock_bh(&dev->mt76.token_lock);
+ idr_destroy(&dev->mt76.token);
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index fa884316..04832b0c 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -76,6 +76,7 @@
+ #define MT7996_TOKEN_SIZE 16384
+ #define MT7996_HW_TOKEN_SIZE 8192
+ #define MT7996_SW_TOKEN_SIZE 15360
++#define MT7996_PER_BAND_TOKEN_SIZE 5120
+
+ #define MT7996_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
+ #define MT7996_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index fa8de2db..a4703b07 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -2401,7 +2401,7 @@ static int mt7996_sta_info(struct seq_file *s, void *data)
+ static int mt7996_token_read(struct seq_file *s, void *data)
+ {
+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
+- int msdu_id;
++ int msdu_id, i;
+ struct mt76_txwi_cache *txwi;
+
+ seq_printf(s, "Token from host:\n");
+@@ -2410,8 +2410,18 @@ static int mt7996_token_read(struct seq_file *s, void *data)
+ seq_printf(s, "%4d (pending time %u ms)\n", msdu_id,
+ jiffies_to_msecs(jiffies - txwi->jiffies));
+ }
+- spin_unlock_bh(&dev->mt76.token_lock);
+ seq_printf(s, "\n");
++ for (i = 0; i < __MT_MAX_BAND; i++) {
++ struct mt76_phy *phy = mt76_dev_phy(&dev->mt76, i);
++
++ if (!mt7996_band_valid(dev, i))
++ continue;
++
++ seq_printf(s, "Band%u consume: %d, free: %d total: %d\n",
++ i, phy->tokens, dev->mt76.token_threshold - phy->tokens,
++ dev->mt76.token_threshold);
++ }
++ spin_unlock_bh(&dev->mt76.token_lock);
+
+ return 0;
+ }
+diff --git a/tx.c b/tx.c
+index 5e6e433f..c965f0e3 100644
+--- a/tx.c
++++ b/tx.c
+@@ -837,20 +837,29 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
+ }
+ EXPORT_SYMBOL_GPL(__mt76_set_tx_blocked);
+
+-int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi)
++int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi,
++ u8 phy_idx)
+ {
+- int token, start = 0;
++ int token = -EINVAL, start = 0;
++ struct mt76_phy *phy = mt76_dev_phy(dev, phy_idx);
+
+ if (mtk_wed_device_active(&dev->mmio.wed))
+ start = dev->mmio.wed.wlan.nbuf;
+
+ spin_lock_bh(&dev->token_lock);
+
++ if (phy->tokens > dev->token_threshold)
++ goto out;
++
+ token = idr_alloc(&dev->token, *ptxwi, start, start + dev->token_size,
+ GFP_ATOMIC);
+- if (token >= start)
++ if (token >= start) {
+ dev->token_count++;
+
++ (*ptxwi)->phy_idx = phy_idx;
++ phy->tokens++;
++ }
++
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ if (mtk_wed_device_active(&dev->mmio.wed) &&
+ token >= dev->mmio.wed.wlan.token_start)
+@@ -860,6 +869,7 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi)
+ if (dev->token_count >= dev->token_size - MT76_TOKEN_FREE_THR)
+ __mt76_set_tx_blocked(dev, true);
+
++out:
+ spin_unlock_bh(&dev->token_lock);
+
+ return token;
+@@ -893,7 +903,10 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
+
+ txwi = idr_remove(&dev->token, token);
+ if (txwi) {
++ struct mt76_phy *phy = mt76_dev_phy(dev, txwi->phy_idx);
++
+ dev->token_count--;
++ phy->tokens--;
+
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ if (mtk_wed_device_active(&dev->mmio.wed) &&
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0191-mtk-mt76-sync-with-upstream-changes.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0191-mtk-mt76-sync-with-upstream-changes.patch
new file mode 100644
index 0000000..5b27fbc
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0191-mtk-mt76-sync-with-upstream-changes.patch
@@ -0,0 +1,40 @@
+From ae1bd00dbac3464137f2f595b935babc3bea0137 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 31 Jul 2024 11:19:53 +0800
+Subject: [PATCH 191/199] mtk: mt76: sync with upstream changes
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7996/main.c | 2 +-
+ mt7996/mcu.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 4b48a870..59353603 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -153,7 +153,7 @@ static int mt7996_start(struct ieee80211_hw *hw)
+ return ret;
+ }
+
+-static void mt7996_stop(struct ieee80211_hw *hw)
++static void mt7996_stop(struct ieee80211_hw *hw, bool suspend)
+ {
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ int band;
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 0439157c..03c671f6 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -421,7 +421,7 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)
+ &dev->rdd2_chandef,
+ GFP_ATOMIC);
+ } else {
+- ieee80211_radar_detected(mphy->hw);
++ ieee80211_radar_detected(mphy->hw, NULL);
+ }
+ dev->hw_pattern++;
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0192-mtk-mt76-mt7996-record-per-antenna-average-data-fram.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0192-mtk-mt76-mt7996-record-per-antenna-average-data-fram.patch
new file mode 100644
index 0000000..bdf7dfa
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0192-mtk-mt76-mt7996-record-per-antenna-average-data-fram.patch
@@ -0,0 +1,76 @@
+From a73d892b561967d17374cc3e04ec2b8d097062b4 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Thu, 1 Aug 2024 09:11:02 +0800
+Subject: [PATCH 192/199] mtk: mt76: mt7996: record per-antenna average
+ data-frame RSSI
+
+Record per-antenna average data-frame RSSI.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/mac.c | 7 +++++++
+ mt7996/main.c | 5 ++++-
+ mt7996/mt7996.h | 2 ++
+ 3 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index f9344f28..27b4e99f 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -494,10 +494,17 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ status->chain_signal[3] = to_rssi(MT_PRXV_RCPI3, v3);
+
+ if (mlink) {
++ int i;
++
+ memcpy(mlink->chain_signal, status->chain_signal,
+ IEEE80211_MAX_CHAINS);
+ mlink->signal = mt76_rx_signal(mphy->antenna_mask,
+ mlink->chain_signal);
++
++ for (i = 0; i < IEEE80211_MAX_CHAINS; ++i)
++ ewma_avg_signal_add(mlink->chain_signal_avg + i,
++ -mlink->chain_signal[i]);
++ ewma_avg_signal_add(&mlink->signal_avg, -mlink->signal);
+ }
+
+ /* RXD Group 5 - C-RXV */
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 59353603..29b2583d 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -1230,7 +1230,7 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ u8 link_id = link_sta->link_id;
+ struct mt7996_link_sta *mlink = NULL;
+- int idx, ret;
++ int idx, ret, i;
+
+ if (!rcu_access_pointer(msta->link[link_id])) {
+ idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
+@@ -1298,6 +1298,9 @@ static int mt7996_add_link_sta(struct mt7996_dev *dev,
+ goto error;
+ }
+
++ for (i = 0; i < IEEE80211_MAX_CHAINS; ++i)
++ ewma_avg_signal_init(mlink->chain_signal_avg + i);
++ ewma_avg_signal_init(&mlink->signal_avg);
+ ewma_avg_signal_init(&mlink->avg_ack_signal);
+
+ return 0;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 04832b0c..65a88e58 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -320,6 +320,8 @@ struct mt7996_link_sta {
+
+ s8 chain_signal[IEEE80211_MAX_CHAINS];
+ int signal;
++ struct ewma_avg_signal chain_signal_avg[IEEE80211_MAX_CHAINS];
++ struct ewma_avg_signal signal_avg;
+
+ s8 chain_ack_signal[IEEE80211_MAX_CHAINS];
+ int ack_signal;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0193-mtk-mt76-mt7996-remove-default-bss_conf-when-link-be.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0193-mtk-mt76-mt7996-remove-default-bss_conf-when-link-be.patch
new file mode 100644
index 0000000..4a10a4e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0193-mtk-mt76-mt7996-remove-default-bss_conf-when-link-be.patch
@@ -0,0 +1,31 @@
+From c163bc7222a263f342dbef0568f2bd09044135be Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Mon, 5 Aug 2024 14:54:43 +0800
+Subject: [PATCH 193/199] mtk: mt76: mt7996: remove default bss_conf when link
+ becomes MLD
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/main.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 29b2583d..76dbb2f3 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -3124,6 +3124,12 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ }
+
+ if (!old_links) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, 0);
++
++ if (ieee80211_vif_is_mld(vif) && mconf == &mvif->deflink)
++ mt7996_remove_bss_conf(vif, &vif->bss_conf, mconf);
++
+ mvif->group_mld_id = get_own_mld_idx(dev->mld_id_mask, true);
+ dev->mld_id_mask |= BIT_ULL(mvif->group_mld_id);
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0194-mtk-mt76-mt7996-pass-vif-cfg.assoc-to-mt7996_mac_sta.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0194-mtk-mt76-mt7996-pass-vif-cfg.assoc-to-mt7996_mac_sta.patch
new file mode 100644
index 0000000..8d59550
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0194-mtk-mt76-mt7996-pass-vif-cfg.assoc-to-mt7996_mac_sta.patch
@@ -0,0 +1,40 @@
+From a1517eb6d1c93a2dc4155916497fbe27c3a21b9d Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Mon, 5 Aug 2024 14:55:10 +0800
+Subject: [PATCH 194/199] mtk: mt76: mt7996: pass vif->cfg.assoc to
+ mt7996_mac_sta_add_links
+
+Link management functions might leverage mt7996_change_sta_links to
+update sta's links, so the 'assoc' argument of mt7996_mac_sta_add_links()
+should be dynamic decieded by vif->cfg.assoc.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/main.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 76dbb2f3..6826f319 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -3157,6 +3157,7 @@ mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ unsigned long add = new_links & ~old_links;
+ unsigned long rem = old_links & ~new_links;
+ int ret = 0;
++ bool assoc;
+
+ mt76_vif_dbg(vif, "STA %pM old=0x%x, new=0x%x\n", sta->addr, old_links, new_links);
+ mutex_lock(&dev->mt76.mutex);
+@@ -3170,7 +3171,8 @@ mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ /* goto remove; */
+ }
+
+- ret = mt7996_mac_sta_add_links(dev, vif, sta, add, false);
++ assoc = vif->type == NL80211_IFTYPE_STATION ? vif->cfg.assoc : false;
++ ret = mt7996_mac_sta_add_links(dev, vif, sta, add, assoc);
+ if (ret)
+ goto remove;
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0195-mtk-mt76-mt7996-separate-hwrro-from-wed.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0195-mtk-mt76-mt7996-separate-hwrro-from-wed.patch
new file mode 100644
index 0000000..29f0504
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0195-mtk-mt76-mt7996-separate-hwrro-from-wed.patch
@@ -0,0 +1,1190 @@
+From 8b65a89860eb0fcd914382b4297efa262f4c158c Mon Sep 17 00:00:00 2001
+From: Rex Lu <rex.lu@mediatek.com>
+Date: Tue, 6 Aug 2024 10:06:10 +0800
+Subject: [PATCH 195/199] mtk: mt76: mt7996: separate hwrro from wed
+
+1. separate hwrro from wed
+2. support mt7996/mt7992 run hwrro 3.0 without wed
+
+Signed-off-by: Rex Lu <rex.lu@mediatek.com>
+---
+ dma.c | 78 ++++++++--
+ dma.h | 6 +-
+ mac80211.c | 5 +
+ mt76.h | 19 ++-
+ mt7996/dma.c | 77 +++++++---
+ mt7996/init.c | 60 ++++----
+ mt7996/mac.c | 388 +++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/mmio.c | 2 +
+ mt7996/mt7996.h | 53 +++++++
+ mt7996/pci.c | 4 +
+ mt7996/regs.h | 1 +
+ 11 files changed, 617 insertions(+), 76 deletions(-)
+
+diff --git a/dma.c b/dma.c
+index 81e76191..7598823a 100644
+--- a/dma.c
++++ b/dma.c
+@@ -231,7 +231,7 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ struct mt76_queue_entry *entry = &q->entry[q->head];
+ struct mt76_desc *desc;
+ int idx = q->head;
+- u32 buf1 = 0, ctrl;
++ u32 buf1 = 0, ctrl, info = 0;
+ int rx_token;
+
+ if (mt76_queue_is_wed_rro_ind(q)) {
+@@ -248,7 +248,7 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ buf1 = FIELD_PREP(MT_DMA_CTL_SDP0_H, buf->addr >> 32);
+ #endif
+
+- if (mt76_queue_is_wed_rx(q)) {
++ if (mt76_queue_is_wed_rx(q) || mt76_queue_is_wed_rro_data(q)) {
+ if (!rxwi) {
+ rxwi = mt76_get_rxwi(dev);
+ if (!rxwi) {
+@@ -266,12 +266,24 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
+
+ buf1 |= FIELD_PREP(MT_DMA_CTL_TOKEN, rx_token);
+ ctrl |= MT_DMA_CTL_TO_HOST;
++ rxwi->qid = q - dev->q_rx;
++ }
++
++ if (mt76_queue_is_wed_rro_msdu_pg(q)) {
++ if (dev->drv->rx_rro_fill_msdu_pg(dev, q, buf->addr, data))
++ return -ENOMEM;
++ }
++
++ if (q->flags & MT_QFLAG_WED_RRO_EN) {
++ info |= FIELD_PREP(MT_DMA_MAGIC_MASK, q->magic_cnt);
++ if ((q->head + 1) == q->ndesc)
++ q->magic_cnt = (q->magic_cnt + 1) % MT_DMA_MAGIC_CNT;
+ }
+
+ WRITE_ONCE(desc->buf0, cpu_to_le32(buf->addr));
+ WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
+ WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl));
+- WRITE_ONCE(desc->info, 0);
++ WRITE_ONCE(desc->info, cpu_to_le32(info));
+
+ done:
+ entry->dma_addr[0] = buf->addr;
+@@ -433,7 +445,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ void *buf = e->buf;
+ int reason;
+
+- if (mt76_queue_is_wed_rro_ind(q))
++ if (mt76_queue_is_wed_rro(q))
+ goto done;
+
+ ctrl = le32_to_cpu(READ_ONCE(desc->ctrl));
+@@ -558,15 +570,28 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
+
+ if (mt76_queue_is_wed_rro_data(q) ||
+ mt76_queue_is_wed_rro_msdu_pg(q))
+- return NULL;
++ goto done;
++
++ if (mt76_queue_is_wed_rro_ind(q)) {
++ struct mt76_wed_rro_ind *cmd;
+
+- if (!mt76_queue_is_wed_rro_ind(q)) {
++ if (flush)
++ goto done;
++
++ cmd = q->entry[idx].buf;
++ if (cmd->magic_cnt != q->magic_cnt)
++ return NULL;
++
++ if (q->tail == q->ndesc - 1)
++ q->magic_cnt = (q->magic_cnt + 1) % MT_DMA_WED_IND_CMD_CNT;
++ } else {
+ if (flush)
+ q->desc[idx].ctrl |= cpu_to_le32(MT_DMA_CTL_DMA_DONE);
+ else if (!(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_DMA_DONE)))
+ return NULL;
+ }
+
++done:
+ q->tail = (q->tail + 1) % q->ndesc;
+ q->queued--;
+
+@@ -750,8 +775,8 @@ int mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q,
+ break;
+ }
+
+- qbuf.addr = addr + offset;
+ done:
++ qbuf.addr = addr + offset;
+ qbuf.len = len - offset;
+ qbuf.skip_unmap = false;
+ if (mt76_dma_add_rx_buf(dev, q, &qbuf, buf, NULL) < 0) {
+@@ -856,7 +881,7 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
+
+ spin_unlock_bh(&q->lock);
+
+- if (mt76_queue_is_wed_rx(q))
++ if (mt76_queue_is_wed_rx(q) || mt76_queue_is_wed_rro(q))
+ return;
+
+ if (!q->rx_page.va)
+@@ -934,8 +959,9 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+ bool allow_direct = !mt76_queue_is_wed_rx(q);
+ bool more;
+
+- if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) &&
+- mt76_queue_is_wed_tx_free(q)) {
++ if ((q->flags & MT_QFLAG_WED_RRO_EN) ||
++ (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) &&
++ mt76_queue_is_wed_tx_free(q))) {
+ dma_idx = Q_READ(q, dma_idx);
+ check_ddone = true;
+ }
+@@ -957,6 +983,14 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+ if (!data)
+ break;
+
++ if (mt76_queue_is_wed_rro_ind(q) && dev->drv->rx_rro_ind_process)
++ dev->drv->rx_rro_ind_process(dev, data);
++
++ if (mt76_queue_is_wed_rro(q)) {
++ done++;
++ continue;
++ }
++
+ if (drop || (len == 0))
+ goto free_frag;
+
+@@ -1037,11 +1071,18 @@ int mt76_dma_rx_poll(struct napi_struct *napi, int budget)
+ EXPORT_SYMBOL_GPL(mt76_dma_rx_poll);
+
+ static int
+-mt76_dma_init(struct mt76_dev *dev,
++__mt76_dma_init(struct mt76_dev *dev, enum mt76_rxq_id qid,
+ int (*poll)(struct napi_struct *napi, int budget))
+ {
+ int i;
+
++ if (qid < __MT_RXQ_MAX && dev->q_rx[qid].ndesc) {
++ netif_napi_add(&dev->napi_dev, &dev->napi[qid], poll);
++ mt76_dma_rx_fill(dev, &dev->q_rx[qid], false);
++ napi_enable(&dev->napi[qid]);
++ return 0;
++ }
++
+ init_dummy_netdev(&dev->napi_dev);
+ init_dummy_netdev(&dev->tx_napi_dev);
+ snprintf(dev->napi_dev.name, sizeof(dev->napi_dev.name), "%s",
+@@ -1063,6 +1104,20 @@ mt76_dma_init(struct mt76_dev *dev,
+ return 0;
+ }
+
++static int
++mt76_dma_rx_queue_init(struct mt76_dev *dev, enum mt76_rxq_id qid,
++ int (*poll)(struct napi_struct *napi, int budget))
++{
++ return __mt76_dma_init(dev, qid, poll);
++}
++
++static int
++mt76_dma_init(struct mt76_dev *dev,
++ int (*poll)(struct napi_struct *napi, int budget))
++{
++ return __mt76_dma_init(dev, __MT_RXQ_MAX, poll);
++}
++
+ static const struct mt76_queue_ops mt76_dma_ops = {
+ .init = mt76_dma_init,
+ .alloc = mt76_dma_alloc_queue,
+@@ -1070,6 +1125,7 @@ static const struct mt76_queue_ops mt76_dma_ops = {
+ .tx_queue_skb_raw = mt76_dma_tx_queue_skb_raw,
+ .tx_queue_skb = mt76_dma_tx_queue_skb,
+ .tx_cleanup = mt76_dma_tx_cleanup,
++ .rx_init = mt76_dma_rx_queue_init,
+ .rx_cleanup = mt76_dma_rx_cleanup,
+ .rx_reset = mt76_dma_rx_reset,
+ .kick = mt76_dma_kick_queue,
+diff --git a/dma.h b/dma.h
+index 718122d5..393be98a 100644
+--- a/dma.h
++++ b/dma.h
+@@ -31,8 +31,12 @@
+ #define MT_DMA_CTL_PN_CHK_FAIL BIT(13)
+ #define MT_DMA_CTL_VER_MASK BIT(7)
+
+-#define MT_DMA_RRO_EN BIT(13)
++#define MT_DMA_SDP0 GENMASK(15, 0)
++#define MT_DMA_TOKEN_ID GENMASK(31, 16)
++#define MT_DMA_MAGIC_MASK GENMASK(31, 28)
++#define MT_DMA_RRO_EN BIT(13)
+
++#define MT_DMA_MAGIC_CNT 16
+ #define MT_DMA_WED_IND_CMD_CNT 8
+ #define MT_DMA_WED_IND_REASON GENMASK(15, 12)
+
+diff --git a/mac80211.c b/mac80211.c
+index d5f842db..d81bf667 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -732,6 +732,7 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
+ struct sk_buff *skb = phy->rx_amsdu[q].head;
+ struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
+ struct mt76_dev *dev = phy->dev;
++ struct mt76_queue *rxq = &dev->q_rx[q];
+
+ phy->rx_amsdu[q].head = NULL;
+ phy->rx_amsdu[q].tail = NULL;
+@@ -763,6 +764,10 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
+ return;
+ }
+ }
++
++ if (mt76_queue_is_wed_rro_data(rxq))
++ q = MT_RXQ_RRO_IND;
++
+ __skb_queue_tail(&dev->rx_skb[q], skb);
+ }
+
+diff --git a/mt76.h b/mt76.h
+index e5e5529d..58e9b0b7 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -276,6 +276,7 @@ struct mt76_queue {
+
+ u8 buf_offset;
+ u16 flags;
++ u8 magic_cnt;
+
+ struct mtk_wed_device *wed;
+ u32 wed_regs;
+@@ -329,6 +330,9 @@ struct mt76_queue_ops {
+ void (*tx_cleanup)(struct mt76_dev *dev, struct mt76_queue *q,
+ bool flush);
+
++ int (*rx_init)(struct mt76_dev *dev, enum mt76_rxq_id qid,
++ int (*poll)(struct napi_struct *napi, int budget));
++
+ void (*rx_cleanup)(struct mt76_dev *dev, struct mt76_queue *q);
+
+ void (*kick)(struct mt76_dev *dev, struct mt76_queue *q);
+@@ -472,6 +476,7 @@ struct mt76_rxwi_cache {
+ dma_addr_t dma_addr;
+
+ void *ptr;
++ u8 qid;
+ };
+
+ struct mt76_rx_tid {
+@@ -578,6 +583,10 @@ struct mt76_driver_ops {
+ void (*rx_skb)(struct mt76_dev *dev, enum mt76_rxq_id q,
+ struct sk_buff *skb, u32 *info);
+
++ void (*rx_rro_ind_process)(struct mt76_dev *dev, void *data);
++ int (*rx_rro_fill_msdu_pg)(struct mt76_dev *dev, struct mt76_queue *q,
++ dma_addr_t p, void *data);
++
+ void (*rx_poll_complete)(struct mt76_dev *dev, enum mt76_rxq_id q);
+
+ void (*sta_ps)(struct mt76_dev *dev, struct ieee80211_sta *sta,
+@@ -1306,6 +1315,7 @@ static inline int mt76_wed_dma_setup(struct mt76_dev *dev, struct mt76_queue *q,
+ #define mt76_tx_queue_skb(dev, ...) (dev)->mt76.queue_ops->tx_queue_skb(&((dev)->mphy), __VA_ARGS__)
+ #define mt76_queue_rx_reset(dev, ...) (dev)->mt76.queue_ops->rx_reset(&((dev)->mt76), __VA_ARGS__)
+ #define mt76_queue_tx_cleanup(dev, ...) (dev)->mt76.queue_ops->tx_cleanup(&((dev)->mt76), __VA_ARGS__)
++#define mt76_queue_rx_init(dev, ...) (dev)->mt76.queue_ops->rx_init(&((dev)->mt76), __VA_ARGS__)
+ #define mt76_queue_rx_cleanup(dev, ...) (dev)->mt76.queue_ops->rx_cleanup(&((dev)->mt76), __VA_ARGS__)
+ #define mt76_queue_kick(dev, ...) (dev)->mt76.queue_ops->kick(&((dev)->mt76), __VA_ARGS__)
+ #define mt76_queue_reset(dev, ...) (dev)->mt76.queue_ops->reset_q(&((dev)->mt76), __VA_ARGS__)
+@@ -1871,13 +1881,8 @@ static inline bool mt76_queue_is_wed_rro_msdu_pg(struct mt76_queue *q)
+
+ static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
+ {
+- if (!(q->flags & MT_QFLAG_WED))
+- return false;
+-
+- return FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX ||
+- mt76_queue_is_wed_rro_ind(q) || mt76_queue_is_wed_rro_data(q) ||
+- mt76_queue_is_wed_rro_msdu_pg(q);
+-
++ return (q->flags & MT_QFLAG_WED) &&
++ FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX;
+ }
+
+ struct mt76_txwi_cache *
+diff --git a/mt7996/dma.c b/mt7996/dma.c
+index bbc3814d..e4b0af29 100644
+--- a/mt7996/dma.c
++++ b/mt7996/dma.c
+@@ -300,7 +300,7 @@ void mt7996_dma_start(struct mt7996_dev *dev, bool reset, bool wed_reset)
+ }
+
+ if (mt7996_band_valid(dev, MT_BAND2))
+- irq_mask |= MT_INT_BAND2_RX_DONE;
++ irq_mask |= MT_INT_BAND2_RX_DONE | MT_INT_TX_RX_DONE_EXT;
+
+ if (mtk_wed_device_active(wed) && wed_reset) {
+ u32 wed_irq_mask = irq_mask;
+@@ -465,7 +465,6 @@ static void mt7996_dma_enable(struct mt7996_dev *dev, bool reset)
+ mt7996_dma_start(dev, reset, true);
+ }
+
+-#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ int mt7996_dma_rro_init(struct mt7996_dev *dev)
+ {
+ struct mt76_dev *mdev = &dev->mt76;
+@@ -474,7 +473,9 @@ int mt7996_dma_rro_init(struct mt7996_dev *dev)
+
+ /* ind cmd */
+ mdev->q_rx[MT_RXQ_RRO_IND].flags = MT_WED_RRO_Q_IND;
+- mdev->q_rx[MT_RXQ_RRO_IND].wed = &mdev->mmio.wed;
++ if (mtk_wed_device_active(&mdev->mmio.wed) &&
++ mtk_wed_get_rx_capa(&mdev->mmio.wed))
++ mdev->q_rx[MT_RXQ_RRO_IND].wed = &mdev->mmio.wed;
+ ret = mt76_queue_alloc(dev, &mdev->q_rx[MT_RXQ_RRO_IND],
+ MT_RXQ_ID(MT_RXQ_RRO_IND),
+ MT7996_RX_RING_SIZE,
+@@ -485,7 +486,9 @@ int mt7996_dma_rro_init(struct mt7996_dev *dev)
+ /* rx msdu page queue for band0 */
+ mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND0].flags =
+ MT_WED_RRO_Q_MSDU_PG(0) | MT_QFLAG_WED_RRO_EN;
+- mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND0].wed = &mdev->mmio.wed;
++ if (mtk_wed_device_active(&mdev->mmio.wed) &&
++ mtk_wed_get_rx_capa(&mdev->mmio.wed))
++ mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND0].wed = &mdev->mmio.wed;
+ ret = mt76_queue_alloc(dev, &mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND0],
+ MT_RXQ_ID(MT_RXQ_MSDU_PAGE_BAND0),
+ MT7996_RX_RING_SIZE,
+@@ -498,7 +501,9 @@ int mt7996_dma_rro_init(struct mt7996_dev *dev)
+ /* rx msdu page queue for band1 */
+ mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND1].flags =
+ MT_WED_RRO_Q_MSDU_PG(1) | MT_QFLAG_WED_RRO_EN;
+- mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND1].wed = &mdev->mmio.wed;
++ if (mtk_wed_device_active(&mdev->mmio.wed) &&
++ mtk_wed_get_rx_capa(&mdev->mmio.wed))
++ mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND1].wed = &mdev->mmio.wed;
+ ret = mt76_queue_alloc(dev, &mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND1],
+ MT_RXQ_ID(MT_RXQ_MSDU_PAGE_BAND1),
+ MT7996_RX_RING_SIZE,
+@@ -512,7 +517,9 @@ int mt7996_dma_rro_init(struct mt7996_dev *dev)
+ /* rx msdu page queue for band2 */
+ mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND2].flags =
+ MT_WED_RRO_Q_MSDU_PG(2) | MT_QFLAG_WED_RRO_EN;
+- mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND2].wed = &mdev->mmio.wed;
++ if (mtk_wed_device_active(&mdev->mmio.wed) &&
++ mtk_wed_get_rx_capa(&mdev->mmio.wed))
++ mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND2].wed = &mdev->mmio.wed;
+ ret = mt76_queue_alloc(dev, &mdev->q_rx[MT_RXQ_MSDU_PAGE_BAND2],
+ MT_RXQ_ID(MT_RXQ_MSDU_PAGE_BAND2),
+ MT7996_RX_RING_SIZE,
+@@ -522,15 +529,37 @@ int mt7996_dma_rro_init(struct mt7996_dev *dev)
+ return ret;
+ }
+
+- irq_mask = mdev->mmio.irqmask | MT_INT_RRO_RX_DONE |
+- MT_INT_TX_DONE_BAND2;
+- mt76_wr(dev, MT_INT_MASK_CSR, irq_mask);
+- mtk_wed_device_start_hw_rro(&mdev->mmio.wed, irq_mask, false);
+- mt7996_irq_enable(dev, irq_mask);
++
++
++ if (mtk_wed_device_active(&mdev->mmio.wed)) {
++ irq_mask = mdev->mmio.irqmask | MT_INT_RRO_RX_DONE |
++ MT_INT_TX_DONE_BAND2;
++
++ if (mtk_wed_get_rx_capa(&mdev->mmio.wed))
++ irq_mask &= ~MT_INT_RX_DONE_RRO_IND;
++
++ mt76_wr(dev, MT_INT_MASK_CSR, irq_mask);
++ mtk_wed_device_start_hw_rro(&mdev->mmio.wed, irq_mask, false);
++ mt7996_irq_enable(dev, irq_mask);
++ } else {
++ if (is_mt7996(&dev->mt76)) {
++ mt76_queue_rx_init(dev, MT_RXQ_TXFREE_BAND0, mt76_dma_rx_poll);
++ mt76_queue_rx_init(dev, MT_RXQ_TXFREE_BAND2, mt76_dma_rx_poll);
++ mt76_queue_rx_init(dev, MT_RXQ_MSDU_PAGE_BAND1, mt76_dma_rx_poll);
++ mt76_queue_rx_init(dev, MT_RXQ_MSDU_PAGE_BAND2, mt76_dma_rx_poll);
++ }
++ mt76_queue_rx_init(dev, MT_RXQ_RRO_BAND0, mt76_dma_rx_poll);
++ mt76_queue_rx_init(dev, MT_RXQ_RRO_BAND1, mt76_dma_rx_poll);
++ if (mt7996_band_valid(dev, MT_BAND2))
++ mt76_queue_rx_init(dev, MT_RXQ_RRO_BAND2, mt76_dma_rx_poll);
++ mt76_queue_rx_init(dev, MT_RXQ_RRO_IND, mt76_dma_rx_poll);
++ mt76_queue_rx_init(dev, MT_RXQ_MSDU_PAGE_BAND0, mt76_dma_rx_poll);
++
++ mt7996_irq_enable(dev, MT_INT_RRO_RX_DONE);
++ }
+
+ return 0;
+ }
+-#endif /* CONFIG_NET_MEDIATEK_SOC_WED */
+
+ int mt7996_dma_init(struct mt7996_dev *dev)
+ {
+@@ -691,12 +720,12 @@ int mt7996_dma_init(struct mt7996_dev *dev)
+ return ret;
+ }
+
+- if (mtk_wed_device_active(wed) && mtk_wed_get_rx_capa(wed) &&
+- dev->has_rro) {
++ if (dev->has_rro) {
+ /* rx rro data queue for band0 */
+ dev->mt76.q_rx[MT_RXQ_RRO_BAND0].flags =
+ MT_WED_RRO_Q_DATA(0) | MT_QFLAG_WED_RRO_EN;
+- dev->mt76.q_rx[MT_RXQ_RRO_BAND0].wed = wed;
++ if (mtk_wed_device_active(wed) && mtk_wed_get_rx_capa(wed))
++ dev->mt76.q_rx[MT_RXQ_RRO_BAND0].wed = wed;
+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_RRO_BAND0],
+ MT_RXQ_ID(MT_RXQ_RRO_BAND0),
+ MT7996_RX_RING_SIZE,
+@@ -708,7 +737,8 @@ int mt7996_dma_init(struct mt7996_dev *dev)
+ if (is_mt7992(&dev->mt76)) {
+ dev->mt76.q_rx[MT_RXQ_RRO_BAND1].flags =
+ MT_WED_RRO_Q_DATA(1) | MT_QFLAG_WED_RRO_EN;
+- dev->mt76.q_rx[MT_RXQ_RRO_BAND1].wed = wed;
++ if (mtk_wed_device_active(wed) && mtk_wed_get_rx_capa(wed))
++ dev->mt76.q_rx[MT_RXQ_RRO_BAND1].wed = wed;
+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_RRO_BAND1],
+ MT_RXQ_ID(MT_RXQ_RRO_BAND1),
+ MT7996_RX_RING_SIZE,
+@@ -718,9 +748,10 @@ int mt7996_dma_init(struct mt7996_dev *dev)
+ return ret;
+ } else {
+ /* tx free notify event from WA for band0 */
+- dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].flags = MT_WED_Q_TXFREE;
+- dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].wed = wed;
+-
++ if (mtk_wed_device_active(wed)) {
++ dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].flags = MT_WED_Q_TXFREE;
++ dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].wed = wed;
++ }
+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0],
+ MT_RXQ_ID(MT_RXQ_TXFREE_BAND0),
+ MT7996_RX_MCU_RING_SIZE,
+@@ -734,7 +765,8 @@ int mt7996_dma_init(struct mt7996_dev *dev)
+ /* rx rro data queue for band2 */
+ dev->mt76.q_rx[MT_RXQ_RRO_BAND2].flags =
+ MT_WED_RRO_Q_DATA(1) | MT_QFLAG_WED_RRO_EN;
+- dev->mt76.q_rx[MT_RXQ_RRO_BAND2].wed = wed;
++ if (mtk_wed_device_active(wed) && mtk_wed_get_rx_capa(wed))
++ dev->mt76.q_rx[MT_RXQ_RRO_BAND2].wed = wed;
+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_RRO_BAND2],
+ MT_RXQ_ID(MT_RXQ_RRO_BAND2),
+ MT7996_RX_RING_SIZE,
+@@ -811,6 +843,11 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
+ dev_info(dev->mt76.dev,"%s L1 SER rx queue clean up done.",
+ wiphy_name(dev->mt76.hw->wiphy));
+
++ if (dev->has_rro && !mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ mt7996_rro_msdu_pg_free(dev);
++ mt7996_rx_token_put(dev);
++ }
++
+ mt76_tx_status_check(&dev->mt76, true);
+
+ if (!force)
+diff --git a/mt7996/init.c b/mt7996/init.c
+index bad4b1b7..0e647356 100644
+--- a/mt7996/init.c
++++ b/mt7996/init.c
+@@ -931,7 +931,6 @@ void mt7996_wfsys_reset(struct mt7996_dev *dev)
+
+ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+ {
+-#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
+ u32 reg = MT_RRO_ADDR_ELEM_SEG_ADDR0;
+ int i;
+@@ -939,6 +938,10 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+ if (!dev->has_rro)
+ return;
+
++ INIT_LIST_HEAD(&dev->wed_rro.pg_addr_cache);
++ for (i = 0; i < MT7996_RRO_MSDU_PG_HASH_SIZE; i++)
++ INIT_LIST_HEAD(&dev->wed_rro.pg_hash_head[i]);
++
+ if (is_mt7992(&dev->mt76)) {
+ /* set emul 3.0 function */
+ mt76_wr(dev, MT_RRO_3_0_EMU_CONF,
+@@ -947,9 +950,6 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+ mt76_wr(dev, MT_RRO_ADDR_ARRAY_BASE0,
+ dev->wed_rro.addr_elem[0].phy_addr);
+ } else {
+- INIT_LIST_HEAD(&dev->wed_rro.pg_addr_cache);
+- for (i = 0; i < MT7996_RRO_MSDU_PG_HASH_SIZE; i++)
+- INIT_LIST_HEAD(&dev->wed_rro.pg_hash_head[i]);
+
+ /* TODO: remove line after WM has set */
+ mt76_clear(dev, WF_RRO_AXI_MST_CFG, WF_RRO_AXI_MST_CFG_DIDX_OK);
+@@ -972,18 +972,24 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+ mt76_wr(dev, MT_RRO_ADDR_ARRAY_BASE1,
+ MT_RRO_ADDR_ARRAY_ELEM_ADDR_SEG_MODE);
+ }
+- wed->wlan.ind_cmd.win_size = ffs(MT7996_RRO_WINDOW_MAX_LEN) - 6;
+- if (is_mt7996(&dev->mt76))
+- wed->wlan.ind_cmd.particular_sid = MT7996_RRO_MAX_SESSION;
+- else
+- wed->wlan.ind_cmd.particular_sid = 1;
+- wed->wlan.ind_cmd.particular_se_phys = dev->wed_rro.session.phy_addr;
+- wed->wlan.ind_cmd.se_group_nums = MT7996_RRO_ADDR_ELEM_LEN;
+- wed->wlan.ind_cmd.ack_sn_addr = MT_RRO_ACK_SN_CTRL;
+
+- mt76_wr(dev, MT_RRO_IND_CMD_SIGNATURE_BASE0, 0x15010e00);
+- mt76_set(dev, MT_RRO_IND_CMD_SIGNATURE_BASE1,
+- MT_RRO_IND_CMD_SIGNATURE_BASE1_EN);
++ if (mtk_wed_device_active(wed) && mtk_wed_get_rx_capa(wed)) {
++ wed->wlan.ind_cmd.win_size = ffs(MT7996_RRO_WINDOW_MAX_LEN) - 6;
++ if (is_mt7996(&dev->mt76))
++ wed->wlan.ind_cmd.particular_sid = MT7996_RRO_MAX_SESSION;
++ else
++ wed->wlan.ind_cmd.particular_sid = 1;
++ wed->wlan.ind_cmd.particular_se_phys = dev->wed_rro.session.phy_addr;
++ wed->wlan.ind_cmd.se_group_nums = MT7996_RRO_ADDR_ELEM_LEN;
++ wed->wlan.ind_cmd.ack_sn_addr = MT_RRO_ACK_SN_CTRL;
++
++ mt76_wr(dev, MT_RRO_IND_CMD_SIGNATURE_BASE0, 0x15010e00);
++ mt76_set(dev, MT_RRO_IND_CMD_SIGNATURE_BASE1,
++ MT_RRO_IND_CMD_SIGNATURE_BASE1_EN);
++ } else {
++ mt76_wr(dev, MT_RRO_IND_CMD_SIGNATURE_BASE0, 0);
++ mt76_wr(dev, MT_RRO_IND_CMD_SIGNATURE_BASE1, 0);
++ }
+
+ /* particular session configure */
+ /* use max session idx + 1 as particular session id */
+@@ -1012,12 +1018,10 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
+ mt76_wr(dev, MT_RRO_HOST_INT_ENA,
+ MT_RRO_HOST_INT_ENA_HOST_RRO_DONE_ENA);
+
+-#endif
+ }
+
+ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
+ {
+-#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
+ struct mt7996_wed_rro_addr *addr;
+ void *ptr;
+@@ -1026,9 +1030,6 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
+ if (!dev->has_rro)
+ return 0;
+
+- if (!mtk_wed_device_active(wed))
+- return 0;
+-
+ for (i = 0; i < ARRAY_SIZE(dev->wed_rro.ba_bitmap); i++) {
+ ptr = dmam_alloc_coherent(dev->mt76.dma_dev,
+ MT7996_RRO_BA_BITMAP_CR_SIZE,
+@@ -1059,9 +1060,8 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
+ addr->signature = 0xff;
+ addr++;
+ }
+-
+- wed->wlan.ind_cmd.addr_elem_phys[i] =
+- dev->wed_rro.addr_elem[i].phy_addr;
++ if (mtk_wed_device_active(wed) && mtk_wed_get_rx_capa(wed))
++ wed->wlan.ind_cmd.addr_elem_phys[i] = dev->wed_rro.addr_elem[i].phy_addr;
+ }
+
+ for (i = 0; i < MT7996_RRO_MSDU_PG_CR_CNT; i++) {
+@@ -1093,22 +1093,15 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev)
+ mt7996_rro_hw_init(dev);
+
+ return mt7996_dma_rro_init(dev);
+-#else
+- return 0;
+-#endif
+ }
+
+ static void mt7996_wed_rro_free(struct mt7996_dev *dev)
+ {
+-#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ int i;
+
+ if (!dev->has_rro)
+ return;
+
+- if (!mtk_wed_device_active(&dev->mt76.mmio.wed))
+- return;
+-
+ for (i = 0; i < ARRAY_SIZE(dev->wed_rro.ba_bitmap); i++) {
+ if (!dev->wed_rro.ba_bitmap[i].ptr)
+ continue;
+@@ -1138,12 +1131,10 @@ static void mt7996_wed_rro_free(struct mt7996_dev *dev)
+ sizeof(struct mt7996_wed_rro_addr),
+ dev->wed_rro.session.ptr,
+ dev->wed_rro.session.phy_addr);
+-#endif
+ }
+
+ static void mt7996_wed_rro_work(struct work_struct *work)
+ {
+-#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ struct mt7996_dev *dev;
+ LIST_HEAD(list);
+
+@@ -1186,7 +1177,6 @@ reset:
+ out:
+ kfree(e);
+ }
+-#endif
+ }
+
+ int mt7996_get_chip_sku(struct mt7996_dev *dev)
+@@ -1828,6 +1818,10 @@ void mt7996_unregister_device(struct mt7996_dev *dev)
+ mt7996_mcu_exit(dev);
+ mt7996_tx_token_put(dev);
+ mt7996_dma_cleanup(dev);
++ if (dev->has_rro && !mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ mt7996_rro_msdu_pg_free(dev);
++ mt7996_rx_token_put(dev);
++ }
+ tasklet_disable(&dev->mt76.irq_tasklet);
+
+ mt76_free_device(&dev->mt76);
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index 27b4e99f..c0f282d1 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -1505,6 +1505,387 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+ }
+ }
+
++static struct mt7996_msdu_pg_addr *
++mt7996_alloc_pg_addr(struct mt7996_dev *dev)
++{
++ struct mt7996_msdu_pg_addr *p;
++ int size;
++
++ size = L1_CACHE_ALIGN(sizeof(*p));
++ p = kzalloc(size, GFP_ATOMIC);
++ if (!p)
++ return NULL;
++
++ INIT_LIST_HEAD(&p->list);
++
++ return p;
++}
++
++static struct mt7996_msdu_pg_addr *
++__mt7996_get_pg_addr(struct mt7996_dev *dev)
++{
++ struct mt7996_msdu_pg_addr *p = NULL;
++
++ spin_lock(&dev->wed_rro.lock);
++ if (!list_empty(&dev->wed_rro.pg_addr_cache)) {
++ p = list_first_entry(&dev->wed_rro.pg_addr_cache,
++ struct mt7996_msdu_pg_addr,
++ list);
++ if (p)
++ list_del(&p->list);
++ }
++ spin_unlock(&dev->wed_rro.lock);
++
++ return p;
++}
++
++struct mt7996_msdu_pg_addr *
++mt7996_get_pg_addr(struct mt7996_dev *dev)
++{
++ struct mt7996_msdu_pg_addr *p = __mt7996_get_pg_addr(dev);
++
++ if (p)
++ return p;
++
++ return mt7996_alloc_pg_addr(dev);
++}
++
++static void
++mt7996_put_pg_addr(struct mt7996_dev *dev,
++ struct mt7996_msdu_pg_addr *p)
++{
++ if (!p)
++ return;
++
++ if (p->buf) {
++ skb_free_frag(p->buf);
++ p->buf = NULL;
++ }
++
++ spin_lock(&dev->wed_rro.lock);
++ list_add(&p->list, &dev->wed_rro.pg_addr_cache);
++ spin_unlock(&dev->wed_rro.lock);
++}
++
++static void
++mt7996_free_pg_addr(struct mt7996_dev *dev)
++{
++ struct mt7996_msdu_pg_addr *pg_addr;
++
++ local_bh_disable();
++ while ((pg_addr = __mt7996_get_pg_addr(dev)) != NULL) {
++ if (pg_addr->buf) {
++ skb_free_frag(pg_addr->buf);
++ pg_addr->buf = NULL;
++ }
++ kfree(pg_addr);
++ }
++ local_bh_enable();
++}
++
++static u32
++mt7996_rro_msdu_pg_hash(dma_addr_t pa)
++{
++ u32 sum = 0;
++ u16 i = 0;
++
++ while (pa != 0) {
++ sum += (u32) ((pa & 0xff) + i) % MT7996_RRO_MSDU_PG_HASH_SIZE;
++ pa >>= 8;
++ i += 13;
++ }
++
++ return sum % MT7996_RRO_MSDU_PG_HASH_SIZE;
++}
++
++static struct mt7996_msdu_pg_addr *
++mt7996_rro_msdu_pg_search(struct mt7996_dev *dev, dma_addr_t pa)
++{
++ struct mt7996_msdu_pg_addr *pg_addr, *tmp;
++ u32 hash_idx = mt7996_rro_msdu_pg_hash(pa);
++ struct list_head *head;
++ u8 found = 0;
++
++ spin_lock(&dev->wed_rro.lock);
++ head = &dev->wed_rro.pg_hash_head[hash_idx];
++ list_for_each_entry_safe(pg_addr, tmp, head, list) {
++ if (pg_addr->dma_addr == pa) {
++ list_del(&pg_addr->list);
++ found = 1;
++ break;
++ }
++ }
++ spin_unlock(&dev->wed_rro.lock);
++
++ return (found == 1) ? pg_addr : NULL;
++}
++
++void mt7996_rro_msdu_pg_free(struct mt7996_dev *dev)
++{
++ struct mt7996_msdu_pg_addr *pg_addr, *tmp;
++ struct list_head *head;
++ u32 i;
++
++ local_bh_disable();
++ for (i = 0; i < MT7996_RRO_MSDU_PG_HASH_SIZE; i++) {
++ head = &dev->wed_rro.pg_hash_head[i];
++ list_for_each_entry_safe(pg_addr, tmp, head, list) {
++ list_del_init(&pg_addr->list);
++ dma_unmap_single(dev->mt76.dma_dev, pg_addr->dma_addr,
++ SKB_WITH_OVERHEAD(pg_addr->q->buf_size),
++ DMA_FROM_DEVICE);
++ if (pg_addr->buf) {
++ skb_free_frag(pg_addr->buf);
++ pg_addr->buf = NULL;
++ }
++ kfree(pg_addr);
++ }
++ }
++ local_bh_enable();
++
++ mt7996_free_pg_addr(dev);
++
++ mt76_for_each_q_rx(&dev->mt76, i) {
++ struct mt76_queue *q = &dev->mt76.q_rx[i];
++ struct page *page;
++
++ if (mt76_queue_is_wed_rro_msdu_pg(q)) {
++ if (!q->rx_page.va)
++ continue;
++
++ page = virt_to_page(q->rx_page.va);
++ __page_frag_cache_drain(page, q->rx_page.pagecnt_bias);
++ memset(&q->rx_page, 0, sizeof(q->rx_page));
++ }
++ }
++}
++
++void mt7996_rx_token_put(struct mt7996_dev *dev)
++{
++ struct mt76_queue *q;
++ struct page *page;
++ int i;
++
++ for (i = 0; i < dev->mt76.rx_token_size; i++) {
++ struct mt76_rxwi_cache *r;
++
++ r = mt76_rx_token_release(&dev->mt76, i);
++ if (!r || !r->ptr)
++ continue;
++
++ q = &dev->mt76.q_rx[r->qid];
++ dma_unmap_single(dev->mt76.dma_dev, r->dma_addr,
++ SKB_WITH_OVERHEAD(q->buf_size),
++ DMA_FROM_DEVICE);
++ skb_free_frag(r->ptr);
++ r->dma_addr = 0;
++ r->ptr = NULL;
++
++ mt76_put_rxwi(&dev->mt76, r);
++ }
++
++ mt76_for_each_q_rx(&dev->mt76, i) {
++ struct mt76_queue *q = &dev->mt76.q_rx[i];
++
++ if (mt76_queue_is_wed_rro_data(q)) {
++ if (!q->rx_page.va)
++ continue;
++
++ page = virt_to_page(q->rx_page.va);
++ __page_frag_cache_drain(page, q->rx_page.pagecnt_bias);
++ memset(&q->rx_page, 0, sizeof(q->rx_page));
++ }
++ }
++
++ mt76_free_pending_rxwi(&dev->mt76);
++}
++
++int mt7996_rro_fill_msdu_page(struct mt76_dev *mdev, struct mt76_queue *q,
++ dma_addr_t p, void *data)
++{
++ struct mt7996_msdu_pg_addr *pg_addr;
++ struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
++ struct mt7996_msdu_pg *pg = data;
++ u32 hash_idx;
++
++ pg->owner = 1;
++ pg_addr = mt7996_get_pg_addr(dev);
++ if (!pg_addr)
++ return -ENOMEM;
++
++ pg_addr->buf = data;
++ pg_addr->dma_addr = p;
++ pg_addr->q = q;
++ hash_idx = mt7996_rro_msdu_pg_hash(pg_addr->dma_addr);
++
++ spin_lock(&dev->wed_rro.lock);
++ list_add_tail(&pg_addr->list,
++ &dev->wed_rro.pg_hash_head[hash_idx]);
++ spin_unlock(&dev->wed_rro.lock);
++
++ return 0;
++}
++
++static struct mt7996_wed_rro_addr *
++mt7996_rro_get_addr_elem(struct mt7996_dev *dev, u16 seid, u16 sn)
++{
++ u32 idx;
++ void *addr;
++
++ if (seid == MT7996_RRO_MAX_SESSION) {
++ addr = dev->wed_rro.session.ptr;
++ idx = sn % MT7996_RRO_WINDOW_MAX_LEN;
++ } else {
++ addr = dev->wed_rro.addr_elem[seid/ MT7996_RRO_BA_BITMAP_SESSION_SIZE].ptr;
++ idx = (seid % MT7996_RRO_BA_BITMAP_SESSION_SIZE) * MT7996_RRO_WINDOW_MAX_LEN
++ + (sn % MT7996_RRO_WINDOW_MAX_LEN);
++ }
++ return addr + idx * sizeof(struct mt7996_wed_rro_addr);
++}
++
++void mt7996_rro_rx_process(struct mt76_dev *mdev, void *data)
++{
++ struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
++ struct mt76_wed_rro_ind *cmd = (struct mt76_wed_rro_ind *)data;
++ struct mt76_rxwi_cache *r;
++ struct mt76_rx_status *status;
++ struct mt76_queue *q;
++ struct mt7996_wed_rro_addr *elem;
++ struct mt7996_msdu_pg_addr *pg_addr = NULL;
++ struct mt7996_msdu_pg *pg = NULL;
++ struct mt7996_rro_hif *rxd;
++ struct sk_buff *skb;
++ dma_addr_t msdu_pg_pa;
++ int len, data_len, i, j, sn;
++ void *buf;
++ u8 more, qid;
++ u32 info = 0;
++
++ for (i = 0; i < cmd->ind_cnt; i++) {
++ sn = (cmd->start_sn + i) & GENMASK(11, 0);
++ elem = mt7996_rro_get_addr_elem(dev, cmd->se_id, sn);
++ if (elem->signature != (sn / MT7996_RRO_WINDOW_MAX_LEN)) {
++ elem->signature = 0xff;
++ goto update_ack_sn;
++ }
++
++ msdu_pg_pa = elem->head_high;
++ msdu_pg_pa <<= 32;
++ msdu_pg_pa |= elem->head_low;
++
++ for (j = 0; j < elem->count; j++) {
++ if (pg_addr == NULL) {
++ pg_addr = mt7996_rro_msdu_pg_search(dev, msdu_pg_pa);
++
++ if (pg_addr == NULL) {
++ dev_info(mdev->dev, "pg_addr(%llx) search fail\n",
++ msdu_pg_pa);
++ continue;
++ }
++
++ dma_unmap_single(mdev->dma_dev, pg_addr->dma_addr,
++ SKB_WITH_OVERHEAD(pg_addr->q->buf_size),
++ DMA_FROM_DEVICE);
++
++ pg = (struct mt7996_msdu_pg *) pg_addr->buf;
++ }
++
++ rxd = &pg->rxd[j % MT7996_MAX_HIF_RXD_IN_PG];
++ more = !rxd->ls;
++ len = rxd->sdl;
++
++ r = mt76_rx_token_release(mdev, rxd->rx_token_id);
++ if (!r)
++ goto next_page_chk;
++
++ qid = r->qid;
++ buf = r->ptr;
++ q = &mdev->q_rx[qid];
++ dma_unmap_single(mdev->dma_dev, r->dma_addr,
++ SKB_WITH_OVERHEAD(q->buf_size),
++ DMA_FROM_DEVICE);
++ r->dma_addr = 0;
++ r->ptr = NULL;
++ mt76_put_rxwi(mdev, r);
++ if (!buf)
++ goto next_page_chk;
++
++ if (q->rx_head)
++ data_len = q->buf_size;
++ else
++ data_len = SKB_WITH_OVERHEAD(q->buf_size);
++
++ if (data_len < len + q->buf_offset) {
++ dev_kfree_skb(q->rx_head);
++ skb_free_frag(buf);
++ q->rx_head = NULL;
++ goto next_page_chk;
++ }
++
++ if (q->rx_head) {
++ /* TDO: fragment error, skip handle */
++ //mt76_add_fragment(mdev, q, buf, len, more, info);
++ skb_free_frag(buf);
++ if (!more) {
++ dev_kfree_skb(q->rx_head);
++ q->rx_head = NULL;
++ }
++ goto next_page_chk;
++ }
++
++ if (!more && !mt7996_rx_check(mdev, buf, len))
++ goto next_page_chk;
++
++ skb = build_skb(buf, q->buf_size);
++ if (!skb)
++ goto next_page_chk;
++
++ skb_reserve(skb, q->buf_offset);
++ __skb_put(skb, len);
++
++ if (cmd->ind_reason == 1 || cmd->ind_reason == 2) {
++ dev_kfree_skb(skb);
++ goto next_page_chk;
++ }
++
++ if (more) {
++ q->rx_head = skb;
++ goto next_page_chk;
++ }
++
++ status = (struct mt76_rx_status *)skb->cb;
++ if (cmd->se_id != MT7996_RRO_MAX_SESSION)
++ status->aggr = true;
++
++ mt7996_queue_rx_skb(mdev, qid, skb, &info);
++
++next_page_chk:
++ if ((j + 1) % MT7996_MAX_HIF_RXD_IN_PG == 0) {
++ msdu_pg_pa = pg->next_pg_h;
++ msdu_pg_pa <<= 32;
++ msdu_pg_pa |= pg->next_pg_l;
++ mt7996_put_pg_addr(dev, pg_addr);
++ pg_addr = NULL;
++ }
++ }
++update_ack_sn:
++ if ((i + 1) % 4 == 0)
++ mt76_wr(dev, MT_RRO_ACK_SN_CTRL,
++ FIELD_PREP(MT_RRO_ACK_SN_CTRL_SESSION_MASK, cmd->se_id) |
++ FIELD_PREP(MT_RRO_ACK_SN_CTRL_SN_MASK, sn));
++ if (pg_addr) {
++ mt7996_put_pg_addr(dev, pg_addr);
++ pg_addr = NULL;
++ }
++ }
++
++ /* update ack_sn for remaining addr_elem */
++ if (i % 4 != 0)
++ mt76_wr(dev, MT_RRO_ACK_SN_CTRL,
++ FIELD_PREP(MT_RRO_ACK_SN_CTRL_SESSION_MASK, cmd->se_id) |
++ FIELD_PREP(MT_RRO_ACK_SN_CTRL_SN_MASK, sn));
++}
++
+ void mt7996_mac_cca_stats_reset(struct mt7996_phy *phy)
+ {
+ struct mt7996_dev *dev = phy->dev;
+@@ -2040,6 +2421,9 @@ void mt7996_mac_reset_work(struct work_struct *work)
+ dev_info(dev->mt76.dev,"%s L1 SER dma start done.",
+ wiphy_name(dev->mt76.hw->wiphy));
+
++ if (is_mt7992(&dev->mt76) && dev->has_rro)
++ mt76_wr(dev, MT_RRO_3_0_EMU_CONF, MT_RRO_3_0_EMU_CONF_EN_MASK);
++
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
+ u32 wed_irq_mask = MT_INT_RRO_RX_DONE | MT_INT_TX_DONE_BAND2 |
+ dev->mt76.mmio.irqmask;
+@@ -2049,10 +2433,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
+
+ mt76_wr(dev, MT_INT_MASK_CSR, wed_irq_mask);
+
+- if (is_mt7992(&dev->mt76) && dev->has_rro)
+- mt76_wr(dev, MT_RRO_3_0_EMU_CONF,
+- MT_RRO_3_0_EMU_CONF_EN_MASK);
+-
+ mtk_wed_device_start_hw_rro(&dev->mt76.mmio.wed, wed_irq_mask,
+ true);
+
+diff --git a/mt7996/mmio.c b/mt7996/mmio.c
+index 58db5204..4d9cb9ff 100644
+--- a/mt7996/mmio.c
++++ b/mt7996/mmio.c
+@@ -654,6 +654,8 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
+ .rx_skb = mt7996_queue_rx_skb,
+ .rx_check = mt7996_rx_check,
+ .rx_poll_complete = mt7996_rx_poll_complete,
++ .rx_rro_ind_process = mt7996_rro_rx_process,
++ .rx_rro_fill_msdu_pg = mt7996_rro_fill_msdu_page,
+ .sta_add = mt7996_mac_sta_add,
+ .sta_assoc = mt7996_mac_sta_assoc,
+ .sta_remove = mt7996_mac_sta_remove,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 65a88e58..3aedaf5a 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -102,6 +102,7 @@
+
+ #define MT7996_BUILD_TIME_LEN 24
+
++#define MT7996_MAX_HIF_RXD_IN_PG 5
+ #define MT7996_RRO_MSDU_PG_HASH_SIZE 127
+ #define MT7996_RRO_MAX_SESSION 1024
+ #define MT7996_RRO_WINDOW_MAX_LEN 1024
+@@ -532,6 +533,33 @@ int mt7996_mcu_set_muru_qos_cfg(struct mt7996_dev *dev, u16 wlan_idx, u8 dir,
+ u8 scs_id, u8 req_type, u8 *qos_ie, u8 qos_ie_len);
+ #endif
+
++struct mt7996_rro_hif {
++ u32 rx_blk_base_l;
++ u32 rx_blk_base_h: 4;
++ u32 eth_hdr_ofst : 7;
++ u32 rsv : 1;
++ u32 ring_no : 2;
++ u32 dst_sel : 2;
++ u32 sdl :14;
++ u32 ls : 1;
++ u32 rsv2 : 1;
++ u32 pn_31_0;
++ u32 pn_47_32 :16;
++ u32 cs_status : 4;
++ u32 cs_type : 4;
++ u32 c : 1;
++ u32 f : 1;
++ u32 un : 1;
++ u32 rsv3 : 1;
++ u32 is_fc_data : 1;
++ u32 uc : 1;
++ u32 mc : 1;
++ u32 bc : 1;
++ u16 rx_token_id;
++ u16 rsv4;
++ u32 rsv5;
++};
++
+ struct mt7996_rro_ba_session {
+ u32 ack_sn :12;
+ u32 win_sz :3;
+@@ -547,6 +575,26 @@ struct mt7996_rro_ba_session {
+ u32 last_in_rxtime :12;
+ };
+
++struct mt7996_rro_ba_session_elem {
++ struct list_head poll_list;
++ u16 session_id;
++};
++
++struct mt7996_msdu_pg {
++ struct mt7996_rro_hif rxd[MT7996_MAX_HIF_RXD_IN_PG];
++ u32 next_pg_l;
++ u32 next_pg_h : 4;
++ u32 rsv :27;
++ u32 owner : 1;
++};
++
++struct mt7996_msdu_pg_addr {
++ struct list_head list;
++ dma_addr_t dma_addr;
++ struct mt76_queue *q;
++ void *buf;
++};
++
+ struct mt7996_chanctx {
+ struct cfg80211_chan_def chandef;
+ struct mt7996_phy *phy;
+@@ -1257,6 +1305,11 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ void mt7996_tx_token_put(struct mt7996_dev *dev);
+ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+ struct sk_buff *skb, u32 *info);
++void mt7996_rx_token_put(struct mt7996_dev *dev);
++void mt7996_rro_msdu_pg_free(struct mt7996_dev *dev);
++void mt7996_rro_rx_process(struct mt76_dev *mdev, void *data);
++int mt7996_rro_fill_msdu_page(struct mt76_dev *mdev, struct mt76_queue *q,
++ dma_addr_t p, void *data);
+ bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len);
+ void mt7996_stats_work(struct work_struct *work);
+ void mt7996_scan_work(struct work_struct *work);
+diff --git a/mt7996/pci.c b/mt7996/pci.c
+index 382b6a89..a010680f 100644
+--- a/mt7996/pci.c
++++ b/mt7996/pci.c
+@@ -13,6 +13,9 @@
+ static bool hif2_enable = false;
+ module_param(hif2_enable, bool, 0644);
+
++static bool rro_enable = false;
++module_param(rro_enable, bool, 0644);
++
+ static LIST_HEAD(hif_list);
+ static DEFINE_SPINLOCK(hif_lock);
+ static u32 hif_idx;
+@@ -140,6 +143,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
+ if (IS_ERR(dev))
+ return PTR_ERR(dev);
+
++ dev->has_rro = rro_enable;
+ mdev = &dev->mt76;
+ mt7996_wfsys_reset(dev);
+ hif2 = mt7996_pci_init_hif2(pdev);
+diff --git a/mt7996/regs.h b/mt7996/regs.h
+index e1893517..0ea055ba 100644
+--- a/mt7996/regs.h
++++ b/mt7996/regs.h
+@@ -561,6 +561,7 @@ enum offs_rev {
+ #define MT_INT_RRO_RX_DONE (MT_INT_RX(MT_RXQ_RRO_BAND0) | \
+ MT_INT_RX(MT_RXQ_RRO_BAND1) | \
+ MT_INT_RX(MT_RXQ_RRO_BAND2) | \
++ MT_INT_RX(MT_RXQ_RRO_IND) | \
+ MT_INT_RX(MT_RXQ_MSDU_PAGE_BAND0) | \
+ MT_INT_RX(MT_RXQ_MSDU_PAGE_BAND1) | \
+ MT_INT_RX(MT_RXQ_MSDU_PAGE_BAND2))
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0196-mtk-mt76-mt7996-ignore-vif.dormant_links-in-mt7996_c.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0196-mtk-mt76-mt7996-ignore-vif.dormant_links-in-mt7996_c.patch
new file mode 100644
index 0000000..f6d2576
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0196-mtk-mt76-mt7996-ignore-vif.dormant_links-in-mt7996_c.patch
@@ -0,0 +1,36 @@
+From bdbcaf57e4e62a9ff8425677384e3da49497c170 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Mon, 5 Aug 2024 14:56:19 +0800
+Subject: [PATCH 196/199] mtk: mt76: mt7996: ignore vif.dormant_links in
+ mt7996_change_vif_links
+
+The dormant links are disabled for reasons like TTLM, and might become
+active in the near future, so we do not remove their bss_conf here.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt7996/main.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 6826f319..3892fd27 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -3102,11 +3102,12 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- unsigned long rem = old_links & ~new_links;
++ unsigned long rem = old_links & ~new_links & ~vif->dormant_links;
+ unsigned int link_id;
+ int ret = 0;
+
+- mt76_vif_dbg(vif, "old=0x%x, new=0x%x\n", old_links, new_links);
++ mt76_vif_dbg(vif, "old=0x%x, new=0x%x, dormant=0x%x\n",
++ old_links, new_links, vif->dormant_links);
+ if (old_links == new_links)
+ return 0;
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0197-mtk-mt76-mt7996-add-Adv-TTLM-support-for-STA.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0197-mtk-mt76-mt7996-add-Adv-TTLM-support-for-STA.patch
new file mode 100644
index 0000000..04f64a9
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0197-mtk-mt76-mt7996-add-Adv-TTLM-support-for-STA.patch
@@ -0,0 +1,169 @@
+From aea601b0b41e150228aa152da2930778f0e10942 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Mon, 5 Aug 2024 15:03:55 +0800
+Subject: [PATCH 197/199] mtk: mt76: mt7996: add Adv-TTLM support for STA
+
+1. add the handling for valid_link and TTLM changing in vif_cfg_changed
+ callback.
+2. send peer-mld request for default mapping and Adv-TTLM. Neg-TTLM will
+ be supported in further commit.
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ mt76_connac_mcu.h | 1 +
+ mt7996/main.c | 3 +++
+ mt7996/mcu.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++
+ mt7996/mcu.h | 22 ++++++++++++++++
+ mt7996/mt7996.h | 2 ++
+ 5 files changed, 92 insertions(+)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index eb738f4f..97d4c2ad 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1322,6 +1322,7 @@ enum {
+ MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
+ MCU_UNI_CMD_PTA_3WIRE_CTRL = 0x78,
+ MCU_UNI_CMD_MLD = 0x82,
++ MCU_UNI_CMD_PEER_MLD = 0x83,
+ };
+
+ enum {
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 3892fd27..7be2a38a 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -957,6 +957,9 @@ static void mt7996_vif_cfg_changed(struct ieee80211_hw *hw,
+ }
+ }
+
++ if (changed & BSS_CHANGED_MLD_VALID_LINKS)
++ mt7996_mcu_peer_mld_ttlm_req(dev, vif, changed);
++
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 03c671f6..7096b8a0 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -3616,6 +3616,70 @@ int mt7996_mcu_mld_set_attlm(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ return ret;
+ }
+
++int mt7996_mcu_peer_mld_ttlm_req(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ u64 changed)
++{
++ struct mt7996_link_sta *mlink;
++ struct ieee80211_sta *sta;
++ struct mt7996_sta *msta;
++ struct peer_mld_req_hdr hdr = { .mld_idx = 0xff };
++ struct peer_mld_ttlm_req *req;
++ struct sk_buff *skb;
++ struct tlv *tlv;
++ int len = sizeof(hdr) + sizeof(*req);
++ unsigned long valid_links = (unsigned long)vif->valid_links;
++ u8 link_id;
++
++ if (vif->type != NL80211_IFTYPE_STATION)
++ return 0;
++
++ rcu_read_lock();
++ sta = ieee80211_find_sta(vif, vif->cfg.ap_addr);
++ if (!sta) {
++ rcu_read_unlock();
++ return -EINVAL;
++ }
++
++ memcpy(hdr.peer_mld_addr, sta->addr, ETH_ALEN);
++ msta = (struct mt7996_sta *)sta->drv_priv;
++
++ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, len);
++ if (!skb)
++ return -ENOMEM;
++
++ skb_put_data(skb, &hdr, sizeof(hdr));
++ tlv = mt7996_mcu_add_uni_tlv(skb, UNI_CMD_PEER_MLD_TTLM_REQ,
++ sizeof(*req));
++ req = (struct peer_mld_ttlm_req *)tlv;
++
++ memcpy(req->mld_addr, vif->addr, ETH_ALEN);
++ req->enabled_link_bitmap = cpu_to_le16(vif->valid_links);
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ mlink = mlink_dereference_protected(msta, link_id);
++ if (!mlink)
++ continue;
++
++ req->link_to_wcid[link_id] = cpu_to_le16(mlink->wcid.idx);
++
++ if (changed & BSS_CHANGED_MLD_ADV_TTLM) {
++ /* skip TTLM-disabled links */
++ if (vif->adv_ttlm.active &&
++ !(vif->adv_ttlm.map & BIT(link_id)))
++ continue;
++
++ req->dl_tid_map[link_id] = 0xff;
++ req->ul_tid_map[link_id] = 0xff;
++ }
++
++ /* TODO apply negotiated TTLM */
++ }
++
++ rcu_read_unlock();
++
++ return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(PEER_MLD),
++ true);
++}
++
+ static void
+ mt7996_mcu_beacon_cntdwn(struct ieee80211_bss_conf *conf, struct sk_buff *rskb,
+ struct sk_buff *skb,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index a5818f95..dab4700e 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1244,6 +1244,28 @@ enum {
+ UNI_EVENT_MLD_RECONF_AP_REM_TIMER = 0x04,
+ };
+
++struct peer_mld_req_hdr {
++ u8 ver;
++ u8 peer_mld_addr[ETH_ALEN];
++ u8 mld_idx;
++ u8 rsv[4];
++ u8 buf[];
++} __packed;
++
++struct peer_mld_ttlm_req {
++ __le16 tag;
++ __le16 len;
++ u8 mld_addr[ETH_ALEN];
++ __le16 enabled_link_bitmap;
++ __le16 link_to_wcid[IEEE80211_MLD_MAX_NUM_LINKS + 1];
++ u8 dl_tid_map[IEEE80211_MLD_MAX_NUM_LINKS + 1];
++ u8 ul_tid_map[IEEE80211_MLD_MAX_NUM_LINKS + 1];
++} __packed;
++
++enum {
++ UNI_CMD_PEER_MLD_TTLM_REQ = 0x0,
++};
++
+ struct tx_power_ctrl {
+ u8 _rsv[4];
+
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 3aedaf5a..7866c706 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1211,6 +1211,8 @@ int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy);
+ void mt7996_mcu_wmm_pbc_work(struct work_struct *work);
+ int mt7996_mcu_mld_set_attlm(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+ u16 disabled_links, u16 switch_time, u32 duration);
++int mt7996_mcu_peer_mld_ttlm_req(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ u64 changed);
+
+ static inline u8 mt7996_max_interface_num(struct mt7996_dev *dev)
+ {
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0198-mtk-mt76-mt7996-Add-AFC-and-lpi-power-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0198-mtk-mt76-mt7996-Add-AFC-and-lpi-power-support.patch
new file mode 100644
index 0000000..347774e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0198-mtk-mt76-mt7996-Add-AFC-and-lpi-power-support.patch
@@ -0,0 +1,722 @@
+From bdbfbe8865914946cbce6c901224785cf5cd7d3c Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Thu, 1 Aug 2024 11:25:03 +0800
+Subject: [PATCH 198/199] mtk: mt76: mt7996: Add AFC and lpi power support
+
+This patch receiving and storing the power table from hostapd vendor cmd.
+The power table would be use to compare the sku table in standard power
+mode every time when setting power and mt76 would set the minimum values
+between afc and sku table to fw.
+The AFC table format is like below:
+col\row bw20 bw40 ... ru26 ... ru3472
+chan 1
+chan 6
+...
+chan 233
+To compare the afc and sku table, mt76 will find the power list of current
+channel in AFC table. And mtk sku table design serveral rates for each
+bandwidth, so a power value of afc table could compare with serveral
+rates in mtk sku table.
+
+ - Add a new vendor attibute lpi mode, due to the lpi is tuntime decided by AFC
+not like wifi6 switch lpi and standard power should reload interface.
+
+Add dump afc table and information.
+Add the bf on value offset logic. The offset is antenna/beamform gain
+offset = 10 * (log(num of ant) - log(num of NSS)).
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+---
+ mt76.h | 2 +
+ mt7996/mac.c | 2 +-
+ mt7996/main.c | 2 +-
+ mt7996/mcu.c | 186 ++++++++++++++++++++++++++++++++++++++++---
+ mt7996/mcu.h | 139 ++++++++++++++++++++++++++++++++
+ mt7996/mt7996.h | 2 +
+ mt7996/mtk_debugfs.c | 37 +++++++++
+ mt7996/vendor.c | 81 +++++++++++++++----
+ mt7996/vendor.h | 3 +
+ 9 files changed, 429 insertions(+), 25 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index 58e9b0b7..4b473123 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -1063,6 +1063,8 @@ struct mt76_dev {
+ bool lpi_psd;
+ bool lpi_bcn_enhance;
+ bool mgmt_pwr_enhance;
++ bool lpi_mode;
++ s8 **afc_power_table;
+
+ #ifdef CONFIG_NL80211_TESTMODE
+ const struct mt76_testmode_ops *test_ops;
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index c0f282d1..60223bea 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -896,7 +896,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
+ if (mcast)
+ val |= MT_TXD6_DIS_MAT;
+ if (dev->mt76.phys[band_idx]->cap.has_6ghz &&
+- dev->mt76.lpi_bcn_enhance &&
++ dev->mt76.lpi_mode && dev->mt76.lpi_bcn_enhance &&
+ ieee80211_is_mgmt(hdr->frame_control))
+ val |= FIELD_PREP(MT_TXD6_BW, FW_CDBW_80MHZ);
+ txwi[6] |= cpu_to_le32(val);
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 7be2a38a..58e02083 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -891,7 +891,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+
+ if (dev->cert_mode && phy->mt76->band_idx == MT_BAND2)
+ rate = 0x0200;
+- else if (mphy->dev->lpi_bcn_enhance)
++ else if (mphy->dev->lpi_mode && mphy->dev->lpi_bcn_enhance)
+ rate = FR_RATE_IDX_OFDM_6M;
+
+ /* odd index for driver, even index for firmware */
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 7096b8a0..48bdbf73 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -6374,7 +6374,8 @@ int mt7996_mcu_set_fixed_rate_table(struct mt7996_phy *phy, u8 table_idx,
+
+ if (beacon) {
+ req.spe_idx_sel = SPE_IXD_SELECT_TXD;
+- req.spe_idx = dev->mt76.mgmt_pwr_enhance ? 0 : 24 + band_idx;
++ req.spe_idx = dev->mt76.lpi_mode && dev->mt76.mgmt_pwr_enhance ?
++ 0 : 24 + band_idx;
+ phy->beacon_rate = rate_idx;
+ } else {
+ req.spe_idx_sel = SPE_IXD_SELECT_BMC_WTBL;
+@@ -6657,6 +6658,126 @@ mt7996_update_max_txpower_cur(struct mt7996_phy *phy, int tx_power)
+ mphy->txpower_cur = e2p_power_limit;
+ }
+
++static int mt7996_afc_update_power_limit(struct mt7996_dev *dev,
++ struct ieee80211_channel *chan,
++ struct mt76_power_limits *la,
++ struct mt76_power_path_limits *la_path,
++ int *tx_power,
++ struct cfg80211_chan_def *chandef)
++{
++ s8 *power_list, bw320_offset, target_power;
++ int table_idx, i, bw, mcs, ru, eht, path;
++ s8 bf_offset_ofdm[] = {6, 10, 12, 14};
++ s8 bf_offset[] = {0, 6, 10, 12, 14, 0, 4, 6, 8, 0, 3, 5, 0, 2, 0};
++
++ table_idx = chan->hw_value / 4;
++ if (table_idx < 0 || table_idx > MAX_CHANNEL_NUM_6G ||
++ !dev->mt76.afc_power_table[table_idx])
++ return -EINVAL;
++
++ power_list = dev->mt76.afc_power_table[table_idx];
++
++ switch (chan->center_freq) {
++ case 31:
++ case 95:
++ case 159:
++ bw320_offset = 1;
++ break;
++ case 63:
++ case 127:
++ case 191:
++ bw320_offset = 2;
++ break;
++ default:
++ bw320_offset = 0;
++ break;
++ }
++
++ if (chandef) {
++ switch (chandef->width) {
++ case NL80211_CHAN_WIDTH_20:
++ target_power = power_list[afc_power_bw20];
++ break;
++ case NL80211_CHAN_WIDTH_40:
++ target_power = power_list[afc_power_bw40];
++ break;
++ case NL80211_CHAN_WIDTH_80:
++ target_power = power_list[afc_power_bw80];
++ break;
++ case NL80211_CHAN_WIDTH_160:
++ target_power = power_list[afc_power_bw160];
++ break;
++ case NL80211_CHAN_WIDTH_320:
++ if (bw320_offset == 1)
++ target_power = power_list[afc_power_bw320_1];
++ else
++ target_power = power_list[afc_power_bw320_2];
++ break;
++ default:
++ break;
++ }
++ *tx_power = min_t(int, *tx_power, target_power);
++ }
++
++ target_power = min_t(s8, (s8)*tx_power, power_list[afc_power_bw20]);
++ for (i = 0; i < sizeof(la->cck); i++)
++ la->cck[i] = min_t(s8, la->cck[i], power_list[afc_power_bw20]);
++ for (i = 0; i < sizeof(la->ofdm); i++)
++ la->ofdm[i] = min_t(s8, la->ofdm[i], target_power);
++
++ for (i = 0; i < sizeof(la_path->cck); i++)
++ la_path->cck[i] = min_t(s8, la_path->cck[i], power_list[afc_power_bw20]);
++ for (i = 0; i < sizeof(la_path->ofdm); i++)
++ la_path->ofdm[i] = min_t(s8, la_path->ofdm[i], target_power);
++ for (i = 0; i < sizeof(la_path->ofdm_bf); i++) {
++ la_path->ofdm_bf[i] =
++ min_t(s8, la_path->ofdm_bf[i],
++ target_power - bf_offset_ofdm[i]);
++ }
++
++ for (bw = afc_power_bw20; bw < afc_power_table_num; bw++) {
++ if ((bw == afc_power_bw320_1 && bw320_offset == 2) ||
++ (bw == afc_power_bw320_2 && bw320_offset == 1))
++ continue;
++
++ if (power_list[bw] == AFC_INVALID_POWER)
++ continue;
++
++ /* Negative index means doesn't need to update powers of the type. */
++ if (mt7996_get_bw_power_table_idx(bw, &mcs, &ru, &eht, &path))
++ return -EINVAL;
++
++ if (mcs >= 0) {
++ for (i = 0; i < sizeof(la->mcs[0]); i++)
++ la->mcs[mcs][i] =
++ min_t(s8, la->mcs[mcs][i], power_list[bw]);
++ }
++
++ if (ru >= 0) {
++ for (i = 0; i < sizeof(la->ru[0]); i++)
++ la->ru[ru][i] = min_t(s8, la->ru[ru][i], power_list[bw]);
++ }
++
++ if (eht >= 0) {
++ for (i = 0; i < sizeof(la->eht[0]); i++)
++ la->eht[eht][i] =
++ min_t(s8, la->eht[eht][i], power_list[bw]);
++ }
++
++ if (path >= 0) {
++ for (i = 0; i < sizeof(la_path->ru[0]); i++) {
++ la_path->ru[path][i] =
++ min_t(s8, la_path->ru[path][i], power_list[bw]);
++ la_path->ru_bf[path][i] =
++ min_t(s8, la_path->ru_bf[path][i],
++ power_list[bw] - bf_offset[i]);
++ }
++ }
++ }
++
++ return 0;
++}
++
+ bool mt7996_is_psd_country(char *country)
+ {
+ char psd_country_list[][3] = {"US", "KR", "BR", "CL", "MY", ""};
+@@ -6704,15 +6825,22 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ txpower_setting = 127;
+ txpower_limit = mt7996_get_power_bound(phy, txpower_setting);
+
+- if (phy->sku_limit_en) {
+- txpower_limit = mt76_get_rate_power_limits(mphy, mphy->chandef.chan,
+- &la, &la_path, txpower_limit);
+- mt7996_update_max_txpower_cur(phy, txpower_limit);
+- } else {
++ if (!phy->sku_limit_en) {
+ mt7996_update_max_txpower_cur(phy, txpower_limit);
+ return 0;
+ }
+
++ txpower_limit = mt76_get_rate_power_limits(mphy, mphy->chandef.chan,
++ &la, &la_path, txpower_limit);
++ if(phy->mt76->cap.has_6ghz && dev->mt76.afc_power_table) {
++ ret = mt7996_afc_update_power_limit(dev, mphy->main_chan, &la, &la_path,
++ &txpower_limit, &mphy->chandef);
++ if (ret)
++ return ret;
++ }
++
++ mt7996_update_max_txpower_cur(phy, txpower_limit);
++
+ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL,
+ sizeof(req) + MT7996_SKU_PATH_NUM);
+ if (!skb)
+@@ -6725,7 +6853,7 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ /* FW would compensate for PSD countries
+ * driver doesn't need to do it
+ */
+- if (phy->mt76->cap.has_6ghz && mphy->dev->lpi_psd &&
++ if (phy->mt76->cap.has_6ghz && mphy->dev->lpi_mode && mphy->dev->lpi_psd &&
+ !mt7996_is_psd_country(dev->mt76.alpha2)) {
+ switch (mphy->chandef.width) {
+ case NL80211_CHAN_WIDTH_20:
+@@ -6791,7 +6919,7 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ /* FW would NOT compensate in the case of BF backoff table
+ * driver needs to compensate for LPI PSD
+ */
+- if (phy->mt76->cap.has_6ghz && mphy->dev->lpi_psd) {
++ if (phy->mt76->cap.has_6ghz && mphy->dev->lpi_mode && mphy->dev->lpi_psd) {
+ switch (mphy->chandef.width) {
+ case NL80211_CHAN_WIDTH_20:
+ skb_put_data(skb, &la_path.ru[5], sizeof(la_path.ofdm));
+@@ -6853,13 +6981,53 @@ int mt7996_mcu_set_lpi_psd(struct mt7996_phy *phy, u8 enable)
+ .tag = cpu_to_le16(UNI_BAND_CONFIG_LPI_CTRL),
+ .len = cpu_to_le16(sizeof(req) - 4),
+ .lpi_enable = enable,
+- .psd_limit = enable ? mt7996_is_psd_country(dev->mt76.alpha2) : 0,
++ .psd_limit = enable && dev->mt76.lpi_mode ?
++ mt7996_is_psd_country(dev->mt76.alpha2) : 0,
+ };
+
+ return mt76_mcu_send_msg(&phy->dev->mt76, MCU_WM_UNI_CMD(BAND_CONFIG),
+ &req, sizeof(req), false);
+ }
+
++int mt7996_alloc_afc_table(struct mt7996_dev *dev)
++{
++ struct mt76_dev *mdev = &dev->mt76;
++ int i;
++
++ mdev->afc_power_table =
++ (s8**)devm_kzalloc(dev->mt76.dev,
++ MAX_CHANNEL_NUM_6G * sizeof(s8*),
++ GFP_KERNEL);
++
++ if (!mdev->afc_power_table)
++ return -ENOMEM;
++
++ for (i = 0; i < MAX_CHANNEL_NUM_6G; i++) {
++ mdev->afc_power_table[i] =
++ (s8*)devm_kzalloc(dev->mt76.dev,
++ afc_power_table_num * sizeof(s8),
++ GFP_KERNEL);
++ if (!mdev->afc_power_table[i]) {
++ mt7996_free_afc_table(dev);
++ return -ENOMEM;
++ }
++ }
++ return 0;
++}
++
++void mt7996_free_afc_table(struct mt7996_dev *dev)
++{
++ struct mt76_dev *mdev = &dev->mt76;
++ int i;
++
++ if (mdev->afc_power_table) {
++ for (i = 0; i < MAX_CHANNEL_NUM_6G; i++)
++ devm_kfree(mdev->dev, mdev->afc_power_table[i]);
++ devm_kfree(mdev->dev, mdev->afc_power_table);
++ }
++ mdev->afc_power_table = NULL;
++}
++
+ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode)
+ {
+ __le32 cp_mode;
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index dab4700e..33ba3774 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1295,6 +1295,145 @@ enum {
+ UNI_TXPOWER_SHOW_INFO = 7,
+ };
+
++#define MAX_CHANNEL_NUM_6G 59
++#define AFC_INVALID_POWER 127
++enum afc_table_info {
++ afc_power_bw20,
++ afc_power_bw40,
++ afc_power_bw80,
++ afc_power_bw160,
++ afc_power_bw320_1,
++ afc_power_bw320_2,
++ afc_power_ru26,
++ afc_power_ru52,
++ afc_power_ru78,
++ afc_power_ru106,
++ afc_power_ru132,
++ afc_power_ru726,
++ afc_power_ru1480,
++ afc_power_ru1772,
++ afc_power_ru2476,
++ afc_power_ru2988,
++ afc_power_ru3472,
++ afc_power_table_num,
++};
++
++static inline int mt7996_get_bw_power_table_idx(int bw, int *mcs, int *ru, int *eht,
++ int *path)
++{
++ switch (bw) {
++ case afc_power_bw20:
++ *mcs = 0;
++ *ru = 3;
++ *eht = 3;
++ *path = 5;
++ break;
++ case afc_power_bw40:
++ *mcs = 1;
++ *ru = 4;
++ *eht = 4;
++ *path = 6;
++ break;
++ case afc_power_bw80:
++ *mcs = 2;
++ *ru = 5;
++ *eht = 5;
++ *path = 8;
++ break;
++ case afc_power_bw160:
++ *mcs = 3;
++ *ru = 6;
++ *eht = 6;
++ *path = 11;
++ break;
++ case afc_power_bw320_1:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 7;
++ *path = 15;
++ break;
++ case afc_power_bw320_2:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 7;
++ *path = 15;
++ break;
++ case afc_power_ru26:
++ *mcs = -1;
++ *ru = 0;
++ *eht = 0;
++ *path = 0;
++ break;
++ case afc_power_ru52:
++ *mcs = -1;
++ *ru = 1;
++ *eht = 1;
++ *path = 1;
++ break;
++ case afc_power_ru78:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 8;
++ *path = 2;
++ break;
++ case afc_power_ru106:
++ *mcs = -1;
++ *ru = 2;
++ *eht = 2;
++ *path = 3;
++ break;
++ case afc_power_ru132:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 9;
++ *path = 4;
++ break;
++ case afc_power_ru726:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 10;
++ *path = 7;
++ break;
++ case afc_power_ru1480:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 11;
++ *path = 9;
++ break;
++ case afc_power_ru1772:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 12;
++ *path = 10;
++ break;
++ case afc_power_ru2476:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 13;
++ *path = 12;
++ break;
++ case afc_power_ru2988:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 14;
++ *path = 13;
++ break;
++ case afc_power_ru3472:
++ *mcs = -1;
++ *ru = -1;
++ *eht = 15;
++ *path = 14;
++ break;
++ default:
++ *mcs = -1;
++ *ru = -1;
++ *eht = -1;
++ *path = -1;
++ return -EINVAL;
++ }
++ return 0;
++}
++
+ enum {
+ UNI_CMD_ACCESS_REG_BASIC = 0x0,
+ UNI_CMD_ACCESS_RF_REG_BASIC,
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 7866c706..e8571e9f 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1170,6 +1170,8 @@ int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state);
+ int mt7996_mcu_set_thermal_protect(struct mt7996_phy *phy, bool enable);
+ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy,
+ int txpower_setting);
++int mt7996_alloc_afc_table(struct mt7996_dev *dev);
++void mt7996_free_afc_table(struct mt7996_dev *dev);
+ int mt7996_mcu_rdd_cmd(struct mt7996_dev *dev, int cmd, u8 index,
+ u8 rx_sel, u8 val);
+ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev,
+diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
+index a4703b07..63e63a33 100644
+--- a/mt7996/mtk_debugfs.c
++++ b/mt7996/mtk_debugfs.c
+@@ -2523,6 +2523,11 @@ mt7996_get_txpower_info(struct file *file, char __user *user_buf,
+ len += scnprintf(buf + len, size - len,
+ " RegDB: %s\n",
+ !np ? "enable" : "disable");
++ len += scnprintf(buf + len, size - len,
++ " sku_index: %d\n", phy->mt76->sku_idx);
++ len += scnprintf(buf + len, size - len,
++ " lpi: %s\n",
++ phy->mt76->dev->lpi_mode ? "enable" : "disable");
+ ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+
+ out:
+@@ -4390,6 +4395,37 @@ static int mt7996_pp_alg_show(struct seq_file *s, void *data)
+ }
+ DEFINE_SHOW_ATTRIBUTE(mt7996_pp_alg);
+
++static int mt7996_afc_table_show(struct seq_file *s, void *data)
++{
++ struct mt7996_dev *dev = s->private;
++
++ char str[200] = {0}, *pos;
++ char *end = str + sizeof(str);
++ int i, j;
++
++ if (!dev->mt76.afc_power_table || !dev->mt76.afc_power_table[0]) {
++ seq_printf(s, "afc table doesn't exist.\n");
++ return 0;
++ }
++
++ seq_printf(s, "bw/ru : 20 40 80 160 320-1 320-2 26 52 78 "
++ "106 132 726 1480 1772 2476 2988 3472\n");
++ for(i = 0; i < MAX_CHANNEL_NUM_6G; i ++) {
++ pos = str;
++ for (j = 0; j < afc_power_table_num; j ++) {
++ pos += snprintf(pos, end - pos, "%5d ",
++ dev->mt76.afc_power_table[i][j]);
++ }
++ seq_printf(s, "ch %3d: %s\n", i * 4 + 1, str);
++ memset(str, 0, sizeof(str));
++ }
++ seq_printf(s, "Unit : 0.5 dBm\n");
++ seq_printf(s, "NOTE : power of the table is translated to single path.\n");
++
++ return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_afc_table);
++
+ void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ /* agg */
+@@ -4516,6 +4552,7 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
+
+ debugfs_create_file("muru_dbg", 0200, dir, dev, &fops_muru_dbg_info);
+ debugfs_create_bool("mgmt_pwr_enhance", 0600, dir, &dev->mt76.mgmt_pwr_enhance);
++ debugfs_create_file("afc_table", 0200, dir, dev, &mt7996_afc_table_fops);
+ }
+
+ #endif
+diff --git a/mt7996/vendor.c b/mt7996/vendor.c
+index e13a148a..867c277d 100644
+--- a/mt7996/vendor.c
++++ b/mt7996/vendor.c
+@@ -162,6 +162,8 @@ txpower_ctrl_policy[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL] = {
+ [MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_BCN_ENHANCE] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_TXPOWER_CTRL_LINK_ID] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_TABLE] = { .type = NLA_BINARY },
++ [MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_LPI] = { .type = NLA_U8 },
+ };
+
+ struct mt7996_amnt_data {
+@@ -1454,6 +1456,34 @@ out:
+ return err;
+ }
+
++static int mt7996_parse_afc_table(struct mt7996_dev *dev, struct nlattr *tb, int delta)
++{
++ int ch, bw, err = 0;
++ struct mt76_dev *mdev = &dev->mt76;
++ s8 **table;
++
++ if (!mdev->afc_power_table)
++ err = mt7996_alloc_afc_table(dev);
++
++ if (err) {
++ mt7996_free_afc_table(dev);
++ return err;
++ }
++
++ table = nla_data(tb);
++
++ for (ch = 0; ch < MAX_CHANNEL_NUM_6G; ch++) {
++ memcpy(mdev->afc_power_table[ch], table[ch],
++ afc_power_table_num * sizeof(s8));
++ for (bw = 0; bw < afc_power_table_num; bw++)
++ if (mdev->afc_power_table[ch][bw] != AFC_INVALID_POWER)
++ mdev->afc_power_table[ch][bw] -= delta;
++ }
++
++ return 0;
++}
++
++
+ static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data,
+@@ -1463,12 +1493,13 @@ static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
+ struct mt7996_dev *dev;
+ struct mt7996_phy *phy;
+ struct mt76_phy *mphy;
++ struct mt76_dev *mdev;
+ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
+- struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL];
+- struct mt76_power_limits la = {};
+- struct mt76_power_path_limits la_path = {};
++ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL], *table;
++ struct mt76_power_limits *la;
++ struct mt76_power_path_limits *la_path;
+ int err, current_txpower, delta;
+ u8 val, link_id = 0, idx;
+
+@@ -1496,6 +1527,14 @@ static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
+ rcu_read_unlock();
+
+ mphy = phy->mt76;
++ mdev = mphy->dev;
++ delta = mt76_tx_power_nss_delta(hweight16(mphy->chainmask));
++
++ if (mphy->cap.has_6ghz &&
++ tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_LPI]) {
++ val = nla_get_u8(tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_LPI]);
++ mphy->dev->lpi_mode = !!val;
++ }
+
+ if (mphy->cap.has_6ghz &&
+ tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_PSD]) {
+@@ -1504,7 +1543,7 @@ static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
+
+ err = mt7996_mcu_set_lpi_psd(phy, val);
+ if (err)
+- return err;
++ goto out;
+ }
+
+ if (tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX]) {
+@@ -1515,19 +1554,22 @@ static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
+
+ phy->sku_limit_en = true;
+ phy->sku_path_en = true;
+- mt76_get_rate_power_limits(mphy, mphy->chandef.chan, &la, &la_path, 127);
+- if (!la_path.ofdm[0])
++ la = kzalloc(sizeof(struct mt76_power_limits), GFP_KERNEL);
++ la_path = kzalloc(sizeof(struct mt76_power_path_limits), GFP_KERNEL);
++
++ mt76_get_rate_power_limits(mphy, mphy->chandef.chan, la, la_path, 127);
++ if (!la_path->ofdm[0])
+ phy->sku_path_en = false;
+
+ dev = phy->dev;
+ err = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_SKU_POWER_LIMIT_CTRL,
+ dev->dbg.sku_disable ? 0 : phy->sku_limit_en);
+ if (err)
+- return err;
++ goto out;
+ err = mt7996_mcu_set_tx_power_ctrl(phy, UNI_TXPOWER_BACKOFF_POWER_LIMIT_CTRL,
+ dev->dbg.sku_disable ? 0 : phy->sku_path_en);
+ if (err)
+- return err;
++ goto out;
+ }
+
+ if (mphy->cap.has_6ghz &&
+@@ -1536,19 +1578,30 @@ static int mt7996_vendor_txpower_ctrl(struct wiphy *wiphy,
+ mphy->dev->lpi_bcn_enhance = val;
+ idx = MT7996_BEACON_RATES_TBL + 2 * phy->mt76->band_idx;
+
+- err = mt7996_mcu_set_fixed_rate_table(phy, idx, FR_RATE_IDX_OFDM_6M, true);
++ err = mt7996_mcu_set_fixed_rate_table(phy, idx, FR_RATE_IDX_OFDM_6M,
++ true);
+ if (err)
+- return err;
++ goto out;
++ }
++
++ if (mphy->cap.has_6ghz) {
++ table = tb[MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_TABLE];
++ if (table) {
++ err = mt7996_parse_afc_table(dev, table, delta);
++ if (err)
++ goto out;
++ } else
++ mt7996_free_afc_table(dev);
+ }
+
+- delta = mt76_tx_power_nss_delta(hweight16(mphy->chainmask));
+ current_txpower = DIV_ROUND_UP(mphy->txpower_cur + delta, 2);
+
+ err = mt7996_mcu_set_txpower_sku(phy, current_txpower);
+- if (err)
+- return err;
+
+- return 0;
++out:
++ kfree(la);
++ kfree(la_path);
++ return err;
+ }
+
+ static const struct wiphy_vendor_command mt7996_vendor_commands[] = {
+diff --git a/mt7996/vendor.h b/mt7996/vendor.h
+index 71800590..cd84a492 100644
+--- a/mt7996/vendor.h
++++ b/mt7996/vendor.h
+@@ -338,12 +338,15 @@ enum mtk_vendor_attr_txpower_ctrl {
+ MTK_VENDOR_ATTR_TXPOWER_CTRL_SKU_IDX,
+ MTK_VENDOR_ATTR_TXPOWER_CTRL_LPI_BCN_ENHANCE,
+ MTK_VENDOR_ATTR_TXPOWER_CTRL_LINK_ID,
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_TABLE,
++ MTK_VENDOR_ATTR_TXPOWER_CTRL_AFC_LPI,
+
+ /* keep last */
+ NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL,
+ MTK_VENDOR_ATTR_TXPOWER_CTRL_MAX =
+ NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL - 1
+ };
++
+ #endif
+
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0199-mtk-mt76-do-not-report-ACK-when-TXS-is-lost.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0199-mtk-mt76-do-not-report-ACK-when-TXS-is-lost.patch
new file mode 100644
index 0000000..d99c18f
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0199-mtk-mt76-do-not-report-ACK-when-TXS-is-lost.patch
@@ -0,0 +1,27 @@
+From 3526fd4180ee45d66f634aa3bef3d86e7ab5bc82 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Tue, 13 Aug 2024 18:55:00 +0800
+Subject: [PATCH 199/199] mtk: mt76: do not report ACK when TXS is lost
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ tx.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tx.c b/tx.c
+index c965f0e3..7712a32e 100644
+--- a/tx.c
++++ b/tx.c
+@@ -100,7 +100,8 @@ __mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, u8 flags,
+ return;
+
+ /* Tx status can be unreliable. if it fails, mark the frame as ACKed */
+- if (flags & MT_TX_CB_TXS_FAILED) {
++ if ((flags & MT_TX_CB_TXS_FAILED) &&
++ (dev->drv->drv_flags & MT_DRV_SW_RX_AIRTIME)) {
+ info->status.rates[0].count = 0;
+ info->status.rates[0].idx = -1;
+ info->flags |= IEEE80211_TX_STAT_ACK;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/patches.inc b/recipes-wifi/linux-mt76/files/patches-3.x/patches.inc
index e9b246c..4654ec4 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/patches.inc
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/patches.inc
@@ -1,119 +1,202 @@
#patch patches (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
file://0001-mtk-Revert-wifi-mt76-mt7996-fill-txd-by-host-driver.patch \
- file://0002-bp-sync-upstream-changes.patch \
- file://0003-wifi-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch \
- file://0004-mtk-wifi-mt76-mt7996-fix-MBSS.patch \
- file://0005-wifi-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch \
- file://0006-mtk-wifi-mt76-mt7996-adjust-Beamformee-SS-capability.patch \
- file://0007-wifi-mt76-mt7992-adjust-beamform-mcu-cmd-configurati.patch \
- file://0008-mtk-wifi-mt76-mt7996-add-preamble-puncture-support-f.patch \
- file://0009-mtk-wifi-mt76-mt7996-add-driver-support-for-wpa3-ocv.patch \
- file://0010-mtk-wifi-mt76-mt7996-enable-ser-query.patch \
- file://0011-mtk-wifi-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG.patch \
- file://0012-mtk-wifi-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch \
- file://0013-mtk-wifi-mt76-mt7996-add-support-for-different-varia.patch \
- file://0014-mtk-wifi-mt76-mt7996-ACS-channel-time-too-long-on-du.patch \
- file://0015-mtk-wifi-mt76-mt7996-Fixed-null-pointer-dereference-.patch \
- file://0016-mtk-wifi-mt76-add-sanity-check-to-prevent-kernel-cra.patch \
- file://0017-mtk-wifi-mt76-mt7996-add-firmware-WA-s-coredump.patch \
- file://0018-mtk-wifi-mt76-mt7996-for-build-pass.patch \
- file://0019-mtk-wifi-mt76-mt7996-add-debug-tool.patch \
- file://0020-mtk-wifi-mt76-mt7996-add-check-for-hostapd-config-he.patch \
- file://0021-mtk-wifi-mt76-testmode-add-basic-testmode-support.patch \
- file://0022-mtk-wifi-mt76-testmode-add-testmode-pre-calibration-.patch \
- file://0023-mtk-wifi-mt76-mt7996-add-normal-mode-pre-calibration.patch \
- file://0024-mtk-wifi-mt76-mt7996-enable-SCS-feature-for-mt7996-d.patch \
- file://0025-mtk-wifi-mt76-mt7996-add-txpower-support.patch \
- file://0026-mtk-wifi-mt76-mt7996-add-binfile-mode-support.patch \
- file://0027-mtk-wifi-mt76-testmode-add-testmode-ZWDFS-verificati.patch \
- file://0028-mtk-wifi-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch \
- file://0029-mtk-wifi-mt76-mt7996-refactor-eeprom-loading-flow-fo.patch \
- file://0030-mtk-wifi-mt76-mt7996-add-vendor-commands-support.patch \
- file://0031-mtk-wifi-mt76-mt7996-add-debugfs-for-fw-coredump.patch \
- file://0032-mtk-wifi-mt76-mt7996-Add-mt7992-coredump-support.patch \
- file://0033-mtk-wifi-mt76-mt7996-add-support-for-runtime-set-in-.patch \
- file://0034-mtk-wifi-mt76-mt7996-add-support-spatial-reuse-debug.patch \
- file://0035-mtk-wifi-mt76-mt7996-Establish-BA-in-VO-queue.patch \
- file://0036-mtk-wifi-mt76-mt7996-report-tx-and-rx-byte-to-tpt_le.patch \
- file://0037-mtk-wifi-mt76-mt7996-support-dup-wtbl.patch \
- file://0038-mtk-wifi-mt76-try-more-times-when-send-message-timeo.patch \
- file://0039-mtk-wifi-mt76-mt7996-add-SER-overlap-handle.patch \
- file://0040-mtk-wifi-mt76-mt7996-kite-default-1-pcie-setting.patch \
- file://0041-mtk-wifi-mt76-mt7996-add-debugfs-knob-for-rx_counter.patch \
- file://0042-mtk-wifi-mt76-mt7996-support-BF-MIMO-debug-commands.patch \
- file://0043-mtk-wifi-mt76-mt7996-add-build-the-following-MURU-mc.patch \
- file://0044-mtk-wifi-mt76-mt7996-add-cert-patch.patch \
- file://0045-mtk-wifi-mt76-testmode-add-testmode-bf-support.patch \
- file://0046-mtk-wifi-mt76-mt7996-add-zwdfs-cert-mode.patch \
- file://0047-mtk-wifi-mt76-testmode-add-channel-68-96.patch \
- file://0048-mtk-wifi-mt76-testmode-add-kite-testmode-support.patch \
- file://0049-mtk-wifi-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for.patch \
- file://0050-mtk-wifi-mt76-mt7996-add-no_beacon-vendor-command-fo.patch \
- file://0051-mtk-wifi-mt76-mt7996-add-adie-efuse-merge-support.patch \
- file://0052-mtk-wifi-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch \
- file://0053-mtk-wifi-mt76-mt7996-add-background-radar-hw-cap-che.patch \
- file://0054-mtk-wifi-mt76-mt7996-add-fallback-in-case-of-missing.patch \
- file://0055-mtk-wifi-mt76-mt7996-add-kite-part-number-support.patch \
- file://0056-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch \
- file://0057-mtk-wifi-mt76-rework-wed-rx-flow.patch \
- file://0058-mtk-wifi-mt76-wed-change-wed-token-init-size-to-adap.patch \
- file://0059-mtk-wifi-mt76-add-random-early-drop-support.patch \
- file://0060-mtk-wifi-mt76-mt7996-reset-addr_elem-when-delete-ba.patch \
- file://0061-mtk-wifi-mt76-wed-change-pcie0-R5-to-pcie1-to-get-6G.patch \
- file://0062-mtk-wifi-mt76-add-SER-support-for-wed3.0.patch \
- file://0063-mtk-wifi-mt76-mt7915-wed-find-rx-token-by-physical-a.patch \
- file://0064-mtk-wifi-mt76-mt7996-add-dma-mask-limitation.patch \
- file://0065-mtk-wifi-mt76-mt7996-add-per-bss-statistic-info.patch \
- file://0066-mtk-wifi-mt76-mt7996-do-not-report-netdev-stats-on-m.patch \
- file://0067-mtk-wifi-mt76-mt7996-add-support-for-HW-ATF.patch \
- file://0068-mtk-wifi-mt76-mt7996-wed-add-SER0.5-support-w-wed3.0.patch \
- file://0069-mtk-wifi-mt76-mt7996-support-backaward-compatiable.patch \
- file://0070-mtk-wifi-mt76-mt7996-wed-add-wed-support-for-mt7992.patch \
- file://0071-mtk-wifi-mt76-mt7992-wed-add-2pcie-one-wed-support.patch \
- file://0072-mtk-wifi-mt76-mt7996-Remove-wed-rro-ring-add-napi-at.patch \
- file://0073-mtk-wifi-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch \
- file://0074-mtk-wifi-mt76-mt7996-Refactor-rro-del-ba-command-for.patch \
- file://0075-mtk-wifi-mt76-mt7996-get-airtime-and-RSSI-via-MCU-co.patch \
- file://0076-mtk-wifi-mt76-mt7996-add-support-for-WMM-PBC-configu.patch \
- file://0077-mtk-wifi-mt76-mt7996-eagle-support-extra-option_type.patch \
- file://0078-mtk-wifi-mt76-mt7996-support-enable-disable-thermal-.patch \
- file://0079-mtk-wifi-mt76-mt7996-support-thermal-recal-debug-com.patch \
- file://0080-mtk-wifi-mt76-mt7996-add-kite-two-pcie-with-two-wed-.patch \
- file://0081-mtk-wifi-mt76-mt7992-add-support-to-enable-index-FW-.patch \
- file://0082-wifi-mt76-mt7996-implement-and-switch-to-hw-scan-cal.patch \
- file://0083-wifi-mt76-mt7996-implement-and-switch-to-chanctx-cal.patch \
- file://0084-wifi-mt76-mt7996-use-.sta_state-to-replace-.sta_add-.patch \
- file://0085-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch \
- file://0086-wifi-mt76-mt7996-switch-to-per-link-data-structure-o.patch \
- file://0087-wifi-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch \
- file://0088-wifi-mt76-mt7996-enable-MLO-capability.patch \
- file://0089-wifi-mt76-mt7996-support-multi-link-vif-links-and-ML.patch \
- file://0090-wifi-mt76-mt7996-support-multi-link-sta-links-and-ML.patch \
- file://0091-wifi-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ba.patch \
- file://0092-wifi-mt76-mt7996-rework-ieee80211_ops-callbacks-for-.patch \
- file://0093-wifi-mt76-mt7996-rework-TXD-for-multi-link-support.patch \
- file://0094-wifi-mt76-mt7996-rework-TXS-for-multi-link-support.patch \
- file://0095-wifi-mt76-mt7996-rework-RXD-for-multi-link-support.patch \
- file://0096-wifi-mt76-mt7996-rework-mac-functions-for-multi-link.patch \
- file://0097-wifi-mt76-connac-rework-mcu-functions-for-multi-link.patch \
- file://0098-wifi-mt76-connac-rework-connac-helpers.patch \
- file://0099-wifi-mt76-mt7996-handle-mapping-for-hw-and-phy.patch \
- file://0100-wifi-mt76-mt7996-handle-mapping-for-hw-and-vif.patch \
- file://0101-wifi-mt76-mt7996-rework-scanning-parts-for-MLD-STA-s.patch \
- file://0102-wifi-mt76-mt7996-implement-mld-address-translation.patch \
- file://0103-wifi-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower.patch \
- file://0104-wifi-mt76-mt7996-temp-support-for-single-wiphy.patch \
- file://0105-wifi-mt76-mt7996-implement-ieee80211_ops-for-link-de.patch \
- file://0106-mtk-wifi-mt76-mt7996-support-multi-link-channel-swit.patch \
- file://0107-mtk-mt76-mt7996-hw_scan-ACS-channel-time-too-long-on.patch \
- file://0108-wifi-mt76-mt7996-add-beacon-monitoring-in-driver-for.patch \
- file://0109-mtk-wifi-mt76-mt7996-support-band_idx-option-for-set.patch \
- file://0110-mtk-wifi-mt76-mt7996-tmp-disable-VOW.patch \
- file://0111-mtk-wifi-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-.patch \
- file://0112-wifi-mt76-mt7996-Fix-get_txpower-wrong-result-in-sin.patch \
- file://0113-mtk-wifi-mt76-mt7996-add-beacon_int_min_gcd-to-suppo.patch \
- file://0114-mtk-wifi-mt76-mt7996-Add-connac3-csi-feature.patch \
- file://0115-mtk-wifi-mt76-mt7996-add-more-debug-info-for-MLO.patch \
- file://0116-mtk-wifi-mt76-mt7996-remain-multiple-wiphy-model-for.patch \
+ file://0002-mtk-mt76-mt7996-use-hweight16-to-get-correct-tx_ant.patch \
+ file://0003-mtk-mt76-mt7996-fix-MBSS.patch \
+ file://0004-mtk-mt76-mt7996-fix-HE-and-EHT-phy-cap.patch \
+ file://0005-mtk-mt76-mt7996-adjust-Beamformee-SS-capability.patch \
+ file://0006-mtk-mt76-mt7996-add-support-for-IEEE-802.11-fragment.patch \
+ file://0007-mtk-mt76-mt7996-set-rx-path-when-channel-switch.patch \
+ file://0008-mtk-mt76-mt7996-set-station-s-wmm-index-to-3.patch \
+ file://0009-mtk-mt76-mt7996-fix-rxd-checksum-offload-offset.patch \
+ file://0010-mtk-mt76-mt7996-fix-EHT-Beamforming-capability-check.patch \
+ file://0011-mtk-mt76-mt7996-fix-amsdu-information.patch \
+ file://0012-mtk-mt76-mt7996-add-beacon_int_min_gcd-to-support-di.patch \
+ file://0013-mtk-mt76-adjust-beamform-mcu-cmd-configuration-for-m.patch \
+ file://0014-mtk-mt76-mt7996-add-preamble-puncture-support-for-mt.patch \
+ file://0015-mtk-mt76-mt7996-add-driver-support-for-wpa3-ocv-and-.patch \
+ file://0016-mtk-mt76-mt7996-enable-ser-query.patch \
+ file://0017-mtk-mt76-mt7996-set-key-flag-IEEE80211_KEY_FLAG_GENE.patch \
+ file://0018-mtk-mt76-mt7996-Fix-TGax-HE-4.51.1_24G-fail.patch \
+ file://0019-mtk-mt76-mt7996-add-support-for-different-variants.patch \
+ file://0020-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch \
+ file://0021-mtk-mt76-mt7996-Fixed-null-pointer-dereference-issue.patch \
+ file://0022-mtk-mt76-add-sanity-check-to-prevent-kernel-crash.patch \
+ file://0023-mtk-mt76-mt7996-add-firmware-WA-s-coredump.patch \
+ file://0024-mtk-mt76-mt7996-for-build-pass.patch \
+ file://0025-mtk-mt76-mt7996-add-debug-tool.patch \
+ file://0026-mtk-mt76-mt7996-add-check-for-hostapd-config-he_ldpc.patch \
+ file://0027-mtk-mt76-mt7996-add-basic-testmode-support.patch \
+ file://0028-mtk-mt76-mt7996-add-testmode-pre-calibration-support.patch \
+ file://0029-mtk-mt76-mt7996-add-normal-mode-pre-calibration-supp.patch \
+ file://0030-mtk-mt76-mt7996-enable-SCS-feature-for-mt7996-driver.patch \
+ file://0031-mtk-mt76-mt7996-add-txpower-support.patch \
+ file://0032-mtk-mt76-mt7996-add-binfile-mode-support.patch \
+ file://0033-mtk-mt76-mt7996-add-testmode-ZWDFS-verification-supp.patch \
+ file://0034-mtk-mt76-mt7996-support-eagle-ZWDFS-on-iFEM.patch \
+ file://0035-mtk-mt76-mt7996-refactor-eeprom-loading-flow-for-sku.patch \
+ file://0036-mtk-mt76-mt7996-add-vendor-commands-support.patch \
+ file://0037-mtk-mt76-mt7996-add-debugfs-for-fw-coredump.patch \
+ file://0038-mtk-mt76-mt7996-Add-mt7992-coredump-support.patch \
+ file://0039-mtk-mt76-mt7996-add-support-for-runtime-set-in-band-.patch \
+ file://0040-mtk-mt76-mt7996-add-support-spatial-reuse-debug-comm.patch \
+ file://0041-mtk-mt76-mt7996-Establish-BA-in-VO-queue.patch \
+ file://0042-mtk-mt76-mt7996-report-tx-and-rx-byte-to-tpt_led.patch \
+ file://0043-mtk-mt76-mt7996-support-dup-wtbl.patch \
+ file://0044-mtk-mt76-try-more-times-when-send-message-timeout.patch \
+ file://0045-mtk-mt76-mt7996-add-SER-overlap-handle.patch \
+ file://0046-mtk-mt76-mt7996-kite-default-1-pcie-setting.patch \
+ file://0047-mtk-mt76-mt7996-support-BF-MIMO-debug-commands.patch \
+ file://0048-mtk-mt76-mt7996-add-build-the-following-MURU-mcu-com.patch \
+ file://0049-mtk-mt76-mt7996-add-cert-patch.patch \
+ file://0050-mtk-mt76-mt7996-add-testmode-bf-support.patch \
+ file://0051-mtk-mt76-mt7996-add-zwdfs-cert-mode.patch \
+ file://0052-mtk-mt76-mt7996-add-channel-68-96.patch \
+ file://0053-mtk-mt76-mt7996-add-kite-testmode-support.patch \
+ file://0054-mtk-mt76-mt7996-assign-DEAUTH-to-ALTX-queue-for-CERT.patch \
+ file://0055-mtk-mt76-mt7996-add-no_beacon-vendor-command-for-cer.patch \
+ file://0056-mtk-mt76-mt7996-add-adie-efuse-merge-support.patch \
+ file://0057-mtk-mt76-mt7996-add-Eagle-2adie-TBTC-BE14000-support.patch \
+ file://0058-mtk-mt76-mt7996-add-background-radar-hw-cap-check.patch \
+ file://0059-mtk-mt76-mt7996-add-fallback-in-case-of-missing-prec.patch \
+ file://0060-mtk-mt76-mt7996-add-kite-part-number-support.patch \
+ file://0061-mtk-wifi-mt76-revert-page_poll-for-kernel-5.4.patch \
+ file://0062-mtk-mt76-rework-wed-rx-flow.patch \
+ file://0063-mtk-mt76-change-wed-token-init-size-to-adapt-wed3.0.patch \
+ file://0064-mtk-mt76-add-random-early-drop-support.patch \
+ file://0065-mtk-mt76-mt7996-reset-addr_elem-when-delete-ba.patch \
+ file://0066-mtk-mt76-change-pcie0-R5-to-pcie1-to-get-6G-ICS.patch \
+ file://0067-mtk-mt76-add-SER-support-for-wed3.0.patch \
+ file://0068-mtk-mt76-find-rx-token-by-physical-address.patch \
+ file://0069-mtk-mt76-mt7996-add-dma-mask-limitation.patch \
+ file://0070-mtk-mt76-mt7996-add-per-bss-statistic-info.patch \
+ file://0071-mtk-mt76-mt7996-do-not-report-netdev-stats-on-monito.patch \
+ file://0072-mtk-mt76-mt7996-add-support-for-HW-ATF.patch \
+ file://0073-mtk-mt76-mt7996-add-SER0.5-support-w-wed3.0.patch \
+ file://0074-mtk-mt76-mt7996-support-backaward-compatiable.patch \
+ file://0075-mtk-mt76-mt7996-add-wed-support-for-mt7992.patch \
+ file://0076-mtk-mt76-add-2pcie-one-wed-support.patch \
+ file://0077-mtk-mt76-mt7996-Remove-wed-rro-ring-add-napi-at-init.patch \
+ file://0078-mtk-mt76-mt7996-Remove-wed_stop-during-L1-SER.patch \
+ file://0079-mtk-mt76-mt7996-Refactor-rro-del-ba-command-format.patch \
+ file://0080-mtk-mt76-mt7996-get-airtime-and-RSSI-via-MCU-command.patch \
+ file://0081-mtk-mt76-mt7996-add-support-for-WMM-PBC-configuratio.patch \
+ file://0082-mtk-mt76-mt7996-eagle-support-extra-option_type.patch \
+ file://0083-mtk-mt76-mt7996-support-enable-disable-thermal-prote.patch \
+ file://0084-mtk-mt76-mt7996-support-thermal-recal-debug-command.patch \
+ file://0085-mtk-mt76-mt7996-add-kite-two-pcie-with-two-wed-suppo.patch \
+ file://0086-mtk-mt76-add-support-to-enable-index-FW-log-for-Cons.patch \
+ file://0087-mtk-mt76-mt7996-implement-and-switch-to-hw-scan-call.patch \
+ file://0088-mtk-mt76-mt7996-implement-and-switch-to-chanctx-call.patch \
+ file://0089-mtk-mt76-mt7996-use-.sta_state-to-replace-.sta_add-a.patch \
+ file://0090-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch \
+ file://0091-mtk-mt76-mt7996-switch-to-per-link-data-structure-of.patch \
+ file://0092-mtk-mt76-extend-wcid-and-sta-flow-for-MLO-support.patch \
+ file://0093-mtk-mt76-mt7996-enable-MLO-capability.patch \
+ file://0094-mtk-mt76-mt7996-support-multi-link-vif-links-and-MLO.patch \
+ file://0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch \
+ file://0096-mtk-mt76-mt7996-introduce-mt7996_band_phy-for-ch-ban.patch \
+ file://0097-mtk-mt76-mt7996-rework-ieee80211_ops-callbacks-for-l.patch \
+ file://0098-mtk-mt76-mt7996-rework-TXD-for-multi-link-support.patch \
+ file://0099-mtk-mt76-mt7996-rework-TXS-for-multi-link-support.patch \
+ file://0100-mtk-mt76-mt7996-rework-RXD-for-multi-link-support.patch \
+ file://0101-mtk-mt76-mt7996-rework-mac-functions-for-multi-link-.patch \
+ file://0102-mtk-mt76-rework-mcu-functions-for-multi-link-support.patch \
+ file://0103-mtk-mt76-rework-connac-helpers.patch \
+ file://0104-mtk-mt76-mt7996-handle-mapping-for-hw-and-phy.patch \
+ file://0105-mtk-mt76-mt7996-handle-mapping-for-hw-and-vif.patch \
+ file://0106-mtk-mt76-mt7996-rework-scanning-parts-for-MLD-STA-su.patch \
+ file://0107-mtk-mt76-mt7996-implement-mld-address-translation.patch \
+ file://0108-mtk-mt76-mt7996-use-BSS_CHANGED_TXPOWER-for-txpower-.patch \
+ file://0109-mtk-mt76-mt7996-temp-support-for-single-wiphy.patch \
+ file://0110-mtk-mt76-mt7996-implement-ieee80211_ops-for-link-deb.patch \
+ file://0111-mtk-mt76-mt7996-support-multi-link-channel-switch.patch \
+ file://0112-mtk-mt76-mt7996-ACS-channel-time-too-long-on-duty-ch.patch \
+ file://0113-mtk-mt76-mt7996-add-beacon-monitoring-in-driver-for-.patch \
+ file://0114-mtk-mt76-mt7996-support-band_idx-option-for-set_mu-g.patch \
+ file://0115-mtk-mt76-mt7996-tmp-disable-VOW.patch \
+ file://0116-mtk-mt76-mt7996-enable-ampdu-limit-to-avoid-BA-bound.patch \
+ file://0117-mtk-mt76-mt7996-Fix-get_txpower-wrong-result-in-sing.patch \
+ file://0118-mtk-mt76-mt7996-Add-connac3-csi-feature.patch \
+ file://0119-mtk-mt76-mt7996-add-more-debug-info-for-MLO.patch \
+ file://0120-mtk-mt76-add-internal-debug-tool.patch \
+ file://0121-mtk-mt76-mt7996-add-linux-tracing-support.patch \
+ file://0122-mtk-mt76-temp-changes-for-SQC-period.patch \
+ file://0123-mtk-mt76-mt7996-remain-multiple-wiphy-model-for-test.patch \
+ file://0124-mtk-mt76-mt7996-enable-ibf-capability-for-mt7992.patch \
+ file://0125-mtk-mt76-remove-the-limitation-for-legacy-AP-sacn.patch \
+ file://0126-mtk-mt76-add-support-for-get_survey-in-single-wiphy-.patch \
+ file://0127-mtk-mt76-mt7996-add-critical-update-support.patch \
+ file://0128-mtk-mt76-mt7996-Add-support-for-EMLSR.patch \
+ file://0129-mtk-mt76-mt7996-add-max-mpdu-len-capability.patch \
+ file://0130-mtk-mt76-mt7996-add-correct-bss_conf-for-legacy-AP-s.patch \
+ file://0131-mtk-mt76-mt7996-fix-set-beacon-mcu-command.patch \
+ file://0132-mtk-mt76-fix-incorrect-setting-of-antenna-capability.patch \
+ file://0133-mtk-mt76-mt7996-fix-stop_tx_ba_session-warning.patch \
+ file://0134-mtk-mt76-mt7996-do-software-link-addr-translation-fo.patch \
+ file://0135-mtk-mt76-mt7996-add-per-band-debugfs-folder.patch \
+ file://0136-mtk-mt76-mt7996-move-internal-debugfs-knob-to-per-ba.patch \
+ file://0137-mtk-mt76-mt7996-refactor-amsdu-debugfs.patch \
+ file://0138-mtk-mt76-mt7996-trigger-channel-calibration-for-DFS-.patch \
+ file://0139-mtk-mt76-mt7996-do-not-remove-bss_info-and-starec-wh.patch \
+ file://0140-mtk-mt76-mt7996-remove-chanctx-in-mt7996_bss_conf.patch \
+ file://0141-mtk-mt76-mt7996-temporarily-disable-EPCS.patch \
+ file://0142-mtk-mt76-mt7996-fix-kite-can-t-handle-11v-beacon-on-.patch \
+ file://0143-mtk-mt76-mt7996-add-post-channel-switch-for-DFS-chan.patch \
+ file://0144-mtk-mt76-mt7996-update-testmode-bf-support.patch \
+ file://0145-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch \
+ file://0146-mtk-mt76-mt7996-add-debugfs-knob-to-show-mlo-related.patch \
+ file://0147-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch \
+ file://0148-mtk-mt76-mt7996-set-unused-band-to-UNSPECIFIED-in-ba.patch \
+ file://0149-mtk-mt76-mt7996-support-per-link-report-of-bss-color.patch \
+ file://0150-mtk-mt76-mt7996-Fix-inconsistent-QoS-mapping-between.patch \
+ file://0151-mtk-mt76-mt7996-add-support-for-MLD-interface-to-sca.patch \
+ file://0152-mtk-mt76-mt7996-add-per-link-txpower-config.patch \
+ file://0153-mtk-mt76-mt7996-update-TX-RX-rates-via-MCU-command.patch \
+ file://0154-mtk-mt76-mt7996-add-link-information-when-dump-stati.patch \
+ file://0155-mtk-mt76-mt7996-add-per-link-RX-MPDU-statistics.patch \
+ file://0156-mtk-mt76-mt7996-support-link_id-for-mt7996_set_bitra.patch \
+ file://0157-mtk-mt76-mt7996-add-per-radio-antenna-config.patch \
+ file://0158-mtk-mt76-mt7996-rework-debug-prints.patch \
+ file://0159-mtk-mt76-mt7996-support-configure-trigger-frame-type.patch \
+ file://0160-mtk-mt76-mt7996-support-configure-coding-type-for-wi.patch \
+ file://0161-mtk-mt76-mt7996-record-RSSI-and-SNR.patch \
+ file://0162-mtk-mt76-mt7996-support-find-the-mt7996_phy-by-link_.patch \
+ file://0163-mtk-mt76-mt7996-workaround-for-get_tsf-crash-issue.patch \
+ file://0164-mtk-mt76-add-debugfs-for-tx-drop-counters.patch \
+ file://0165-mtk-mt76-add-debugfs-for-rx-drop-counters.patch \
+ file://0166-mtk-mt76-mt7996-add-support-for-remain-on-channel-op.patch \
+ file://0167-mtk-mt76-mt7996-rework-the-setting-flow-of-starec-RA.patch \
+ file://0168-mtk-mt76-mt7996-Fix-NULL-pointer-crash-when-mac-tx-f.patch \
+ file://0169-mtk-mt76-mt7996-update-adie-efuse-merge-support.patch \
+ file://0170-mtk-mt76-mt7996-support-handle-link_id-in-ap_wireles.patch \
+ file://0171-mtk-mt76-mt7996-fix-incorrect-indexing-of-MIB-FW-eve.patch \
+ file://0172-mtk-mt76-mt7996-support-muru-dbg-info-debug-commands.patch \
+ file://0173-mtk-mt76-mt7996-add-kite-if_comb.patch \
+ file://0174-mtk-mt76-mt7996-change-source-of-per-WCID-TX-MPDU-st.patch \
+ file://0175-mtk-mt76-mt7996-update-preamble-puncture-support-for.patch \
+ file://0176-mtk-mt76-Add-dynamic-pp-vendor-and-debug-pp-algo-cmd.patch \
+ file://0177-mtk-mt76-mt7996-disable-MAT-and-set-force-link-for-4.patch \
+ file://0178-mtk-mt76-mt7996-add-per-STA-TX-MSDU-failed-and-retri.patch \
+ file://0179-mtk-mt76-mt7996-fill-in-sn-into-txd-for-MLD-multicas.patch \
+ file://0180-mtk-mt76-mt7996-fix-potential-null-pointer.patch \
+ file://0181-mtk-mt76-mt7996-Fix-legacy-action-frame-wrong-addres.patch \
+ file://0182-mtk-mt76-mt7996-add-AP-affiliated-link-removal-suppo.patch \
+ file://0183-mtk-mt76-mt7996-add-support-for-AP-A-TTLM.patch \
+ file://0184-mtk-mt76-mt7996-leave-ps-when-4-address-is-establish.patch \
+ file://0185-mtk-mt76-mt7996-add-debugfs-knob-to-set-and-dump-txo.patch \
+ file://0186-mtk-mt76-mt7996-add-mcu-command-to-set-bssid-mapping.patch \
+ file://0187-mtk-mt76-mt7996-Temporary-fix-init-txpwoer-for-singl.patch \
+ file://0188-mtk-mt76-mt7996-Add-lpi-support-with-sku_idx-and-enh.patch \
+ file://0189-mtk-mt76-mt7996-Add-Triggered-Uplink-Access-Optimiza.patch \
+ file://0190-mtk-mt76-mt7996-add-per-band-token-limit.patch \
+ file://0191-mtk-mt76-sync-with-upstream-changes.patch \
+ file://0192-mtk-mt76-mt7996-record-per-antenna-average-data-fram.patch \
+ file://0193-mtk-mt76-mt7996-remove-default-bss_conf-when-link-be.patch \
+ file://0194-mtk-mt76-mt7996-pass-vif-cfg.assoc-to-mt7996_mac_sta.patch \
+ file://0195-mtk-mt76-mt7996-separate-hwrro-from-wed.patch \
+ file://0196-mtk-mt76-mt7996-ignore-vif.dormant_links-in-mt7996_c.patch \
+ file://0197-mtk-mt76-mt7996-add-Adv-TTLM-support-for-STA.patch \
+ file://0198-mtk-mt76-mt7996-Add-AFC-and-lpi-power-support.patch \
+ file://0199-mtk-mt76-do-not-report-ACK-when-TXS-is-lost.patch \
"
diff --git a/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch b/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
index 41c0721..01fb995 100644
--- a/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
@@ -1,4 +1,4 @@
-From 4621fb4257ade6a4639be6ab8f785e4d8e3bba43 Mon Sep 17 00:00:00 2001
+From 67edc0d71c271793b5ab04338abedaab41b8586e Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Thu, 18 May 2023 18:11:37 +0800
Subject: [PATCH 01/21] wifi: mt76: fix incorrect HE TX GI report
@@ -17,7 +17,7 @@
7 files changed, 282 insertions(+), 22 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 2cbea73..92acba9 100644
+index 7dd59db3..bf0770a8 100644
--- a/mt76.h
+++ b/mt76.h
@@ -282,12 +282,16 @@ struct mt76_queue_ops {
@@ -38,10 +38,10 @@
MT_PHY_TYPE_HE_EXT_SU,
MT_PHY_TYPE_HE_TB,
diff --git a/mt7915/init.c b/mt7915/init.c
-index eee1879..edf83c4 100644
+index f1ef965f..888dbf82 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -673,6 +673,8 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
+@@ -674,6 +674,8 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
struct mt76_phy *mphy = phy->mt76;
int ret;
@@ -50,7 +50,7 @@
INIT_DELAYED_WORK(&mphy->mac_work, mt7915_mac_work);
mt7915_eeprom_parse_hw_cap(dev, phy);
-@@ -1206,6 +1208,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1204,6 +1206,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
dev->phy.dev = dev;
dev->phy.mt76 = &dev->mt76.phy;
dev->mt76.phy.priv = &dev->phy;
@@ -60,7 +60,7 @@
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
INIT_LIST_HEAD(&dev->sta_rc_list);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 8008ce3..b915201 100644
+index 8008ce3f..b9152018 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -180,15 +180,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
@@ -188,7 +188,7 @@
mt76_tx_status_check(mphy->dev, false);
diff --git a/mt7915/main.c b/mt7915/main.c
-index b16a633..e61041d 100644
+index 2624edbb..b2a6278f 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -752,6 +752,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -220,7 +220,7 @@
static void mt7915_tx(struct ieee80211_hw *hw,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index fe54a2f..7df2162 100644
+index 18ba20cf..9774bcce 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3793,6 +3793,167 @@ out:
@@ -392,7 +392,7 @@
struct cfg80211_he_bss_color *he_bss_color)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b41ac4a..8f36546 100644
+index b41ac4aa..8f365461 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -152,6 +152,61 @@ struct mt7915_mcu_eeprom_info {
@@ -466,7 +466,7 @@
+};
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index a30d08e..aee30c7 100644
+index a30d08eb..aee30c73 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -137,6 +137,7 @@ struct mt7915_sta {
diff --git a/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch b/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
index 5d62e29..a235b66 100644
--- a/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
@@ -1,4 +1,4 @@
-From c680e5830a6f55b930c2e2e6fdd47f7c957fb656 Mon Sep 17 00:00:00 2001
+From 044f6b5284b02b6f41e91d0e8bfb5a022b43cbf9 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 22 May 2023 13:49:37 +0800
Subject: [PATCH 02/21] wifi: mt76: mt7915: add pc stack dump for WM's
@@ -16,7 +16,7 @@
7 files changed, 207 insertions(+), 71 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 92acba9..ee14425 100644
+index bf0770a8..4fb07877 100644
--- a/mt76.h
+++ b/mt76.h
@@ -32,6 +32,8 @@
@@ -52,7 +52,7 @@
struct net_device napi_dev;
struct net_device tx_napi_dev;
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index b35acf8..1ea9798 100644
+index 162c57fb..4baaaacf 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -2941,6 +2941,9 @@ int mt76_connac2_load_ram(struct mt76_dev *dev, const char *fw_wm,
@@ -86,7 +86,7 @@
struct mt76_connac2_patch_sec *sec;
u32 len, addr, mode;
diff --git a/mt7915/coredump.c b/mt7915/coredump.c
-index 5daf225..298c1ca 100644
+index 5daf2258..298c1cad 100644
--- a/mt7915/coredump.c
+++ b/mt7915/coredump.c
@@ -7,7 +7,7 @@
@@ -414,7 +414,7 @@
}
diff --git a/mt7915/coredump.h b/mt7915/coredump.h
-index 709f8e9..809ccbd 100644
+index 709f8e9c..809ccbdf 100644
--- a/mt7915/coredump.h
+++ b/mt7915/coredump.h
@@ -4,6 +4,7 @@
@@ -514,7 +514,7 @@
return NULL;
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index b915201..0f6b806 100644
+index b9152018..0f6b8067 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1597,28 +1597,31 @@ void mt7915_mac_reset_work(struct work_struct *work)
@@ -595,7 +595,7 @@
}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index aee30c7..5cd2b33 100644
+index aee30c73..5cd2b334 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -286,7 +286,7 @@ struct mt7915_dev {
@@ -608,7 +608,7 @@
#endif
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 89ac8e6..7515b23 100644
+index 89ac8e67..7515b23f 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -1219,4 +1219,24 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch b/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
index 4f3c97a..dbb5c3f 100644
--- a/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
@@ -1,4 +1,4 @@
-From 2825cf9ff77fa1065dac5c7a129aad9e8edecdf3 Mon Sep 17 00:00:00 2001
+From c4f870c030edebe27120d87364a213c9f8f7089c Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 13 Jul 2023 15:50:00 +0800
Subject: [PATCH 03/21] wifi: mt76: mt7915: move temperature margin check to
@@ -17,10 +17,10 @@
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index edf83c4..9fe0524 100644
+index 888dbf82..3b352fe9 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -83,12 +83,13 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev,
+@@ -84,12 +84,13 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev,
mutex_lock(&phy->dev->mt76.mutex);
val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 60, 130);
@@ -38,7 +38,7 @@
return -EINVAL;
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 7df2162..6e9970c 100644
+index 9774bcce..dcf8782a 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3226,8 +3226,7 @@ int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy)
diff --git a/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-txpower-issues.patch b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-txpower-issues.patch
index a9a5f48..a93ff89 100644
--- a/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-txpower-issues.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-txpower-issues.patch
@@ -1,4 +1,4 @@
-From 47f124ba1718259555245eb9c3ad3fb2b4fd0a67 Mon Sep 17 00:00:00 2001
+From 349e821372153fddd6abcd295e50753e5f040f1f Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Sat, 29 Jul 2023 04:53:47 +0800
Subject: [PATCH 04/21] wifi: mt76: mt7915: fix txpower issues
@@ -10,7 +10,7 @@
3 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index 0bc66cc..ecd09c0 100644
+index 0bc66cc1..ecd09c03 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -343,7 +343,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
@@ -23,7 +23,7 @@
if (!mcs_rates)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 5780138..894e2cd 100644
+index 57801388..894e2cd7 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -951,9 +951,9 @@ mt7915_xmit_queues_show(struct seq_file *file, void *data)
@@ -107,7 +107,7 @@
reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_TPC_CTRL_STAT(band) :
MT_WF_PHY_TPC_CTRL_STAT_MT7916(band);
diff --git a/mt7915/main.c b/mt7915/main.c
-index e61041d..1903db4 100644
+index b2a6278f..a2ad918d 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1080,6 +1080,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
diff --git a/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-Fixed-null-pointer-dereference-issu.patch b/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-Fixed-null-pointer-dereference-issu.patch
index 07a8d7b..81601e4 100644
--- a/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-Fixed-null-pointer-dereference-issu.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-Fixed-null-pointer-dereference-issu.patch
@@ -1,4 +1,4 @@
-From dc0b3bc81859846e1f7bab33eca1212753b4ec1d Mon Sep 17 00:00:00 2001
+From 7b49a07b4440843e3a85c268d3526b410ebf061e Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Thu, 26 Oct 2023 21:11:05 +0800
Subject: [PATCH 05/21] wifi: mt76: mt7915: Fixed null pointer dereference
@@ -17,7 +17,7 @@
1 file changed, 7 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 1903db4..61a1dbb 100644
+index a2ad918d..ec2360c3 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1170,9 +1170,16 @@ static void mt7915_sta_rc_update(struct ieee80211_hw *hw,
diff --git a/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-ACS-channel-time-too-long-on-duty-channel.patch b/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-ACS-channel-time-too-long-on-duty-channel.patch
index 4bf49da..ac20c29 100644
--- a/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-ACS-channel-time-too-long-on-duty-channel.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-ACS-channel-time-too-long-on-duty-channel.patch
@@ -1,4 +1,4 @@
-From e6a8b61c776db565c532515af002156da38f2f48 Mon Sep 17 00:00:00 2001
+From b6f567e8d4223c309134df14c577f0adee2044bf Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Sat, 18 Nov 2023 07:36:45 +0800
Subject: [PATCH 06/21] wifi: mt76: ACS channel time too long on duty channel
@@ -26,10 +26,10 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mac80211.c b/mac80211.c
-index e7b763b..bc20f60 100644
+index 94e85ed9..aee6f1e7 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -927,6 +927,7 @@ void mt76_set_channel(struct mt76_phy *phy)
+@@ -928,6 +928,7 @@ void mt76_set_channel(struct mt76_phy *phy)
struct cfg80211_chan_def *chandef = &hw->conf.chandef;
bool offchannel = hw->conf.flags & IEEE80211_CONF_OFFCHANNEL;
int timeout = HZ / 5;
@@ -37,7 +37,7 @@
wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(phy), timeout);
mt76_update_survey(phy);
-@@ -941,7 +942,7 @@ void mt76_set_channel(struct mt76_phy *phy)
+@@ -942,7 +943,7 @@ void mt76_set_channel(struct mt76_phy *phy)
if (!offchannel)
phy->main_chan = chandef->chan;
diff --git a/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-add-post-channel-switch-for-DFS-cha.patch b/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-add-post-channel-switch-for-DFS-cha.patch
index 8dbeb72..c40f2ae 100644
--- a/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-add-post-channel-switch-for-DFS-cha.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-add-post-channel-switch-for-DFS-cha.patch
@@ -1,4 +1,4 @@
-From 96ee52ffd24c36443d93df103b2a856832a41443 Mon Sep 17 00:00:00 2001
+From d5a9af18ab8f2c8c6a46c10ef99f2a50e08ae9c3 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 16 Nov 2023 14:41:54 +0800
Subject: [PATCH 07/21] wifi: mt76: mt7915: add post channel switch for DFS
@@ -10,7 +10,7 @@
1 file changed, 22 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 61a1dbb..71e0d55 100644
+index ec2360c3..0d24e74c 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -736,6 +736,27 @@ mt7915_channel_switch_beacon(struct ieee80211_hw *hw,
@@ -41,7 +41,7 @@
int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
-@@ -1701,6 +1722,7 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1705,6 +1726,7 @@ const struct ieee80211_ops mt7915_ops = {
.get_txpower = mt76_get_txpower,
.set_sar_specs = mt7915_set_sar_specs,
.channel_switch_beacon = mt7915_channel_switch_beacon,
diff --git a/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-add-support-for-realtime-Rx-rate-up.patch b/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-add-support-for-realtime-Rx-rate-up.patch
index 7e82038..a5a0241 100644
--- a/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-add-support-for-realtime-Rx-rate-up.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-add-support-for-realtime-Rx-rate-up.patch
@@ -1,4 +1,4 @@
-From 308339254c28af264d9c64f1bc3e29a996d5da12 Mon Sep 17 00:00:00 2001
+From 2b85ea7a8f85c36709442d5ebab72bded582d5cd Mon Sep 17 00:00:00 2001
From: "Henry.Yen" <henry.yen@mediatek.com>
Date: Mon, 8 Jan 2024 17:19:01 +0800
Subject: [PATCH 08/21] wifi: mt76: mt7915: add support for realtime Rx rate
@@ -19,7 +19,7 @@
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/mt76_connac.h b/mt76_connac.h
-index 91987bd..4871857 100644
+index 445d0f0a..5028e49a 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -260,6 +260,12 @@ static inline bool is_connac_v1(struct mt76_dev *dev)
@@ -36,7 +36,7 @@
{
switch (mt76_chip(dev)) {
diff --git a/mt7915/main.c b/mt7915/main.c
-index 71e0d55..5d31f5a 100644
+index 0d24e74c..645d9779 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1118,7 +1118,7 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
diff --git a/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-remove-redundant-argument-in-add_be.patch b/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-remove-redundant-argument-in-add_be.patch
index 815103c..9125ae3 100644
--- a/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-remove-redundant-argument-in-add_be.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-remove-redundant-argument-in-add_be.patch
@@ -1,4 +1,4 @@
-From 963b2b1d3955ccf2cf4806790c9184e5dfc3e3ea Mon Sep 17 00:00:00 2001
+From bc85ec5a69b6e57eab15c50b54e0603a0829d102 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Date: Wed, 24 Jan 2024 15:04:33 +0800
Subject: [PATCH 09/21] wifi: mt76: mt7915: remove redundant argument in
@@ -15,7 +15,7 @@
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 0f6b806..ada3a7f 100644
+index 0f6b8067..ada3a7f4 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1285,8 +1285,7 @@ mt7915_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
@@ -29,7 +29,7 @@
default:
break;
diff --git a/mt7915/main.c b/mt7915/main.c
-index 5d31f5a..9eeca39 100644
+index 645d9779..f0491d66 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -659,7 +659,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
@@ -51,7 +51,7 @@
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 6e9970c..84ffe07 100644
+index dcf8782a..a71562fb 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1970,8 +1970,7 @@ mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
@@ -65,7 +65,7 @@
struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw);
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 5cd2b33..e1801d5 100644
+index 5cd2b334..e1801d5b 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -461,7 +461,7 @@ int mt7915_mcu_update_bss_color(struct mt7915_dev *dev, struct ieee80211_vif *vi
diff --git a/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-support-for-WMM-PBC-configurati.patch b/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-support-for-WMM-PBC-configurati.patch
index e508cd1..04fe37e 100644
--- a/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-support-for-WMM-PBC-configurati.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-support-for-WMM-PBC-configurati.patch
@@ -1,4 +1,4 @@
-From 4d8bb032a13e467479bf852a7c72c693814bc11b Mon Sep 17 00:00:00 2001
+From 664d47ddcc7ed90b5d2d73b2040759bf0bf75714 Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Mon, 29 Jan 2024 11:28:41 +0800
Subject: [PATCH 10/21] wifi: mt76: mt7915: add support for WMM PBC
@@ -14,10 +14,10 @@
6 files changed, 127 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 67be14d..1dd8244 100644
+index 6873ce14..46dcd1c6 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1025,6 +1025,7 @@ enum {
+@@ -1026,6 +1026,7 @@ enum {
MCU_EXT_EVENT_ASSERT_DUMP = 0x23,
MCU_EXT_EVENT_RDD_REPORT = 0x3a,
MCU_EXT_EVENT_CSA_NOTIFY = 0x4f,
@@ -25,7 +25,7 @@
MCU_EXT_EVENT_WA_TX_STAT = 0x74,
MCU_EXT_EVENT_BCC_NOTIFY = 0x75,
MCU_EXT_EVENT_MURU_CTRL = 0x9f,
-@@ -1220,6 +1221,7 @@ enum {
+@@ -1222,6 +1223,7 @@ enum {
MCU_EXT_CMD_TXDPD_CAL = 0x60,
MCU_EXT_CMD_CAL_CACHE = 0x67,
MCU_EXT_CMD_RED_ENABLE = 0x68,
@@ -34,10 +34,10 @@
MCU_EXT_CMD_SET_RADAR_TH = 0x7c,
MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d,
diff --git a/mt7915/init.c b/mt7915/init.c
-index 9fe0524..f81a2f2 100644
+index 3b352fe9..46762827 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -1221,6 +1221,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1219,6 +1219,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
INIT_WORK(&dev->dump_work, mt7915_mac_dump_work);
mutex_init(&dev->dump_mutex);
@@ -47,7 +47,7 @@
phy2 = mt7915_alloc_ext_phy(dev);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index ada3a7f..e167e7b 100644
+index ada3a7f4..e167e7b6 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -2032,6 +2032,8 @@ void mt7915_mac_work(struct work_struct *work)
@@ -79,7 +79,7 @@
if (++phy->stats_work_count == 10) {
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 84ffe07..446c512 100644
+index a71562fb..9126e62f 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -354,6 +354,93 @@ mt7915_mcu_rx_bcc_notify(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -187,7 +187,7 @@
break;
}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 8f36546..fa0847d 100644
+index 8f365461..fa0847d5 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -329,10 +329,25 @@ enum {
@@ -217,7 +217,7 @@
};
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index e1801d5..89156f3 100644
+index e1801d5b..89156f35 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -326,6 +326,9 @@ struct mt7915_dev {
diff --git a/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-fix-tx-statistics-about-tx-retry-and-tx-fa.patch b/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-fix-tx-statistics-about-tx-retry-and-tx-fa.patch
index 9837869..238b452 100644
--- a/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-fix-tx-statistics-about-tx-retry-and-tx-fa.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-fix-tx-statistics-about-tx-retry-and-tx-fa.patch
@@ -1,4 +1,4 @@
-From 99458375f8a646403eed7c259d05ff3e47e892b6 Mon Sep 17 00:00:00 2001
+From 1587828e06491339654d20dea3382749fde143ed Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 29 Jan 2024 11:02:06 +0800
Subject: [PATCH 11/21] wifi: mt76: fix tx statistics about tx retry and tx
@@ -13,7 +13,7 @@
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index b841bf6..630c640 100644
+index b841bf62..630c6402 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -716,9 +716,6 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
@@ -27,7 +27,7 @@
skb = mt76_tx_status_skb_get(dev, wcid, pid, &list);
if (skb) {
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index e167e7b..a5d0b09 100644
+index e167e7b6..a5d0b096 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1021,7 +1021,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
diff --git a/recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-add-sanity-check-to-prevent-kernel-crash.patch b/recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-add-sanity-check-to-prevent-kernel-crash.patch
index d225e02..576cf69 100644
--- a/recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-add-sanity-check-to-prevent-kernel-crash.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-add-sanity-check-to-prevent-kernel-crash.patch
@@ -1,4 +1,4 @@
-From 8bcee1da876907d67de94317dcd343842a54921f Mon Sep 17 00:00:00 2001
+From 65092f531e1319ed6ddb25e982393eddccb781b5 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 29 Jan 2024 15:33:24 +0800
Subject: [PATCH 12/21] wifi: mt76: add sanity check to prevent kernel crash
@@ -12,7 +12,7 @@
1 file changed, 8 insertions(+)
diff --git a/tx.c b/tx.c
-index 5cf6ede..ab42f69 100644
+index 5cf6edee..ab42f69b 100644
--- a/tx.c
+++ b/tx.c
@@ -345,6 +345,14 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
diff --git a/recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch b/recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch
index 6d59422..167f36c 100644
--- a/recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch
@@ -1,4 +1,4 @@
-From ed564a0fe9b656b67eafc74c63aa747b43c49580 Mon Sep 17 00:00:00 2001
+From a2f8deaaf6a97b0157e49ec476b003ef1dd234f8 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 29 Jan 2024 15:33:24 +0800
Subject: [PATCH 13/21] wifi: mt76: mt7915: limit per-band token count
@@ -20,7 +20,7 @@
9 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/mt76.h b/mt76.h
-index ee14425..b83456b 100644
+index 4fb07877..05ee568c 100644
--- a/mt76.h
+++ b/mt76.h
@@ -407,6 +407,8 @@ struct mt76_txwi_cache {
@@ -49,7 +49,7 @@
spinlock_t rx_token_lock;
struct idr rx_token;
-@@ -1662,7 +1667,8 @@ static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
+@@ -1674,7 +1679,8 @@ static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
struct mt76_txwi_cache *
mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
@@ -60,7 +60,7 @@
struct mt76_txwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index 630c640..a92c261 100644
+index 630c6402..a92c261d 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -1178,6 +1178,8 @@ void mt76_connac2_tx_token_put(struct mt76_dev *dev)
@@ -73,10 +73,10 @@
spin_unlock_bh(&dev->token_lock);
idr_destroy(&dev->token);
diff --git a/mt7915/init.c b/mt7915/init.c
-index f81a2f2..3ec9eab 100644
+index 46762827..ea9bc735 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -1225,6 +1225,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1223,6 +1223,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
dev->dbdc_support = mt7915_band_config(dev);
@@ -85,7 +85,7 @@
phy2 = mt7915_alloc_ext_phy(dev);
if (IS_ERR(phy2))
return PTR_ERR(phy2);
-@@ -1257,6 +1259,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1255,6 +1257,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
}
dev->recovery.hw_init_done = true;
@@ -94,7 +94,7 @@
ret = mt7915_init_debugfs(&dev->phy);
if (ret)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index a5d0b09..4604a68 100644
+index a5d0b096..4604a682 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -738,6 +738,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -115,7 +115,7 @@
return id;
diff --git a/mt7921/pci_mac.c b/mt7921/pci_mac.c
-index 031ba9a..4c69c55 100644
+index 031ba9aa..4c69c55c 100644
--- a/mt7921/pci_mac.c
+++ b/mt7921/pci_mac.c
@@ -27,7 +27,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -128,7 +128,7 @@
return id;
diff --git a/mt7925/pci_mac.c b/mt7925/pci_mac.c
-index 9fca887..f1d615c 100644
+index 9fca8879..f1d615c0 100644
--- a/mt7925/pci_mac.c
+++ b/mt7925/pci_mac.c
@@ -27,7 +27,7 @@ int mt7925e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -141,10 +141,10 @@
return id;
diff --git a/mt7996/init.c b/mt7996/init.c
-index 9aa97e4..7549a10 100644
+index 283df84f..d191a7b7 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
-@@ -634,6 +634,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
+@@ -635,6 +635,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
mtk_wed_device_start(&dev->mt76.mmio.wed_hif2, irq_mask);
}
@@ -171,7 +171,7 @@
if (ret)
goto error;
diff --git a/mt7996/mac.c b/mt7996/mac.c
-index bc7111a..aa19120 100644
+index bc7111a7..aa19120b 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -922,6 +922,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -192,7 +192,7 @@
return id;
diff --git a/tx.c b/tx.c
-index ab42f69..0fdf7d8 100644
+index ab42f69b..0fdf7d83 100644
--- a/tx.c
+++ b/tx.c
@@ -825,16 +825,30 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
diff --git a/recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-update-power-on-sequence.patch b/recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-update-power-on-sequence.patch
index d12aa99..5f53feb 100644
--- a/recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-update-power-on-sequence.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-update-power-on-sequence.patch
@@ -1,4 +1,4 @@
-From 24535c7fc954e8122a792a28bd7c8fd77887c4b8 Mon Sep 17 00:00:00 2001
+From 55dd46f8caed3d8baa6819d884a1e82c496083f5 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 14 Mar 2024 17:55:12 +0800
Subject: [PATCH 14/21] wifi: mt76: mt7915: update power on sequence
@@ -13,7 +13,7 @@
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 89156f3..74cd8ca 100644
+index 89156f35..74cd8caf 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -329,6 +329,7 @@ struct mt7915_dev {
@@ -25,7 +25,7 @@
enum {
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 7515b23..3452a7e 100644
+index 7515b23f..3452a7e9 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -775,6 +775,7 @@ enum offs_rev {
@@ -45,7 +45,7 @@
/* ADIE */
#define MT_ADIE_CHIP_ID 0x02c
diff --git a/mt7915/soc.c b/mt7915/soc.c
-index 92d8d71..bb3468a 100644
+index 92d8d710..bb3468a9 100644
--- a/mt7915/soc.c
+++ b/mt7915/soc.c
@@ -260,6 +260,7 @@ static int mt7986_wmac_consys_lockup(struct mt7915_dev *dev, bool enable)
diff --git a/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-mt7915-add-support-for-IEEE-802.11-fragmen.patch b/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-mt7915-add-support-for-IEEE-802.11-fragmen.patch
index 067716d..c28e51e 100644
--- a/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-mt7915-add-support-for-IEEE-802.11-fragmen.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-mt7915-add-support-for-IEEE-802.11-fragmen.patch
@@ -1,4 +1,4 @@
-From 9be5cee24e12846873cc8b2f7b3166043f47a8dc Mon Sep 17 00:00:00 2001
+From 22225104ac30af79661bf46c04e8c9523c2d22fd Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Wed, 3 Apr 2024 14:05:59 +0800
Subject: [PATCH 15/21] wifi: mt76: mt7915: add support for IEEE 802.11
@@ -13,7 +13,7 @@
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/mt76_connac2_mac.h b/mt76_connac2_mac.h
-index 5f13211..eb47653 100644
+index 5f132115..eb476536 100644
--- a/mt76_connac2_mac.h
+++ b/mt76_connac2_mac.h
@@ -355,4 +355,11 @@ enum tx_port_idx {
@@ -29,7 +29,7 @@
+
#endif /* __MT76_CONNAC2_MAC_H */
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index a92c261..170ef36 100644
+index a92c261d..170ef367 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -391,6 +391,7 @@ mt76_connac2_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,
diff --git a/recipes-wifi/linux-mt76/files/patches/0016-wifi-mt76-mt7915-add-dummy-HW-offload-of-IEEE-802.11.patch b/recipes-wifi/linux-mt76/files/patches/0016-wifi-mt76-mt7915-add-dummy-HW-offload-of-IEEE-802.11.patch
index 78d9d87..d1a11c4 100644
--- a/recipes-wifi/linux-mt76/files/patches/0016-wifi-mt76-mt7915-add-dummy-HW-offload-of-IEEE-802.11.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0016-wifi-mt76-mt7915-add-dummy-HW-offload-of-IEEE-802.11.patch
@@ -1,4 +1,4 @@
-From b8a7bf6451dd612803743b69209672186bb09f6f Mon Sep 17 00:00:00 2001
+From 9db10864ac1dbdc802e563fc6d8752c8b275c302 Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Wed, 17 Apr 2024 10:47:08 +0800
Subject: [PATCH 16/21] wifi: mt76: mt7915: add dummy HW offload of IEEE 802.11
@@ -14,10 +14,10 @@
2 files changed, 8 insertions(+)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 3ec9eab..19a68c5 100644
+index ea9bc735..470b198a 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -398,6 +398,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+@@ -399,6 +399,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
@@ -26,7 +26,7 @@
hw->max_tx_fragments = 4;
diff --git a/mt7915/main.c b/mt7915/main.c
-index 9eeca39..65a3ce0 100644
+index f0491d66..f4673c8d 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1614,6 +1614,12 @@ mt7915_twt_teardown_request(struct ieee80211_hw *hw,
@@ -42,7 +42,7 @@
static int
mt7915_set_radar_background(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef)
-@@ -1741,6 +1747,7 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1745,6 +1751,7 @@ const struct ieee80211_ops mt7915_ops = {
.sta_set_decap_offload = mt7915_sta_set_decap_offload,
.add_twt_setup = mt7915_mac_add_twt_setup,
.twt_teardown_request = mt7915_twt_teardown_request,
diff --git a/recipes-wifi/linux-mt76/files/patches/0017-wifi-mt76-mt7915-fix-rx-filter-setting-for-bfee-func.patch b/recipes-wifi/linux-mt76/files/patches/0017-wifi-mt76-mt7915-fix-rx-filter-setting-for-bfee-func.patch
index d4ad3a7..706b107 100644
--- a/recipes-wifi/linux-mt76/files/patches/0017-wifi-mt76-mt7915-fix-rx-filter-setting-for-bfee-func.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0017-wifi-mt76-mt7915-fix-rx-filter-setting-for-bfee-func.patch
@@ -1,4 +1,4 @@
-From f7a49dfa1f56157ea7d0d433fa6a06b12a98f46b Mon Sep 17 00:00:00 2001
+From d0d40f91383444dce590d39157d05f4922102db3 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Fri, 12 Apr 2024 11:33:08 +0800
Subject: [PATCH 17/21] wifi: mt76: mt7915: fix rx filter setting for bfee
@@ -14,7 +14,7 @@
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 65a3ce0..5ed84bc 100644
+index f4673c8d..f40a9007 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -564,8 +564,7 @@ static void mt7915_configure_filter(struct ieee80211_hw *hw,
diff --git a/recipes-wifi/linux-mt76/files/patches/0018-wifi-mt76-mt7915-fix-inconsistent-QoS-mapping-betwee.patch b/recipes-wifi/linux-mt76/files/patches/0018-wifi-mt76-mt7915-fix-inconsistent-QoS-mapping-betwee.patch
index c871c60..6eed8bd 100644
--- a/recipes-wifi/linux-mt76/files/patches/0018-wifi-mt76-mt7915-fix-inconsistent-QoS-mapping-betwee.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0018-wifi-mt76-mt7915-fix-inconsistent-QoS-mapping-betwee.patch
@@ -1,4 +1,4 @@
-From 5fd6278fa4d62c140f40fe2d7ae0bd86074b2d36 Mon Sep 17 00:00:00 2001
+From 6e6fb69bc4f57d622fae76d8d5a3102b8e98e10f Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Thu, 25 Apr 2024 17:17:13 +0800
Subject: [PATCH] wifi: mt76: mt7915: fix inconsistent QoS mapping between SW
@@ -10,11 +10,11 @@
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
---
mt76_connac_mcu.h | 1 +
- mt7915/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 45 insertions(+)
+ mt7915/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 52 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 8899eea..5c25f1a 100644
+index 46dcd1c..e0255a2 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1238,6 +1238,7 @@ enum {
@@ -26,15 +26,15 @@
enum {
diff --git a/mt7915/main.c b/mt7915/main.c
-index 5ed84bc..be11e4f 100644
+index f40a900..f82d0b1 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1619,6 +1619,49 @@ mt7915_set_frag_threshold(struct ieee80211_hw *hw, u32 val)
+@@ -1619,6 +1619,56 @@ mt7915_set_frag_threshold(struct ieee80211_hw *hw, u32 val)
return 0;
}
+static int
-+mt7915_set_qos_map(struct ieee80211_vif *vif, struct cfg80211_qos_map *qos_map)
++mt7915_set_qos_map(struct ieee80211_vif *vif, struct cfg80211_qos_map *usr_qos_map)
+{
+#define IP_DSCP_NUM 64
+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
@@ -45,18 +45,25 @@
+ s8 qos_map[IP_DSCP_NUM];
+ } __packed req = {
+ .bss_idx = mvif->mt76.idx,
-+ .qos_map_enable = qos_map ? true : false,
++ .qos_map_enable = usr_qos_map ? true : false,
+ };
+
+ /* Prevent access to members of mt7915_vif before its initialization. */
+ if (!mvif->phy)
+ return -EPERM;
+
-+ if (qos_map) {
-+ struct cfg80211_dscp_exception *exception = qos_map->dscp_exception;
-+ struct cfg80211_dscp_range *range = qos_map->up;
++ if (usr_qos_map) {
++ struct cfg80211_dscp_exception *exception = usr_qos_map->dscp_exception;
++ struct cfg80211_dscp_range *range = usr_qos_map->up;
+ s8 i;
+
++ /* Default QoS map, defined in section 2.3 of RFC8325.
++ * Three most significant bits of DSCP are used as UP.
++ */
++ for (i = 0; i < IP_DSCP_NUM; ++i)
++ req.qos_map[i] = i >> 3;
++
++ /* User-defined QoS map */
+ for (i = 0; i < IEEE80211_NUM_UPS; ++i) {
+ u8 low = range[i].low, high = range[i].high;
+
@@ -64,7 +71,7 @@
+ memset(req.qos_map + low, i, high - low + 1);
+ }
+
-+ for (i = 0; i < qos_map->num_des; ++i) {
++ for (i = 0; i < usr_qos_map->num_des; ++i) {
+ u8 dscp = exception[i].dscp, up = exception[i].up;
+
+ if (dscp < IP_DSCP_NUM && up < IEEE80211_NUM_UPS)
@@ -79,7 +86,7 @@
static int
mt7915_set_radar_background(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef)
-@@ -1747,6 +1790,7 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1751,6 +1801,7 @@ const struct ieee80211_ops mt7915_ops = {
.add_twt_setup = mt7915_mac_add_twt_setup,
.twt_teardown_request = mt7915_twt_teardown_request,
.set_frag_threshold = mt7915_set_frag_threshold,
@@ -88,5 +95,5 @@
CFG80211_TESTMODE_DUMP(mt76_testmode_dump)
#ifdef CONFIG_MAC80211_DEBUGFS
--
-2.18.0
+2.45.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0019-wifi-mt76-mt7915-adjust-rx-filter.patch b/recipes-wifi/linux-mt76/files/patches/0019-wifi-mt76-mt7915-adjust-rx-filter.patch
index beeeaf9..aebc44f 100644
--- a/recipes-wifi/linux-mt76/files/patches/0019-wifi-mt76-mt7915-adjust-rx-filter.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0019-wifi-mt76-mt7915-adjust-rx-filter.patch
@@ -1,4 +1,4 @@
-From 304c98810a9e68eccae433c570d1fc7c1063a641 Mon Sep 17 00:00:00 2001
+From d189b10ff8b7cd3d6fdabde17e8476bfe66466cc Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Fri, 19 Apr 2024 15:43:23 +0800
Subject: [PATCH 19/21] wifi: mt76: mt7915: adjust rx filter
@@ -13,7 +13,7 @@
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/mt7915/main.c b/mt7915/main.c
-index c6880ca..3783849 100644
+index 3a8b9404..0d2614e1 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -489,7 +489,8 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
diff --git a/recipes-wifi/linux-mt76/files/patches/0020-wifi-mt76-mt7915-add-additional-chain-signal-info-to.patch b/recipes-wifi/linux-mt76/files/patches/0020-wifi-mt76-mt7915-add-additional-chain-signal-info-to.patch
index 76573f5..7b3b464 100644
--- a/recipes-wifi/linux-mt76/files/patches/0020-wifi-mt76-mt7915-add-additional-chain-signal-info-to.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0020-wifi-mt76-mt7915-add-additional-chain-signal-info-to.patch
@@ -1,4 +1,4 @@
-From 6fb263d127c9ef802b4256e95ccea2d2faa047b4 Mon Sep 17 00:00:00 2001
+From cab458a1d2d91784aa28bacfd0b6649fd5c3f740 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 20 Sep 2023 11:10:57 +0800
Subject: [PATCH 20/21] wifi: mt76: mt7915: add additional chain signal info to
@@ -10,7 +10,7 @@
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 4604a68..95c794a 100644
+index 4604a682..95c794a3 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -437,7 +437,7 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb,
diff --git a/recipes-wifi/linux-mt76/files/patches/0021-wifi-mt76-mt7915-remove-unnecessary-register-setting.patch b/recipes-wifi/linux-mt76/files/patches/0021-wifi-mt76-mt7915-remove-unnecessary-register-setting.patch
index 1f9d540..b318b8c 100644
--- a/recipes-wifi/linux-mt76/files/patches/0021-wifi-mt76-mt7915-remove-unnecessary-register-setting.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0021-wifi-mt76-mt7915-remove-unnecessary-register-setting.patch
@@ -1,7 +1,8 @@
-From 1af0fe3345f26594c78e91681997ad3a1838fc7c Mon Sep 17 00:00:00 2001
+From 9976288a87664bacf514902869be38215da1d8b1 Mon Sep 17 00:00:00 2001
From: Henry Yen <henry.yen@mediatek.com>
Date: Wed, 6 Mar 2024 12:42:06 +0800
-Subject: [PATCH] wifi: mt76: mt7915: remove unnecessary register settings
+Subject: [PATCH 21/21] wifi: mt76: mt7915: remove unnecessary register
+ settings
Remove unnecessary register settings from the driver layer,
and let firmware take over the configuration control.
@@ -13,10 +14,10 @@
2 files changed, 1 insertion(+), 72 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 19a68c5..15ae27a 100644
+index 470b198a..84c69a88 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -475,30 +475,6 @@ mt7915_mac_init_band(struct mt7915_dev *dev, u8 band)
+@@ -476,30 +476,6 @@ mt7915_mac_init_band(struct mt7915_dev *dev, u8 band)
{
u32 mask, set;
@@ -47,7 +48,7 @@
/* mt7915: disable rx rate report by default due to hw issues */
mt76_clear(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN);
-@@ -601,23 +577,17 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
+@@ -602,23 +578,17 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
void mt7915_mac_init(struct mt7915_dev *dev)
{
int i;
@@ -72,7 +73,7 @@
mt7915_mac_wtbl_update(dev, i,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 95c794a..1c5ab41 100644
+index 95c794a3..1c5ab41f 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1149,61 +1149,20 @@ void mt7915_mac_reset_counters(struct mt7915_phy *phy)
diff --git a/recipes-wifi/linux-mt76/files/patches/0022-wifi-mt76-mt7915-add-PID-to-only-report-data-frame-T.patch b/recipes-wifi/linux-mt76/files/patches/0022-wifi-mt76-mt7915-add-PID-to-only-report-data-frame-T.patch
new file mode 100644
index 0000000..a7bd453
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0022-wifi-mt76-mt7915-add-PID-to-only-report-data-frame-T.patch
@@ -0,0 +1,115 @@
+From 15d44f1c050949ec23da85167bef1163b4a8ddf2 Mon Sep 17 00:00:00 2001
+From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+Date: Fri, 2 Aug 2024 14:22:45 +0800
+Subject: [PATCH] wifi: mt76: mt7915: add PID to only report data-frame TX rate
+
+According to definition of NL80211_STA_INFO_RX_BITRATE, mac80211 implicitly only expects data-frame rates to be reported.
+In MT76, TX rate is updated using TXS, and PID in TXS is possibly useful for distinguishing between data and management frames.
+Originally, MT_PACKET_ID_NO_SKB was used for data frames (when WED is disabled) and some management frames.
+In order to differentiate between them, MT_PACKET_ID_SW_DATA is added.
+And TX rate is updated only when TXS is associated with either SW-path or HW-path data frame.
+
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt76.h | 3 ++-
+ mt76_connac.h | 2 +-
+ mt76_connac_mac.c | 7 +++++--
+ mt7915/mac.c | 2 +-
+ tx.c | 9 ++++-----
+ 5 files changed, 13 insertions(+), 10 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index 05ee568..bdc9a9b 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -443,7 +443,8 @@ struct mt76_rx_tid {
+ #define MT_PACKET_ID_NO_ACK 0
+ #define MT_PACKET_ID_NO_SKB 1
+ #define MT_PACKET_ID_WED 2
+-#define MT_PACKET_ID_FIRST 3
++#define MT_PACKET_ID_SW_DATA 3
++#define MT_PACKET_ID_FIRST 4
+ #define MT_PACKET_ID_HAS_RATE BIT(7)
+ /* This is timer for when to give up when waiting for TXS callback,
+ * with starting time being the time at which the DMA_DONE callback
+diff --git a/mt76_connac.h b/mt76_connac.h
+index 5028e49..355b506 100644
+--- a/mt76_connac.h
++++ b/mt76_connac.h
+@@ -436,7 +436,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,
+ struct ieee80211_vif *vif,
+ bool beacon, bool mcast);
+ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
+- __le32 *txs_data);
++ int pid, __le32 *txs_data);
+ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
+ int pid, __le32 *txs_data);
+ void mt76_connac2_mac_decode_he_radiotap(struct mt76_dev *dev,
+diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
+index 170ef36..4d24cc6 100644
+--- a/mt76_connac_mac.c
++++ b/mt76_connac_mac.c
+@@ -594,7 +594,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
+ EXPORT_SYMBOL_GPL(mt76_connac2_mac_write_txwi);
+
+ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
+- __le32 *txs_data)
++ int pid, __le32 *txs_data)
+ {
+ struct mt76_sta_stats *stats = &wcid->stats;
+ struct ieee80211_supported_band *sband;
+@@ -628,6 +628,9 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
+ }
+ }
+
++ if (pid != MT_PACKET_ID_WED && pid != MT_PACKET_ID_SW_DATA)
++ return true;
++
+ txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
+
+ rate.mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
+@@ -737,7 +740,7 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
+ !!(info->flags & IEEE80211_TX_STAT_ACK);
+ info->status.rates[0].idx = -1;
+
+- mt76_connac2_mac_fill_txs(dev, wcid, txs_data);
++ mt76_connac2_mac_fill_txs(dev, wcid, pid, txs_data);
+ mt76_tx_status_skb_done(dev, skb, &list);
+ }
+ mt76_tx_status_unlock(dev, &list);
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index 1c5ab41..9c56f10 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -1023,7 +1023,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
+ msta = container_of(wcid, struct mt7915_sta, wcid);
+
+ if (le32_get_bits(txs_data[0], MT_TXS0_TXS_FORMAT) == MT_TXS_PPDU_FMT)
+- mt76_connac2_mac_fill_txs(&dev->mt76, wcid, txs_data);
++ mt76_connac2_mac_fill_txs(&dev->mt76, wcid, pid, txs_data);
+ else
+ mt76_connac2_mac_add_txs_skb(&dev->mt76, wcid, pid, txs_data);
+
+diff --git a/tx.c b/tx.c
+index 0fdf7d8..d6054ab 100644
+--- a/tx.c
++++ b/tx.c
+@@ -136,11 +136,10 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
+
+ if (!(info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
+ IEEE80211_TX_CTL_RATE_CTRL_PROBE))) {
+- if (mtk_wed_device_active(&dev->mmio.wed) &&
+- ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
+- ieee80211_is_data(hdr->frame_control)))
+- return MT_PACKET_ID_WED;
+-
++ if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP ||
++ ieee80211_is_data(hdr->frame_control))
++ return mtk_wed_device_active(&dev->mmio.wed) ? MT_PACKET_ID_WED
++ : MT_PACKET_ID_SW_DATA;
+ return MT_PACKET_ID_NO_SKB;
+ }
+
+--
+2.45.2
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0999-wifi-mt76-mt7915-build-pass-for-Linux-Kernel-5.4-fix.patch b/recipes-wifi/linux-mt76/files/patches/0999-wifi-mt76-mt7915-build-pass-for-Linux-Kernel-5.4-fix.patch
index 53a0fc9..1f9477c 100644
--- a/recipes-wifi/linux-mt76/files/patches/0999-wifi-mt76-mt7915-build-pass-for-Linux-Kernel-5.4-fix.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0999-wifi-mt76-mt7915-build-pass-for-Linux-Kernel-5.4-fix.patch
@@ -1,7 +1,7 @@
-From e3da91079dacc07f8e011f4b469e70bd78a93636 Mon Sep 17 00:00:00 2001
+From 4cdf382808962e209db2575b74d5fde2d2e7ac72 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Sat, 1 Apr 2023 08:18:17 +0800
-Subject: [PATCH 0999/1051] wifi: mt76: mt7915: build pass for Linux Kernel 5.4
+Subject: [PATCH 0999/1052] wifi: mt76: mt7915: build pass for Linux Kernel 5.4
fixes
---
@@ -23,7 +23,7 @@
15 files changed, 123 insertions(+), 232 deletions(-)
diff --git a/debugfs.c b/debugfs.c
-index c4649ba..1c8328d 100644
+index c4649ba0..1c8328d5 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -33,8 +33,10 @@ mt76_napi_threaded_set(void *data, u64 val)
@@ -38,7 +38,7 @@
return 0;
}
diff --git a/dma.c b/dma.c
-index f4f88c4..ccdd564 100644
+index f4f88c44..ccdd5646 100644
--- a/dma.c
+++ b/dma.c
@@ -178,7 +178,7 @@ mt76_free_pending_rxwi(struct mt76_dev *dev)
@@ -240,7 +240,7 @@
if (mtk_wed_device_active(&dev->mmio.wed))
diff --git a/dma.h b/dma.h
-index 1de5a2b..619dc0f 100644
+index 1de5a2b2..619dc0fe 100644
--- a/dma.h
+++ b/dma.h
@@ -79,8 +79,7 @@ enum mt76_dma_wed_ind_reason {
@@ -254,7 +254,7 @@
bool reset_idx);
void mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q);
diff --git a/eeprom.c b/eeprom.c
-index ecd09c0..a267397 100644
+index ecd09c03..a2673978 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -163,9 +163,15 @@ void
@@ -275,10 +275,10 @@
if (!is_valid_ether_addr(phy->macaddr)) {
eth_random_addr(phy->macaddr);
diff --git a/mac80211.c b/mac80211.c
-index bc20f60..b30a74e 100644
+index aee6f1e7..4d50bfae 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -577,47 +577,6 @@ void mt76_unregister_phy(struct mt76_phy *phy)
+@@ -578,47 +578,6 @@ void mt76_unregister_phy(struct mt76_phy *phy)
}
EXPORT_SYMBOL_GPL(mt76_unregister_phy);
@@ -326,7 +326,7 @@
struct mt76_dev *
mt76_alloc_device(struct device *pdev, unsigned int size,
const struct ieee80211_ops *ops,
-@@ -1817,21 +1776,6 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
+@@ -1818,21 +1777,6 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
}
EXPORT_SYMBOL_GPL(mt76_ethtool_worker);
@@ -349,7 +349,7 @@
{
struct ieee80211_hw *hw = phy->hw;
diff --git a/mcu.c b/mcu.c
-index a8cafa3..fa4b054 100644
+index a8cafa39..fa4b0544 100644
--- a/mcu.c
+++ b/mcu.c
@@ -4,6 +4,7 @@
@@ -361,7 +361,7 @@
struct sk_buff *
__mt76_mcu_msg_alloc(struct mt76_dev *dev, const void *data,
diff --git a/mt76.h b/mt76.h
-index b83456b..a07c7df 100644
+index 05ee568c..063fc364 100644
--- a/mt76.h
+++ b/mt76.h
@@ -15,11 +15,6 @@
@@ -393,7 +393,7 @@
void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
struct mt76_sta_stats *stats, bool eht);
int mt76_skb_adjust_pad(struct sk_buff *skb, int pad);
-@@ -1673,25 +1667,6 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
+@@ -1685,25 +1679,6 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
struct mt76_txwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
struct mt76_txwi_cache *r, dma_addr_t phys);
@@ -420,7 +420,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index ae34d01..c9444c6 100644
+index c807bd8d..a9310660 100644
--- a/mt7615/mcu.c
+++ b/mt7615/mcu.c
@@ -10,6 +10,7 @@
@@ -432,7 +432,7 @@
static bool prefer_offload_fw = true;
module_param(prefer_offload_fw, bool, 0644);
diff --git a/mt76_connac.h b/mt76_connac.h
-index 4871857..8e7068c 100644
+index 5028e49a..5356c52c 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -56,7 +56,6 @@ enum {
@@ -452,7 +452,7 @@
if (chandef->width >= ARRAY_SIZE(width_to_bw))
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 1ea9798..a8f097d 100644
+index 4baaaacf..4e84f8d2 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -4,6 +4,7 @@
@@ -524,10 +524,10 @@
#define DEFAULT_HE_DURATION_RTS_THRES 1023
static void
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 0936c1c..99cdd1b 100644
+index e0255a23..abc57f18 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1985,12 +1985,8 @@ void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
+@@ -1992,12 +1992,8 @@ void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
const struct ieee80211_sta_he_cap *
mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
@@ -541,7 +541,7 @@
int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
struct mt76_connac_sta_key_conf *sta_key_conf,
diff --git a/mt7915/main.c b/mt7915/main.c
-index 3783849..1da1d32 100644
+index 0d2614e1..a3facc9a 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1440,22 +1440,20 @@ void mt7915_get_et_strings(struct ieee80211_hw *hw,
@@ -599,7 +599,7 @@
static void
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 64d2710..91a1031 100644
+index 9126e62f..34323577 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -6,6 +6,7 @@
@@ -611,10 +611,10 @@
#define fw_name(_dev, name, ...) ({ \
char *_fw; \
diff --git a/usb.c b/usb.c
-index dc690d1..058f2d1 100644
+index 58ff0682..0ca3b069 100644
--- a/usb.c
+++ b/usb.c
-@@ -319,27 +319,29 @@ mt76u_set_endpoints(struct usb_interface *intf,
+@@ -318,27 +318,29 @@ mt76u_set_endpoints(struct usb_interface *intf,
static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
@@ -649,7 +649,7 @@
urb->num_sgs = i;
}
-@@ -352,16 +354,15 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
+@@ -351,16 +353,15 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
static int
mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
@@ -669,7 +669,7 @@
return urb->transfer_buffer ? 0 : -ENOMEM;
}
-@@ -399,7 +400,7 @@ mt76u_rx_urb_alloc(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -398,7 +399,7 @@ mt76u_rx_urb_alloc(struct mt76_dev *dev, struct mt76_queue *q,
if (err)
return err;
@@ -678,7 +678,7 @@
}
static void mt76u_urb_free(struct urb *urb)
-@@ -407,10 +408,10 @@ static void mt76u_urb_free(struct urb *urb)
+@@ -406,10 +407,10 @@ static void mt76u_urb_free(struct urb *urb)
int i;
for (i = 0; i < urb->num_sgs; i++)
@@ -691,7 +691,7 @@
usb_free_urb(urb);
}
-@@ -546,8 +547,6 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb,
+@@ -545,8 +546,6 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb,
len -= data_len;
nsgs++;
}
@@ -700,7 +700,7 @@
dev->drv->rx_skb(dev, MT_RXQ_MAIN, skb, NULL);
return nsgs;
-@@ -613,7 +612,7 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -612,7 +611,7 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
count = mt76u_process_rx_entry(dev, urb, q->buf_size);
if (count > 0) {
@@ -709,7 +709,7 @@
if (err < 0)
break;
}
-@@ -664,10 +663,6 @@ mt76u_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid)
+@@ -663,10 +662,6 @@ mt76u_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid)
struct mt76_queue *q = &dev->q_rx[qid];
int i, err;
@@ -720,7 +720,7 @@
spin_lock_init(&q->lock);
q->entry = devm_kcalloc(dev->dev,
MT_NUM_RX_ENTRIES, sizeof(*q->entry),
-@@ -696,6 +691,7 @@ EXPORT_SYMBOL_GPL(mt76u_alloc_mcu_queue);
+@@ -695,6 +690,7 @@ EXPORT_SYMBOL_GPL(mt76u_alloc_mcu_queue);
static void
mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
{
@@ -728,7 +728,7 @@
int i;
for (i = 0; i < q->ndesc; i++) {
-@@ -705,8 +701,13 @@ mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -704,8 +700,13 @@ mt76u_free_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
mt76u_urb_free(q->entry[i].urb);
q->entry[i].urb = NULL;
}
@@ -745,7 +745,7 @@
static void mt76u_free_rx(struct mt76_dev *dev)
diff --git a/wed.c b/wed.c
-index f89e453..f7a3f1b 100644
+index f89e4537..f7a3f1b3 100644
--- a/wed.c
+++ b/wed.c
@@ -9,8 +9,12 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch b/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch
index 646d0bf..2af1061 100644
--- a/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch
@@ -1,7 +1,8 @@
-From 57ca0074490c096cf61f5857ceb233f9a763cf82 Mon Sep 17 00:00:00 2001
+From 3f35505b3bbdfe9e381dbaa1c2450a7e7e461989 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 22 Jun 2022 10:39:47 +0800
-Subject: [PATCH] wifi: mt76: mt7915: add mtk internal debug tools for mt76
+Subject: [PATCH 01/70] wifi: mt76: mt7915: add mtk internal debug tools for
+ mt76
---
mt76_connac_mcu.h | 6 +
@@ -271,7 +272,7 @@
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index 417002f..4d8cb1c 100644
+index b19b433..aa4b3ae 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -73,7 +73,11 @@ int mt7915_run(struct ieee80211_hw *hw)
@@ -481,7 +482,7 @@
#endif
diff --git a/mt7915/mt7915_debug.h b/mt7915/mt7915_debug.h
new file mode 100644
-index 0000000..1ec8de9
+index 0000000..2f9f3da
--- /dev/null
+++ b/mt7915/mt7915_debug.h
@@ -0,0 +1,1442 @@
@@ -850,8 +851,8 @@
+ [DBG_PSE_FREEPG_CNT] = { DBG_INVALID_BASE, 0x380},
+ [DBG_PSE_FREEPG_HEAD_TAIL] = { DBG_INVALID_BASE, 0x384},
+ [DBG_PSE_HIF0_PG_INFO] = { DBG_INVALID_BASE, 0x150},
-+ [DBG_PSE_PG_HIF1_GROUP] = { DBG_INVALID_BASE, 0x154},
-+ [DBG_PSE_HIF1_PG_INFO] = { DBG_INVALID_BASE, 0x160},
++ [DBG_PSE_PG_HIF1_GROUP] = { DBG_INVALID_BASE, 0x114},
++ [DBG_PSE_HIF1_PG_INFO] = { DBG_INVALID_BASE, 0x154},
+ [DBG_PSE_PG_CPU_GROUP] = { DBG_INVALID_BASE, 0x118},
+ [DBG_PSE_CPU_PG_INFO] = { DBG_INVALID_BASE, 0x158},
+ [DBG_PSE_PG_PLE_GROUP] = { DBG_INVALID_BASE, 0x11c},
@@ -863,7 +864,7 @@
+ [DBG_PSE_PG_LMAC2_GROUP] = { DBG_INVALID_BASE, 0x12c},
+ [DBG_PSE_LMAC2_PG_INFO] = { DBG_INVALID_BASE, 0x16c},
+ [DBG_PSE_PG_LMAC3_GROUP] = { DBG_INVALID_BASE, 0x130},
-+ [DBG_PSE_LMAC3_PG_INFO] = { DBG_INVALID_BASE, 0x17c},
++ [DBG_PSE_LMAC3_PG_INFO] = { DBG_INVALID_BASE, 0x170},
+ [DBG_PSE_PG_MDP_GROUP] = { DBG_INVALID_BASE, 0x134},
+ [DBG_PSE_MDP_PG_INFO] = { DBG_INVALID_BASE, 0x174},
+ [DBG_PSE_PG_PLE1_GROUP] = { DBG_INVALID_BASE, 0x120},
@@ -1383,17 +1384,17 @@
+#define MT_DBG_PSE_MDP_PG_INFO_MDP_SRC_CNT_MASK GENMASK(27, 16)
+#define MT_DBG_PSE_MDP_PG_INFO_MDP_RSV_CNT_MASK GENMASK(11, 0)
+
-+#define MT_DBG_PSE_FL_QUE_CTRL_0_ADDR MT_DBG_PLE(0x1b0)
++#define MT_DBG_PSE_FL_QUE_CTRL_0_ADDR MT_DBG_PSE(0x1b0)
+#define MT_DBG_PSE_FL_QUE_CTRL_0_EXECUTE_MASK BIT(31)
+#define MT_DBG_PSE_FL_QUE_CTRL_0_Q_BUF_QID_SHFT 24
+#define MT_DBG_PSE_FL_QUE_CTRL_0_Q_BUF_PID_SHFT 10
+#define MT_DBG_PSE_FL_QUE_CTRL_0_Q_BUF_WLANID_MASK GENMASK(9, 0)
+
-+#define MT_DBG_PSE_FL_QUE_CTRL_2_ADDR MT_DBG_PLE(0x1b8)
++#define MT_DBG_PSE_FL_QUE_CTRL_2_ADDR MT_DBG_PSE(0x1b8)
+#define MT_DBG_PSE_FL_QUE_CTRL_2_QUEUE_TAIL_FID_MASK GENMASK(27, 16)
+#define MT_DBG_PSE_FL_QUE_CTRL_2_QUEUE_HEAD_FID_MASK GENMASK(11, 0)
+
-+#define MT_DBG_PSE_FL_QUE_CTRL_3_ADDR MT_DBG_PLE(0x1bc)
++#define MT_DBG_PSE_FL_QUE_CTRL_3_ADDR MT_DBG_PSE(0x1bc)
+#define MT_DBG_PSE_FL_QUE_CTRL_3_QUEUE_PKT_NUM_MASK GENMASK(11, 0)
+
+
@@ -1929,7 +1930,7 @@
+#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
new file mode 100644
-index 0000000..665d8bd
+index 0000000..06cedaa
--- /dev/null
+++ b/mt7915/mtk_debugfs.c
@@ -0,0 +1,3750 @@
@@ -3746,8 +3747,8 @@
+ rsv_pg = FIELD_GET(MT_DBG_PSE_LMAC1_PG_INFO_LMAC1_RSV_CNT_MASK, pg_flow_ctrl[11]);
+ used_pg = FIELD_GET(MT_DBG_PSE_LMAC1_PG_INFO_LMAC1_SRC_CNT_MASK, pg_flow_ctrl[11]);
+ seq_printf(s, "\t\tThe used/reserved pages of LMAC1 group=0x%03x/0x%03x\n", used_pg, rsv_pg);
-+ seq_printf(s, "\tReserved page counter of LMAC2 group(0x82068180): 0x%08x\n", pg_flow_ctrl[11]);
-+ seq_printf(s, "\tLMAC2 group page status(0x82068184): 0x%08x\n", pg_flow_ctrl[12]);
++ seq_printf(s, "\tReserved page counter of LMAC2 group(0x82068180): 0x%08x\n", pg_flow_ctrl[12]);
++ seq_printf(s, "\tLMAC2 group page status(0x82068184): 0x%08x\n", pg_flow_ctrl[13]);
+ min_q = FIELD_GET(MT_DBG_PSE_PG_LMAC2_GROUP_LMAC2_MIN_QUOTA_MASK, pg_flow_ctrl[12]);
+ max_q = FIELD_GET(MT_DBG_PSE_PG_LMAC2_GROUP_LMAC2_MAX_QUOTA_MASK, pg_flow_ctrl[12]);
+ seq_printf(s, "\t\tThe max/min quota pages of LMAC2 group=0x%03x/0x%03x\n", max_q, min_q);
@@ -3773,8 +3774,8 @@
+ used_pg = FIELD_GET(MT_DBG_PSE_PLE_PG_INFO_PLE_SRC_CNT_MASK, pg_flow_ctrl[15]);
+ seq_printf(s, "\t\tThe used/reserved pages of PLE group=0x%03x/0x%03x\n", used_pg, rsv_pg);
+
-+ seq_printf(s, "\tReserved page counter of PLE1 group(0x82068168): 0x%08x\n", pg_flow_ctrl[14]);
-+ seq_printf(s, "\tPLE1 group page status(0x8206816c): 0x%08x\n", pg_flow_ctrl[15]);
++ seq_printf(s, "\tReserved page counter of PLE1 group(0x82068168): 0x%08x\n", pg_flow_ctrl[20]);
++ seq_printf(s, "\tPLE1 group page status(0x8206816c): 0x%08x\n", pg_flow_ctrl[21]);
+ min_q = FIELD_GET(MT_DBG_PSE_PG_PLE_GROUP_PLE_MIN_QUOTA_MASK, pg_flow_ctrl[20]);
+ max_q = FIELD_GET(MT_DBG_PSE_PG_PLE_GROUP_PLE_MAX_QUOTA_MASK, pg_flow_ctrl[20]);
+ seq_printf(s, "\t\tThe max/min quota pages of PLE1 group=0x%03x/0x%03x\n", max_q, min_q);
@@ -4859,7 +4860,7 @@
+ struct mt76_dev *mdev = NULL;
+ int i;
+
-+ seq_printf(s, "Version: 2.2.24.5\n");
++ seq_printf(s, "Version: 2.2.24.7\n");
+
+ if (!test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
+ return 0;
@@ -5873,5 +5874,5 @@
return ret;
}
--
-2.18.0
+2.45.2
diff --git a/recipes-wifi/linux-mt76/files/patches/1001-wifi-mt76-mt7915-csi-implement-csi-support.patch b/recipes-wifi/linux-mt76/files/patches/1001-wifi-mt76-mt7915-csi-implement-csi-support.patch
index 115bb84..1e84172 100644
--- a/recipes-wifi/linux-mt76/files/patches/1001-wifi-mt76-mt7915-csi-implement-csi-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1001-wifi-mt76-mt7915-csi-implement-csi-support.patch
@@ -1,7 +1,7 @@
-From c5e9e8836065c1651ab7b84a0d30953c45c7a35d Mon Sep 17 00:00:00 2001
+From 594116fbcff4d30156c7207244633ad3c1bf9ec1 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 6 Jun 2022 20:13:02 +0800
-Subject: [PATCH] wifi: mt76: mt7915: csi: implement csi support
+Subject: [PATCH 1001/1052] wifi: mt76: mt7915: csi: implement csi support
---
mt76_connac_mcu.h | 2 +
@@ -19,10 +19,10 @@
create mode 100644 mt7915/vendor.h
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index a8690cd..cda7559 100644
+index 01d6598a..ad63596d 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1029,6 +1029,7 @@ enum {
+@@ -1030,6 +1030,7 @@ enum {
MCU_EXT_EVENT_WA_TX_STAT = 0x74,
MCU_EXT_EVENT_BCC_NOTIFY = 0x75,
MCU_EXT_EVENT_MURU_CTRL = 0x9f,
@@ -30,7 +30,7 @@
};
/* unified event table */
-@@ -1243,6 +1244,7 @@ enum {
+@@ -1245,6 +1246,7 @@ enum {
MCU_EXT_CMD_DPD_PRE_CAL_INFO = 0xac,
MCU_EXT_CMD_PHY_STAT_INFO = 0xad,
MCU_EXT_CMD_SET_QOS_MAP = 0xb4,
@@ -39,7 +39,7 @@
enum {
diff --git a/mt7915/Makefile b/mt7915/Makefile
-index fd71141..65129b4 100644
+index fd711416..65129b4f 100644
--- a/mt7915/Makefile
+++ b/mt7915/Makefile
@@ -1,10 +1,10 @@
@@ -56,7 +56,7 @@
mt7915e-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7915e-$(CONFIG_MT798X_WMAC) += soc.o
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 2661386..909df24 100644
+index 26613869..909df246 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1241,6 +1241,51 @@ mt7915_rf_regval_set(void *data, u64 val)
@@ -122,10 +122,10 @@
if (!ext_phy)
dev->debugfs_dir = dir;
diff --git a/mt7915/init.c b/mt7915/init.c
-index 19a68c5..1200405 100644
+index 84c69a88..ac15bc53 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -697,6 +697,14 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
+@@ -668,6 +668,14 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
/* init wiphy according to mphy and phy */
mt7915_init_wiphy(phy);
@@ -140,7 +140,7 @@
ret = mt76_register_phy(mphy, true, mt76_rates,
ARRAY_SIZE(mt76_rates));
if (ret)
-@@ -1178,6 +1186,28 @@ void mt7915_set_stream_he_caps(struct mt7915_phy *phy)
+@@ -1146,6 +1154,28 @@ void mt7915_set_stream_he_caps(struct mt7915_phy *phy)
}
}
@@ -169,7 +169,7 @@
static void mt7915_unregister_ext_phy(struct mt7915_dev *dev)
{
struct mt7915_phy *phy = mt7915_ext_phy(dev);
-@@ -1186,6 +1216,10 @@ static void mt7915_unregister_ext_phy(struct mt7915_dev *dev)
+@@ -1154,6 +1184,10 @@ static void mt7915_unregister_ext_phy(struct mt7915_dev *dev)
if (!phy)
return;
@@ -180,7 +180,7 @@
mt7915_unregister_thermal(phy);
mt76_unregister_phy(mphy);
ieee80211_free_hw(mphy->hw);
-@@ -1198,6 +1232,10 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev)
+@@ -1166,6 +1200,10 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev)
mt7915_dma_cleanup(dev);
tasklet_disable(&dev->mt76.irq_tasklet);
@@ -191,7 +191,7 @@
if (is_mt798x(&dev->mt76))
mt7986_wmac_disable(dev);
}
-@@ -1242,6 +1280,14 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1210,6 +1248,14 @@ int mt7915_register_device(struct mt7915_dev *dev)
dev->mt76.test_ops = &mt7915_testmode_ops;
#endif
@@ -207,7 +207,7 @@
ARRAY_SIZE(mt76_rates));
if (ret)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 5523031..f3c3b7e 100644
+index fc9a464a..12bb0b39 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -810,6 +810,19 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -231,7 +231,7 @@
mt7915_mcu_add_sta(dev, vif, sta, false);
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 37b1505..33dab71 100644
+index ff7f81b0..44765b1f 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -40,6 +40,10 @@ static bool sr_scene_detect = true;
@@ -459,7 +459,7 @@
int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3, bool wait_resp)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 9ae0f07..f32d525 100644
+index 9ae0f07a..f32d5256 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -604,4 +604,78 @@ mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
@@ -542,10 +542,10 @@
+
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index d2224dc..4696171 100644
+index 58c0bf99..1316f93d 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -197,6 +197,57 @@ struct mt7915_hif {
+@@ -195,6 +195,57 @@ struct mt7915_hif {
int irq;
};
@@ -603,7 +603,7 @@
struct mt7915_phy {
struct mt76_phy *mt76;
struct mt7915_dev *dev;
-@@ -245,6 +296,25 @@ struct mt7915_phy {
+@@ -243,6 +294,25 @@ struct mt7915_phy {
u8 spe_idx;
} test;
#endif
@@ -629,7 +629,7 @@
};
#ifdef MTK_DEBUG
-@@ -649,6 +719,14 @@ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -646,6 +716,14 @@ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
bool pci, int *irq);
@@ -646,7 +646,7 @@
int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3, bool wait_resp);
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
new file mode 100644
-index 0000000..0476202
+index 00000000..92496513
--- /dev/null
+++ b/mt7915/vendor.c
@@ -0,0 +1,606 @@
@@ -1258,7 +1258,7 @@
+}
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
new file mode 100644
-index 0000000..d2b90aa
+index 00000000..d2b90aa0
--- /dev/null
+++ b/mt7915/vendor.h
@@ -0,0 +1,75 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/1002-wifi-mt76-mt7915-air-monitor-support.patch b/recipes-wifi/linux-mt76/files/patches/1002-wifi-mt76-mt7915-air-monitor-support.patch
index 1bbc85f..06612ed 100644
--- a/recipes-wifi/linux-mt76/files/patches/1002-wifi-mt76-mt7915-air-monitor-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1002-wifi-mt76-mt7915-air-monitor-support.patch
@@ -1,7 +1,7 @@
-From 703dc34c3f03017062f03a74add408ece14914a9 Mon Sep 17 00:00:00 2001
+From 3ae462a794ae2a8b613c23aa6179cf5c7b2f7b3c Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Tue, 11 Jan 2022 12:03:23 +0800
-Subject: [PATCH] wifi: mt76: mt7915: air monitor support
+Subject: [PATCH 1002/1052] wifi: mt76: mt7915: air monitor support
---
mt76_connac_mcu.h | 2 +
@@ -13,10 +13,10 @@
6 files changed, 441 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index cda7559..3aa4e59 100644
+index ad63596d..cd6db774 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1243,6 +1243,8 @@ enum {
+@@ -1245,6 +1245,8 @@ enum {
MCU_EXT_CMD_GROUP_PRE_CAL_INFO = 0xab,
MCU_EXT_CMD_DPD_PRE_CAL_INFO = 0xac,
MCU_EXT_CMD_PHY_STAT_INFO = 0xad,
@@ -26,7 +26,7 @@
MCU_EXT_CMD_CSI_CTRL = 0xc2,
};
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index d99864f..e38905a 100644
+index 8268c19a..778f04f7 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -531,6 +531,10 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb,
@@ -41,7 +41,7 @@
status->flag |= RX_FLAG_8023;
mt7915_wed_check_ppe(dev, &dev->mt76.q_rx[q], msta, skb,
diff --git a/mt7915/main.c b/mt7915/main.c
-index f3c3b7e..707afcc 100644
+index 12bb0b39..aca3e9c0 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -800,6 +800,9 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -55,10 +55,10 @@
}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 4696171..1acf938 100644
+index 1316f93d..bb39a53a 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -234,6 +234,7 @@ struct csi_data {
+@@ -232,6 +232,7 @@ struct csi_data {
struct list_head node;
};
@@ -66,7 +66,7 @@
struct csi_mac_filter {
struct list_head node;
-@@ -246,6 +247,33 @@ struct csi_mac_filter {
+@@ -244,6 +245,33 @@ struct csi_mac_filter {
#define SHOW_CSI_MAC 2
#define MAX_CSI_MAC_NUM 10
@@ -100,7 +100,7 @@
#endif
struct mt7915_phy {
-@@ -314,6 +342,8 @@ struct mt7915_phy {
+@@ -312,6 +340,8 @@ struct mt7915_phy {
u32 interval;
u32 last_record;
} csi;
@@ -109,7 +109,7 @@
#endif
};
-@@ -725,6 +755,9 @@ int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
+@@ -722,6 +752,9 @@ int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
u8 cfg, u8 v1, u32 v2, u8 *mac_addr, u32 sta_interval);
struct csi_mac_filter *mt7915_csi_mac_filter_find(struct mt7915_phy *phy, u8 *addr);
void mt7915_csi_mac_filter_clear(struct mt7915_phy *phy);
@@ -120,7 +120,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 0476202..4c11ed1 100644
+index 92496513..fb32cd6d 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -584,6 +584,355 @@ out:
@@ -499,7 +499,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index d2b90aa..429b25b 100644
+index d2b90aa0..429b25b7 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -5,6 +5,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/1003-wifi-mt76-mt7915-add-support-for-muru_onoff-via.patch b/recipes-wifi/linux-mt76/files/patches/1003-wifi-mt76-mt7915-add-support-for-muru_onoff-via.patch
index 490e884..7bf27a4 100644
--- a/recipes-wifi/linux-mt76/files/patches/1003-wifi-mt76-mt7915-add-support-for-muru_onoff-via.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1003-wifi-mt76-mt7915-add-support-for-muru_onoff-via.patch
@@ -1,7 +1,7 @@
-From 76e8a5bbc80cf7612256c7783555bba11dbf5b8b Mon Sep 17 00:00:00 2001
+From 6ec4565becc5364a689b346496c7caaef98f83e9 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Tue, 4 Apr 2023 02:23:57 +0800
-Subject: [PATCH 1003/1051] wifi: mt76: mt7915: add support for muru_onoff via
+Subject: [PATCH 1003/1052] wifi: mt76: mt7915: add support for muru_onoff via
---
mt7915/init.c | 1 +
@@ -12,10 +12,10 @@
5 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 3f06360..6fa3a51 100644
+index ac15bc53..18c6ef7e 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -363,6 +363,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+@@ -364,6 +364,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
phy->slottime = 9;
@@ -24,7 +24,7 @@
hw->sta_data_size = sizeof(struct mt7915_sta);
hw->vif_data_size = sizeof(struct mt7915_vif);
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 3f35ba3..5aaa3f0 100644
+index 44765b1f..6867635f 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -965,6 +965,7 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
@@ -57,7 +57,7 @@
muru->mimo_dl.vht_mu_bfee =
!!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index f32d525..f44146e 100644
+index f32d5256..f44146ed 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -678,4 +678,10 @@ enum CSI_CHAIN_TYPE {
@@ -72,10 +72,10 @@
+
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 57a9da3..95722cb 100644
+index bb39a53a..14107de3 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -291,6 +291,8 @@ struct mt7915_phy {
+@@ -302,6 +302,8 @@ struct mt7915_phy {
u32 rx_ampdu_ts;
u32 ampdu_ref;
@@ -85,7 +85,7 @@
struct mt76_channel_state state_ts;
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 62d3a99..2f55a84 100644
+index 665d8bd4..0beb3644 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2554,6 +2554,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data)
diff --git a/recipes-wifi/linux-mt76/files/patches/1004-wifi-mt76-mt7915-certification-patches.patch b/recipes-wifi/linux-mt76/files/patches/1004-wifi-mt76-mt7915-certification-patches.patch
index b9fac6d..7024d1f 100644
--- a/recipes-wifi/linux-mt76/files/patches/1004-wifi-mt76-mt7915-certification-patches.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1004-wifi-mt76-mt7915-certification-patches.patch
@@ -1,7 +1,7 @@
-From 9196ca94b27491c6841a3a1a46afb8557f82e62d Mon Sep 17 00:00:00 2001
+From 230a5ba21216bb292f2fb1b0cf2236e2e14de2ca Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Mon, 6 Jun 2022 20:15:51 +0800
-Subject: [PATCH 1004/1051] wifi: mt76: mt7915: certification patches
+Subject: [PATCH 1004/1052] wifi: mt76: mt7915: certification patches
---
mt76_connac_mcu.h | 1 +
@@ -16,10 +16,10 @@
9 files changed, 955 insertions(+), 5 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 3aa4e59..d62b7df 100644
+index cd6db774..bd28cc50 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1246,6 +1246,7 @@ enum {
+@@ -1248,6 +1248,7 @@ enum {
/* for vendor csi and air monitor */
MCU_EXT_CMD_SMESH_CTRL = 0xae,
MCU_EXT_CMD_SET_QOS_MAP = 0xb4,
@@ -28,7 +28,7 @@
};
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 778f04f..2fd1d1f 100644
+index 778f04f7..2fd1d1fb 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -8,6 +8,7 @@
@@ -76,7 +76,7 @@
IEEE80211_RC_NSS_CHANGED |
IEEE80211_RC_BW_CHANGED))
diff --git a/mt7915/main.c b/mt7915/main.c
-index 9fd65f0..5c483b3 100644
+index aca3e9c0..09e1a83b 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -771,6 +771,9 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -107,7 +107,7 @@
void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 5aaa3f0..aaac73a 100644
+index 6867635f..c819a3be 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -4402,6 +4402,472 @@ mt7915_mcu_report_csi(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -584,7 +584,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index f44146e..eef2fc0 100644
+index f44146ed..eef2fc00 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -486,10 +486,14 @@ enum {
@@ -818,10 +818,10 @@
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 95722cb..ea309bf 100644
+index 14107de3..cf49ac86 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -735,6 +735,19 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -749,6 +749,19 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
bool pci, int *irq);
#ifdef CONFIG_MTK_VENDOR
@@ -842,7 +842,7 @@
int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
u8 cfg, u8 v1, u32 v2, u8 *mac_addr, u32 sta_interval);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 2f55a84..84f8fae 100644
+index 0beb3644..54daa736 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2560,7 +2560,8 @@ static int mt7915_muru_onoff_get(void *data, u64 *val)
@@ -867,11 +867,11 @@
}
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index c964b14..7a71894 100644
+index fb32cd6d..e4317af3 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -23,6 +23,29 @@ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
- [MTK_VENDOR_ATTR_CSI_CTRL_DATA] = { .type = NLA_NESTED },
+@@ -24,6 +24,29 @@ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
+ [MTK_VENDOR_ATTR_CSI_CTRL_DUMP_MAC_FILTER] = { .type = NLA_NESTED },
};
+static const struct nla_policy
@@ -900,7 +900,7 @@
struct csi_null_tone {
u8 start;
u8 end;
-@@ -797,6 +820,149 @@ mt7915_vendor_amnt_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+@@ -933,6 +956,149 @@ mt7915_vendor_amnt_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
return len + 1;
}
@@ -1050,7 +1050,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
.info = {
-@@ -821,6 +987,28 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -957,6 +1123,28 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.dumpit = mt7915_vendor_amnt_ctrl_dump,
.policy = amnt_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_AMNT_CTRL_MAX,
@@ -1080,7 +1080,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 1863eee..1a18cae 100644
+index 429b25b7..1a0139d7 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -7,6 +7,48 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/1005-wifi-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch b/recipes-wifi/linux-mt76/files/patches/1005-wifi-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
index 9eb1db4..d110348 100644
--- a/recipes-wifi/linux-mt76/files/patches/1005-wifi-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1005-wifi-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
@@ -1,7 +1,7 @@
-From 78cd3b046f6f037e2b78557860e8c14796c40a00 Mon Sep 17 00:00:00 2001
+From d6ae847c0cea20f781970198a2aed4dc7e4daffa Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Tue, 4 Apr 2023 02:27:44 +0800
-Subject: [PATCH 1005/1051] wifi: mt76: mt7915: add mt76 vendor muru onoff
+Subject: [PATCH 1005/1052] wifi: mt76: mt7915: add mt76 vendor muru onoff
command
---
@@ -12,7 +12,7 @@
4 files changed, 63 insertions(+)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index aaac73a..8bb7185 100644
+index c819a3be..cd5363c6 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -4422,6 +4422,13 @@ void mt7915_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -30,7 +30,7 @@
}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index eef2fc0..8650053 100644
+index eef2fc00..86500536 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -493,6 +493,7 @@ enum {
@@ -42,10 +42,10 @@
};
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7a71894..a8b1fa8 100644
+index e4317af3..cf09b513 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -35,6 +35,11 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
+@@ -36,6 +36,11 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT] = {.type = NLA_U8 },
};
@@ -57,7 +57,7 @@
static const struct nla_policy
rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
[MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_GI] = {.type = NLA_U8 },
-@@ -963,6 +968,33 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+@@ -1099,6 +1104,33 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
return 0;
}
@@ -91,7 +91,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
.info = {
-@@ -1009,6 +1041,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1145,6 +1177,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.doit = mt7915_vendor_wireless_ctrl,
.policy = wireless_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX,
@@ -110,7 +110,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 1a18cae..a4a9180 100644
+index 1a0139d7..9cb67551 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -9,6 +9,7 @@ enum mtk_nl80211_vendor_subcmds {
diff --git a/recipes-wifi/linux-mt76/files/patches/1006-wifi-mt76-mt7915-drop-undefined-action-frame.patch b/recipes-wifi/linux-mt76/files/patches/1006-wifi-mt76-mt7915-drop-undefined-action-frame.patch
index 5a66be9..0182c4f 100644
--- a/recipes-wifi/linux-mt76/files/patches/1006-wifi-mt76-mt7915-drop-undefined-action-frame.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1006-wifi-mt76-mt7915-drop-undefined-action-frame.patch
@@ -1,14 +1,14 @@
-From 2c33bfa0c261aaf9263bfef4b811a97bc72e20d5 Mon Sep 17 00:00:00 2001
+From d48d6a0643e5be590744db4173e14c87f4945390 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 14 Apr 2022 15:18:02 +0800
-Subject: [PATCH 1006/1051] wifi: mt76: mt7915: drop undefined action frame
+Subject: [PATCH 1006/1052] wifi: mt76: mt7915: drop undefined action frame
---
mt7915/mac.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 2fd1d1f..4177d6a 100644
+index 2fd1d1fb..4177d6a3 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -744,6 +744,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
diff --git a/recipes-wifi/linux-mt76/files/patches/1007-wifi-mt76-testmode-rework-testmode-init-registers.patch b/recipes-wifi/linux-mt76/files/patches/1007-wifi-mt76-testmode-rework-testmode-init-registers.patch
index fa485ce..0f0e9d5 100644
--- a/recipes-wifi/linux-mt76/files/patches/1007-wifi-mt76-testmode-rework-testmode-init-registers.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1007-wifi-mt76-testmode-rework-testmode-init-registers.patch
@@ -1,7 +1,7 @@
-From 2a6f2256321718cb48b28b0d1a6113dc195de03a Mon Sep 17 00:00:00 2001
+From bbbac8090c06fd110f3770d99e7993017101cfd0 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 6 Jun 2022 19:46:26 +0800
-Subject: [PATCH 1007/1051] wifi: mt76: testmode: rework testmode init
+Subject: [PATCH 1007/1052] wifi: mt76: testmode: rework testmode init
registers
---
@@ -18,10 +18,10 @@
10 files changed, 164 insertions(+), 35 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index b30a74e..3f5c2ed 100644
+index 4d50bfae..9ebb2746 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -804,7 +804,8 @@ void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
+@@ -805,7 +805,8 @@ void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
}
#ifdef CONFIG_NL80211_TESTMODE
@@ -32,7 +32,7 @@
if (status->flag & RX_FLAG_FAILED_FCS_CRC)
phy->test.rx_stats.fcs_error[q]++;
diff --git a/mt76.h b/mt76.h
-index a07c7df..fe5b136 100644
+index 063fc364..329e4d7a 100644
--- a/mt76.h
+++ b/mt76.h
@@ -709,6 +709,8 @@ struct mt76_testmode_ops {
@@ -62,10 +62,10 @@
};
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index d62b7df..22d477f 100644
+index bd28cc50..f5edeef6 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1239,6 +1239,7 @@ enum {
+@@ -1241,6 +1241,7 @@ enum {
MCU_EXT_CMD_OFFCH_SCAN_CTRL = 0x9a,
MCU_EXT_CMD_SET_RDD_TH = 0x9d,
MCU_EXT_CMD_MURU_CTRL = 0x9f,
@@ -74,7 +74,7 @@
MCU_EXT_CMD_GROUP_PRE_CAL_INFO = 0xab,
MCU_EXT_CMD_DPD_PRE_CAL_INFO = 0xac,
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 8650053..7653b5e 100644
+index 86500536..7653b5e2 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -9,6 +9,7 @@
@@ -86,7 +86,7 @@
MCU_ATE_CLEAN_TXQUEUE = 0x1c,
};
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6004d64..694fc1b 100644
+index d6ecd698..02b4714c 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -120,6 +120,7 @@ static const u32 mt7986_reg[] = {
@@ -106,7 +106,7 @@
[TMAC_ODTR] = 0x0cc,
[TMAC_ATCR] = 0x00c,
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 3452a7e..8bb6a9f 100644
+index 3452a7e9..8bb6a9f2 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -48,6 +48,7 @@ enum reg_rev {
@@ -154,7 +154,7 @@
#define MT_AGG_ACR0(_band) MT_WF_AGG(_band, __OFFS(AGG_ACR0))
#define MT_AGG_ACR_CFEND_RATE GENMASK(13, 0)
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 0d76ae3..4693919 100644
+index 0d76ae31..46939191 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -30,7 +30,7 @@ struct reg_band {
@@ -379,7 +379,7 @@
const struct mt76_testmode_ops mt7915_testmode_ops = {
diff --git a/mt7915/testmode.h b/mt7915/testmode.h
-index 5573ac3..a1c54c8 100644
+index 5573ac30..a1c54c89 100644
--- a/mt7915/testmode.h
+++ b/mt7915/testmode.h
@@ -33,6 +33,12 @@ struct mt7915_tm_clean_txq {
@@ -430,7 +430,7 @@
+
#endif
diff --git a/testmode.c b/testmode.c
-index ca4fecc..9e05b86 100644
+index ca4feccf..9e05b862 100644
--- a/testmode.c
+++ b/testmode.c
@@ -448,8 +448,7 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -454,7 +454,7 @@
return -EMSGSIZE;
diff --git a/testmode.h b/testmode.h
-index 5e2792d..8961326 100644
+index 5e2792d8..89613266 100644
--- a/testmode.h
+++ b/testmode.h
@@ -101,6 +101,8 @@ enum mt76_testmode_attr {
diff --git a/recipes-wifi/linux-mt76/files/patches/1008-wifi-mt76-testmode-additional-supports.patch b/recipes-wifi/linux-mt76/files/patches/1008-wifi-mt76-testmode-additional-supports.patch
index 4023904..470e6e4 100644
--- a/recipes-wifi/linux-mt76/files/patches/1008-wifi-mt76-testmode-additional-supports.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1008-wifi-mt76-testmode-additional-supports.patch
@@ -1,7 +1,7 @@
-From aba0454fa24cdc1f0650375d4e3264778c3756ab Mon Sep 17 00:00:00 2001
+From d2bc22b6da2b5bbc7d4c441a1a6b8c55c3fc7462 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 21 Apr 2022 15:43:19 +0800
-Subject: [PATCH 1008/1051] wifi: mt76: testmode: additional supports
+Subject: [PATCH 1008/1052] wifi: mt76: testmode: additional supports
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -29,7 +29,7 @@
20 files changed, 2073 insertions(+), 169 deletions(-)
diff --git a/dma.c b/dma.c
-index ccdd564..bc8afcf 100644
+index ccdd5646..bc8afcff 100644
--- a/dma.c
+++ b/dma.c
@@ -614,8 +614,7 @@ free:
@@ -43,7 +43,7 @@
#endif
diff --git a/mac80211.c b/mac80211.c
-index 3f5c2ed..305cae7 100644
+index 9ebb2746..d6b70374 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -55,6 +55,13 @@ static const struct ieee80211_channel mt76_channels_5ghz[] = {
@@ -73,7 +73,7 @@
static const struct ieee80211_channel mt76_channels_6ghz[] = {
diff --git a/mt76.h b/mt76.h
-index fe5b136..a7d424f 100644
+index 329e4d7a..62205051 100644
--- a/mt76.h
+++ b/mt76.h
@@ -707,6 +707,21 @@ struct mt76_testmode_ops {
@@ -246,7 +246,7 @@
static inline void mt76_testmode_reset(struct mt76_phy *phy, bool disable)
{
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index a8f097d..44cd646 100644
+index 4e84f8d2..2acd7efb 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -407,6 +407,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
@@ -268,10 +268,10 @@
return;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 22d477f..0f408d9 100644
+index f5edeef6..152b4aaa 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1023,6 +1023,7 @@ enum {
+@@ -1024,6 +1024,7 @@ enum {
MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13,
MCU_EXT_EVENT_THERMAL_PROTECT = 0x22,
MCU_EXT_EVENT_ASSERT_DUMP = 0x23,
@@ -279,7 +279,7 @@
MCU_EXT_EVENT_RDD_REPORT = 0x3a,
MCU_EXT_EVENT_CSA_NOTIFY = 0x4f,
MCU_EXT_EVENT_BSS_ACQ_PKT_CNT = 0x52,
-@@ -1246,6 +1247,7 @@ enum {
+@@ -1248,6 +1249,7 @@ enum {
MCU_EXT_CMD_PHY_STAT_INFO = 0xad,
/* for vendor csi and air monitor */
MCU_EXT_CMD_SMESH_CTRL = 0xae,
@@ -288,7 +288,7 @@
MCU_EXT_CMD_CERT_CFG = 0xb7,
MCU_EXT_CMD_CSI_CTRL = 0xc2,
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index bfdbc15..f4876fe 100644
+index bfdbc15a..f4876fe9 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
@@ -142,7 +142,7 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
@@ -301,10 +301,10 @@
return ret;
}
diff --git a/mt7915/init.c b/mt7915/init.c
-index 6fa3a51..0994b8a 100644
+index 18c6ef7e..0c58ab7b 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -692,7 +692,7 @@ static void mt7915_init_work(struct work_struct *work)
+@@ -700,7 +700,7 @@ static void mt7915_init_work(struct work_struct *work)
struct mt7915_dev *dev = container_of(work, struct mt7915_dev,
init_work);
@@ -314,7 +314,7 @@
mt7915_txbf_init(dev);
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 4177d6a..b05e163 100644
+index 4177d6a3..b05e1630 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -586,6 +586,7 @@ mt7915_mac_fill_rx_vector(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -404,7 +404,7 @@
goto out;
diff --git a/mt7915/main.c b/mt7915/main.c
-index 5c483b3..aebfda8 100644
+index 09e1a83b..2e566710 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -238,7 +238,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
@@ -417,7 +417,7 @@
mvif->mt76.wmm_idx += 2;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 8bb7185..8e3ae93 100644
+index cd5363c6..b5177e30 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -478,6 +478,11 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -498,7 +498,7 @@
return 0;
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 7653b5e..c791c7f 100644
+index 7653b5e2..c791c7fa 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -8,10 +8,15 @@
@@ -556,7 +556,7 @@
enum {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 694fc1b..222e2cf 100644
+index 02b4714c..730cd338 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -134,6 +134,7 @@ static const u32 mt7915_offs[] = {
@@ -576,10 +576,10 @@
[AGG_PCR0] = 0x040,
[AGG_ACR0] = 0x054,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index ea309bf..9cc7f3a 100644
+index cf49ac86..bc77a61a 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -306,11 +306,15 @@ struct mt7915_phy {
+@@ -317,11 +317,15 @@ struct mt7915_phy {
s32 last_freq_offset;
u8 last_rcpi[4];
@@ -595,7 +595,7 @@
} test;
#endif
-@@ -423,6 +427,14 @@ struct mt7915_dev {
+@@ -438,6 +442,14 @@ struct mt7915_dev {
void __iomem *dcm;
void __iomem *sku;
@@ -610,7 +610,7 @@
#ifdef MTK_DEBUG
u16 wlan_idx;
struct {
-@@ -603,8 +615,8 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
+@@ -618,8 +630,8 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
void *data, u32 field);
@@ -621,16 +621,16 @@
int mt7915_mcu_get_eeprom_free_block(struct mt7915_dev *dev, u8 *block_num);
int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
bool hdr_trans);
-@@ -643,6 +655,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
+@@ -658,6 +670,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb);
void mt7915_mcu_exit(struct mt7915_dev *dev);
+int mt7915_tm_txbf_status_read(struct mt7915_dev *dev, struct sk_buff *skb);
void mt7915_mcu_wmm_pbc_work(struct work_struct *work);
- int mt7915_mcu_set_qos_map(struct mt7915_dev *dev, struct ieee80211_vif *vif);
+ static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev)
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 8bb6a9f..1236da9 100644
+index 8bb6a9f2..1236da91 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -62,6 +62,7 @@ enum offs_rev {
@@ -651,7 +651,7 @@
(_n) * 4))
#define MT_AGG_PCR0(_band, _n) MT_WF_AGG(_band, (__OFFS(AGG_PCR0) + \
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 4693919..32dc85c 100644
+index 46939191..32dc85cd 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -9,6 +9,10 @@
@@ -2111,7 +2111,7 @@
+ .set_eeprom = mt7915_tm_set_eeprom,
};
diff --git a/mt7915/testmode.h b/mt7915/testmode.h
-index a1c54c8..eb0e043 100644
+index a1c54c89..eb0e0432 100644
--- a/mt7915/testmode.h
+++ b/mt7915/testmode.h
@@ -4,6 +4,8 @@
@@ -2426,7 +2426,7 @@
+
#endif
diff --git a/testmode.c b/testmode.c
-index 9e05b86..7587047 100644
+index 9e05b862..75870478 100644
--- a/testmode.c
+++ b/testmode.c
@@ -8,6 +8,7 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
@@ -2919,7 +2919,7 @@
if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER)) {
diff --git a/testmode.h b/testmode.h
-index 8961326..7a68625 100644
+index 89613266..7a686250 100644
--- a/testmode.h
+++ b/testmode.h
@@ -6,6 +6,8 @@
@@ -3056,7 +3056,7 @@
+
#endif
diff --git a/tools/fields.c b/tools/fields.c
-index e3f6908..406ba77 100644
+index e3f69089..406ba77c 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -10,6 +10,7 @@ static const char * const testmode_state[] = {
@@ -3235,7 +3235,7 @@
};
diff --git a/tx.c b/tx.c
-index 0fdf7d8..db0d4df 100644
+index 0fdf7d83..db0d4df5 100644
--- a/tx.c
+++ b/tx.c
@@ -259,8 +259,7 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *
diff --git a/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-add-pre-cal-support.patch b/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-add-pre-cal-support.patch
index 4a716f1..991c4e4 100644
--- a/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-add-pre-cal-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-add-pre-cal-support.patch
@@ -1,7 +1,7 @@
-From 9d04f2c9a6204160cf75dbd1970dee1db3b75d01 Mon Sep 17 00:00:00 2001
+From fbbb77d3e06f0dd3f4ed27e8bb5ff113fe3c77fc Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 31 Aug 2022 20:06:52 +0800
-Subject: [PATCH] wifi: mt76: testmode: add pre-cal support
+Subject: [PATCH 1009/1052] wifi: mt76: testmode: add pre-cal support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -18,7 +18,7 @@
10 files changed, 507 insertions(+), 6 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index a267397..3625b16 100644
+index a2673978..3625b169 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -94,8 +94,10 @@ int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int l
@@ -35,7 +35,7 @@
out_put_node:
diff --git a/mt76.h b/mt76.h
-index a7d424f..20577af 100644
+index 62205051..d8c2a515 100644
--- a/mt76.h
+++ b/mt76.h
@@ -708,6 +708,7 @@ struct mt76_testmode_ops {
@@ -47,10 +47,10 @@
struct mt76_testmode_entry_data {
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 0972010..b75d340 100644
+index 152b4aaa..cf88b674 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1019,6 +1019,7 @@ enum {
+@@ -1020,6 +1020,7 @@ enum {
/* ext event table */
enum {
@@ -59,7 +59,7 @@
MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13,
MCU_EXT_EVENT_THERMAL_PROTECT = 0x22,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 233411c..ad58e3b 100644
+index b5177e30..d4291e24 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -482,6 +482,9 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -73,10 +73,10 @@
case MCU_EXT_EVENT_BSS_ACQ_PKT_CNT:
mt7915_mcu_rx_bss_acq_pkt_cnt(dev, skb);
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 1846e2f..dd2e80b 100644
+index bc77a61a..ca385b66 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -654,6 +654,7 @@ int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
+@@ -671,6 +671,7 @@ int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb);
void mt7915_mcu_exit(struct mt7915_dev *dev);
int mt7915_tm_txbf_status_read(struct mt7915_dev *dev, struct sk_buff *skb);
@@ -85,7 +85,7 @@
static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev)
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 32dc85c..4b34430 100644
+index 32dc85cd..4b344303 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -5,6 +5,7 @@
@@ -560,7 +560,7 @@
+ .dump_precal = mt7915_tm_dump_precal,
};
diff --git a/mt7915/testmode.h b/mt7915/testmode.h
-index eb0e043..7569826 100644
+index eb0e0432..75698261 100644
--- a/mt7915/testmode.h
+++ b/mt7915/testmode.h
@@ -81,6 +81,11 @@ struct tm_tx_cont {
@@ -628,7 +628,7 @@
TAM_ARB_OP_MODE_NORMAL = 1,
TAM_ARB_OP_MODE_TEST,
diff --git a/testmode.c b/testmode.c
-index 7587047..132267e 100644
+index 75870478..132267eb 100644
--- a/testmode.c
+++ b/testmode.c
@@ -771,6 +771,18 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
@@ -661,7 +661,7 @@
(nla_put_string(msg, MT76_TM_ATTR_MTD_PART, dev->test_mtd.name) ||
nla_put_u32(msg, MT76_TM_ATTR_MTD_OFFSET, dev->test_mtd.offset)))
diff --git a/testmode.h b/testmode.h
-index 7a68625..e4c1b52 100644
+index 7a686250..e4c1b521 100644
--- a/testmode.h
+++ b/testmode.h
@@ -19,6 +19,7 @@
@@ -717,7 +717,7 @@
/* keep last */
diff --git a/tools/fields.c b/tools/fields.c
-index 406ba77..27801db 100644
+index 406ba77c..27801dbe 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -11,6 +11,14 @@ static const char * const testmode_state[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches/1010-wifi-mt76-testmode-add-iBF-command-mode-support.patch b/recipes-wifi/linux-mt76/files/patches/1010-wifi-mt76-testmode-add-iBF-command-mode-support.patch
index 7713db3..edbae40 100644
--- a/recipes-wifi/linux-mt76/files/patches/1010-wifi-mt76-testmode-add-iBF-command-mode-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1010-wifi-mt76-testmode-add-iBF-command-mode-support.patch
@@ -1,7 +1,7 @@
-From ccf1ac17ba7b6c4cabe8f4e6557a57f66e9fbc7b Mon Sep 17 00:00:00 2001
+From a78a0de5858eba651ca9630dc8970c947b190b28 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 12 Sep 2022 18:16:54 +0800
-Subject: [PATCH 1010/1051] wifi: mt76: testmode: add iBF command mode support
+Subject: [PATCH 1010/1052] wifi: mt76: testmode: add iBF command mode support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -12,7 +12,7 @@
4 files changed, 85 insertions(+), 7 deletions(-)
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 4b34430..453319e 100644
+index 4b344303..453319e1 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -722,6 +722,7 @@ mt7915_tm_txbf_profile_update(struct mt7915_phy *phy, u16 *val, bool ebf)
@@ -104,7 +104,7 @@
mt7915_tm_set_tx_len(phy, tx_time);
diff --git a/testmode.c b/testmode.c
-index 070b296..b1986ad 100644
+index 132267eb..06b10a36 100644
--- a/testmode.c
+++ b/testmode.c
@@ -535,6 +535,42 @@ out:
@@ -163,7 +163,7 @@
nla_for_each_nested(cur, tb[MT76_TM_ATTR_TXBF_PARAM], rem) {
if (nla_len(cur) != 2 ||
diff --git a/testmode.h b/testmode.h
-index e4c1b52..1d7aef8 100644
+index e4c1b521..1d7aef86 100644
--- a/testmode.h
+++ b/testmode.h
@@ -285,8 +285,10 @@ enum mt76_testmode_txbf_act {
@@ -178,7 +178,7 @@
/* keep last */
diff --git a/tools/fields.c b/tools/fields.c
-index 27801db..b0ee84d 100644
+index 27801dbe..b0ee84d2 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -32,6 +32,20 @@ static const char * const testmode_tx_mode[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches/1011-wifi-mt76-testmode-add-ZWDFS-test-mode-support.patch b/recipes-wifi/linux-mt76/files/patches/1011-wifi-mt76-testmode-add-ZWDFS-test-mode-support.patch
index 3c95bdb..056c2b1 100644
--- a/recipes-wifi/linux-mt76/files/patches/1011-wifi-mt76-testmode-add-ZWDFS-test-mode-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1011-wifi-mt76-testmode-add-ZWDFS-test-mode-support.patch
@@ -1,7 +1,7 @@
-From d1999bcb10d6f3b0d97bad2ba47ea3bae1b38a52 Mon Sep 17 00:00:00 2001
+From 12f1e58ae28f7e12f298d213a0cfe13b751082df Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 27 Oct 2022 17:42:07 +0800
-Subject: [PATCH] wifi: mt76: testmode: add ZWDFS test mode support
+Subject: [PATCH 1011/1052] wifi: mt76: testmode: add ZWDFS test mode support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -18,7 +18,7 @@
10 files changed, 508 insertions(+), 1 deletion(-)
diff --git a/mt76.h b/mt76.h
-index 5dfae96..65ec039 100644
+index d8c2a515..15106812 100644
--- a/mt76.h
+++ b/mt76.h
@@ -793,6 +793,15 @@ struct mt76_testmode_data {
@@ -38,7 +38,7 @@
struct mt76_vif {
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 6060eec..09d41b5 100644
+index cf88b674..40fa9fc8 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1243,6 +1243,7 @@ enum {
@@ -58,7 +58,7 @@
enum {
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 17a23e3..3ba91a6 100644
+index d4291e24..500ecbbb 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2759,6 +2759,7 @@ mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy,
@@ -139,7 +139,7 @@
+ return 0;
+}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index c791c7f..066246b 100644
+index c791c7fa..066246bb 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -698,6 +698,52 @@ enum CSI_CHAIN_TYPE {
@@ -196,7 +196,7 @@
#define OFDMA_DL BIT(0)
#define OFDMA_UL BIT(1)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index ca385b6..00f5544 100644
+index ca385b66..00f55443 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -306,6 +306,7 @@ struct mt7915_phy {
@@ -218,7 +218,7 @@
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3, bool wait_resp);
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 1236da9..7e9b76b 100644
+index 1236da91..7e9b76b0 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -1211,6 +1211,8 @@ enum offs_rev {
@@ -231,7 +231,7 @@
#define MT_WF_PHY_BASE 0x83080000
#define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs))
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 453319e..caa3590 100644
+index 453319e1..caa35906 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -14,6 +14,12 @@ enum {
@@ -558,7 +558,7 @@
static int
diff --git a/testmode.c b/testmode.c
-index 06b10a3..d8fc5d6 100644
+index 06b10a36..d8fc5d6f 100644
--- a/testmode.c
+++ b/testmode.c
@@ -26,6 +26,13 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
@@ -622,7 +622,7 @@
nla_put_u8(msg, MT76_TM_ATTR_TX_LTF, td->tx_ltf)) ||
(mt76_testmode_param_present(td, MT76_TM_ATTR_TX_ANTENNA) &&
diff --git a/testmode.h b/testmode.h
-index 1d7aef8..b39cf51 100644
+index 1d7aef86..b39cf511 100644
--- a/testmode.h
+++ b/testmode.h
@@ -64,6 +64,20 @@
@@ -690,7 +690,7 @@
+
#endif
diff --git a/tools/fields.c b/tools/fields.c
-index b0ee84d..e2cf4b9 100644
+index b0ee84d2..e2cf4b92 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -46,6 +46,14 @@ static const char * const testmode_txbf_act[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches/1012-wifi-mt76-testmode-add-iBF-eBF-cal-and-cert-commands.patch b/recipes-wifi/linux-mt76/files/patches/1012-wifi-mt76-testmode-add-iBF-eBF-cal-and-cert-commands.patch
index d1a98ab..5795382 100644
--- a/recipes-wifi/linux-mt76/files/patches/1012-wifi-mt76-testmode-add-iBF-eBF-cal-and-cert-commands.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1012-wifi-mt76-testmode-add-iBF-eBF-cal-and-cert-commands.patch
@@ -1,8 +1,8 @@
-From 5cdc71e26586cf3a314a0971a83a00181c3e305b Mon Sep 17 00:00:00 2001
+From d46a2b30adcdc8bca0f2a5012cd7bd4a3d59051b Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 15 Dec 2022 19:45:18 +0800
-Subject: [PATCH] wifi: mt76: testmode: add iBF/eBF cal and cert commands with
- golden
+Subject: [PATCH 1012/1052] wifi: mt76: testmode: add iBF/eBF cal and cert
+ commands with golden
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -25,7 +25,7 @@
16 files changed, 859 insertions(+), 325 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 65ec039..4408ba8 100644
+index 15106812..9597f564 100644
--- a/mt76.h
+++ b/mt76.h
@@ -755,6 +755,7 @@ struct mt76_testmode_data {
@@ -47,7 +47,7 @@
u32 tx_pending;
u32 tx_queued;
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 44cd646..15e61c9 100644
+index 2acd7efb..0ce7ecdc 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -2688,6 +2688,7 @@ int mt76_connac_mcu_bss_basic_tlv(struct sk_buff *skb,
@@ -68,7 +68,7 @@
memcpy(bss->bssid, phy->macaddr, ETH_ALEN);
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index b05e163..dc75ff1 100644
+index b05e1630..dc75ff1f 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -737,8 +737,10 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
@@ -84,7 +84,7 @@
txwi[6] |= cpu_to_le32(val);
#endif
diff --git a/mt7915/main.c b/mt7915/main.c
-index 8ec508d..b0e11f1 100644
+index 2e566710..4a541188 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -205,46 +205,37 @@ static void mt7915_init_bitrate_mask(struct ieee80211_vif *vif)
@@ -175,7 +175,7 @@
return ret;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 3ba91a6..0b5b3ae 100644
+index 500ecbbb..6f05a081 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -199,6 +199,7 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
@@ -254,7 +254,7 @@
return -EINVAL;
}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 066246b..de17c57 100644
+index 066246bb..de17c579 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -546,10 +546,12 @@ enum {
@@ -448,7 +448,7 @@
MURU_SET_ARB_OP_MODE = 14,
MURU_SET_PLATFORM_TYPE = 25,
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 222e2cf..ddf1b72 100644
+index 730cd338..ed15d711 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -133,6 +133,7 @@ static const u32 mt7915_offs[] = {
@@ -468,7 +468,7 @@
[AGG_AALCR0] = 0x028,
[AGG_AWSCR0] = 0x030,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 00f5544..ef92b2e 100644
+index 00f55443..ef92b2ea 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -325,7 +325,6 @@ struct mt7915_phy {
@@ -523,7 +523,7 @@
+
#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 54daa73..02fe61a 100644
+index 54daa736..02fe61a3 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2888,6 +2888,36 @@ mt7915_txpower_level_set(void *data, u64 val)
@@ -576,7 +576,7 @@
return 0;
diff --git a/mt7915/mtk_mcu.c b/mt7915/mtk_mcu.c
-index 143dae2..7a2d28c 100644
+index 143dae26..7a2d28c7 100644
--- a/mt7915/mtk_mcu.c
+++ b/mt7915/mtk_mcu.c
@@ -1,9 +1,10 @@
@@ -840,7 +840,7 @@
+}
+#endif
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 7e9b76b..4d05e39 100644
+index 7e9b76b0..4d05e391 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -61,6 +61,7 @@ enum offs_rev {
@@ -862,7 +862,7 @@
#define MT_WF_RMAC_BASE(_band) ((_band) ? 0x820f5000 : 0x820e5000)
#define MT_WF_RMAC(_band, ofs) (MT_WF_RMAC_BASE(_band) + (ofs))
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index caa3590..faf6014 100644
+index caa35906..faf60146 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -55,6 +55,8 @@ struct reg_band {
@@ -1706,7 +1706,7 @@
rateval = mode << 6 | rate_idx;
tx_cont->rateval = cpu_to_le16(rateval);
diff --git a/mt7915/testmode.h b/mt7915/testmode.h
-index 7569826..5aba13c 100644
+index 75698261..5aba13cf 100644
--- a/mt7915/testmode.h
+++ b/mt7915/testmode.h
@@ -311,137 +311,7 @@ struct mt7915_tm_muru {
@@ -1850,7 +1850,7 @@
#endif
diff --git a/testmode.c b/testmode.c
-index d8fc5d6..56b9205 100644
+index d8fc5d6f..56b92059 100644
--- a/testmode.c
+++ b/testmode.c
@@ -196,6 +196,7 @@ mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len,
@@ -1862,7 +1862,7 @@
memcpy(hdr->addr2, addr[1], ETH_ALEN);
memcpy(hdr->addr3, addr[2], ETH_ALEN);
diff --git a/testmode.h b/testmode.h
-index b39cf51..20fab3e 100644
+index b39cf511..20fab3ec 100644
--- a/testmode.h
+++ b/testmode.h
@@ -303,7 +303,10 @@ enum mt76_testmode_cfg {
@@ -1890,7 +1890,7 @@
/* keep last */
NUM_MT76_TM_TXBF_ACT,
diff --git a/tools/fields.c b/tools/fields.c
-index e2cf4b9..027b8cd 100644
+index e2cf4b92..027b8cdb 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -33,7 +33,10 @@ static const char * const testmode_tx_mode[] = {
diff --git a/recipes-wifi/linux-mt76/files/patches/1013-wifi-mt76-connac-airtime-fairness-feature-off-in-mac.patch b/recipes-wifi/linux-mt76/files/patches/1013-wifi-mt76-connac-airtime-fairness-feature-off-in-mac.patch
index 420358a..7879b85 100644
--- a/recipes-wifi/linux-mt76/files/patches/1013-wifi-mt76-connac-airtime-fairness-feature-off-in-mac.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1013-wifi-mt76-connac-airtime-fairness-feature-off-in-mac.patch
@@ -1,7 +1,7 @@
-From fa9a7d0143157226ec02bdfa64fa9e313f8b87ba Mon Sep 17 00:00:00 2001
+From 9e7d1c03b7944cd7a0641c68c9515f400e662451 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 6 May 2022 15:58:42 +0800
-Subject: [PATCH 1013/1051] wifi: mt76: connac: airtime fairness feature off in
+Subject: [PATCH 1013/1052] wifi: mt76: connac: airtime fairness feature off in
mac80211
---
@@ -9,7 +9,7 @@
1 file changed, 1 deletion(-)
diff --git a/mac80211.c b/mac80211.c
-index 305cae7..f9dfdf8 100644
+index d6b70374..750a642a 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -451,7 +451,6 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw)
diff --git a/recipes-wifi/linux-mt76/files/patches/1014-wifi-mt76-mt7915-add-phy-capability-vendor-command.patch b/recipes-wifi/linux-mt76/files/patches/1014-wifi-mt76-mt7915-add-phy-capability-vendor-command.patch
index 2e16650..3357c0d 100644
--- a/recipes-wifi/linux-mt76/files/patches/1014-wifi-mt76-mt7915-add-phy-capability-vendor-command.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1014-wifi-mt76-mt7915-add-phy-capability-vendor-command.patch
@@ -1,7 +1,8 @@
-From 3982aaa49810c8f0b2c754bd6c7a2d2b21c45407 Mon Sep 17 00:00:00 2001
+From ea8636284d9278b7053ecedb02045be768d90957 Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <Yi-Chia.Hsieh@mediatek.com>
Date: Tue, 12 Jul 2022 10:04:35 -0700
-Subject: [PATCH] wifi: mt76: mt7915: add phy capability vendor command
+Subject: [PATCH 1014/1052] wifi: mt76: mt7915: add phy capability vendor
+ command
---
mt7915/mt7915.h | 1 +
@@ -10,7 +11,7 @@
3 files changed, 79 insertions(+)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 1c1b3a1..f8ae363 100644
+index ef92b2ea..64cfa2e0 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -11,6 +11,7 @@
@@ -22,7 +23,7 @@
#define MT7916_WTBL_SIZE 544
#define MT7915_WTBL_RESERVED (mt7915_wtbl_size(dev) - 1)
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 1beb603..e6cd79f 100644
+index cf09b513..9e8d2442 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -52,6 +52,18 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
@@ -99,7 +100,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 9cb6755..e58884c 100644
+index 9cb67551..e58884ce 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -10,6 +10,7 @@ enum mtk_nl80211_vendor_subcmds {
diff --git a/recipes-wifi/linux-mt76/files/patches/1015-wifi-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl-enable.patch b/recipes-wifi/linux-mt76/files/patches/1015-wifi-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl-enable.patch
index c8d1472..a8230fb 100644
--- a/recipes-wifi/linux-mt76/files/patches/1015-wifi-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl-enable.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1015-wifi-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl-enable.patch
@@ -1,7 +1,7 @@
-From d49feab75f9fc7ffc5fd8b817b11c80251ec720c Mon Sep 17 00:00:00 2001
+From 31ecfaed704ad082d532a32ae5abd045f5d2f339 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Fri, 24 Jun 2022 11:15:45 +0800
-Subject: [PATCH] wifi: mt76: mt7915: add vendor subcmd EDCCA ctrl
+Subject: [PATCH 1015/1052] wifi: mt76: mt7915: add vendor subcmd EDCCA ctrl
enable/threshold/compensation
---
@@ -15,7 +15,7 @@
7 files changed, 264 insertions(+), 1 deletion(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 09d41b5..10b6133 100644
+index 40fa9fc8..a85179b8 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1254,6 +1254,7 @@ enum {
@@ -27,7 +27,7 @@
MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
};
diff --git a/mt7915/main.c b/mt7915/main.c
-index b0e11f1..b1d7383 100644
+index 4a541188..de2f9098 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -479,6 +479,9 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
@@ -41,7 +41,7 @@
ret = mt7915_set_channel(phy);
if (ret)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 0b5b3ae..0e04fc2 100644
+index 6f05a081..f83d969c 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -5037,3 +5037,75 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
@@ -121,7 +121,7 @@
+ return 0;
+}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index de17c57..1682c11 100644
+index de17c579..1682c117 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -1128,6 +1128,27 @@ enum {
@@ -153,7 +153,7 @@
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 64cfa2e..141c151 100644
+index 64cfa2e0..141c151e 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -789,7 +789,8 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
@@ -167,7 +167,7 @@
int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 9e8d244..aaa0cf1 100644
+index 9e8d2442..aaa0cf1d 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -64,6 +64,24 @@ phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = {
@@ -324,7 +324,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index e58884c..c8d30b5 100644
+index e58884ce..c8d30b52 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -3,6 +3,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/1016-wifi-mt76-mt7915-implement-bin-file-mode.patch b/recipes-wifi/linux-mt76/files/patches/1016-wifi-mt76-mt7915-implement-bin-file-mode.patch
index 956433c..9800bd2 100644
--- a/recipes-wifi/linux-mt76/files/patches/1016-wifi-mt76-mt7915-implement-bin-file-mode.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1016-wifi-mt76-mt7915-implement-bin-file-mode.patch
@@ -1,7 +1,7 @@
-From c4c1b1bf2d0630188f3e283d7f3856d0fb0700c6 Mon Sep 17 00:00:00 2001
+From 6aa933c1f0af48d3703f500dce4514b62d9d2121 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 7 Jul 2022 11:09:59 +0800
-Subject: [PATCH 1016/1051] wifi: mt76: mt7915: implement bin file mode
+Subject: [PATCH 1016/1052] wifi: mt76: mt7915: implement bin file mode
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
@@ -16,7 +16,7 @@
7 files changed, 144 insertions(+), 4 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index 3625b16..9d029c0 100644
+index 3625b169..9d029c04 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -161,6 +161,31 @@ static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len)
@@ -52,7 +52,7 @@
mt76_eeprom_override(struct mt76_phy *phy)
{
diff --git a/mt76.h b/mt76.h
-index 1455144..fbcdfa9 100644
+index 9597f564..253a564f 100644
--- a/mt76.h
+++ b/mt76.h
@@ -983,6 +983,9 @@ struct mt76_dev {
@@ -74,7 +74,7 @@
struct mt76_queue *
mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index f4876fe..c8b1c18 100644
+index f4876fe9..c8b1c18e 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
@@ -5,6 +5,30 @@
@@ -196,7 +196,7 @@
if (ret)
return ret;
diff --git a/mt7915/eeprom.h b/mt7915/eeprom.h
-index 509fb43..99101f9 100644
+index 509fb43d..99101f91 100644
--- a/mt7915/eeprom.h
+++ b/mt7915/eeprom.h
@@ -109,6 +109,13 @@ enum mt7915_sku_rate_group {
@@ -214,10 +214,10 @@
mt7915_get_channel_group_5g(int channel, bool is_7976)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index ea450ae..28403c9 100644
+index 141c151e..2fb8e2fb 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -399,6 +399,8 @@ struct mt7915_dev {
+@@ -414,6 +414,8 @@ struct mt7915_dev {
bool dbdc_support;
bool flash_mode;
@@ -226,7 +226,7 @@
bool muru_debug;
bool ibf;
-@@ -786,6 +788,7 @@ void mt7915_dump_tmac_info(u8 *tmac_info);
+@@ -802,6 +804,7 @@ void mt7915_dump_tmac_info(u8 *tmac_info);
int mt7915_mcu_set_txpower_level(struct mt7915_phy *phy, u8 drop_level);
void mt7915_packet_log_to_host(struct mt7915_dev *dev, const void *data, int len, int type, int des_len);
int mt7915_mcu_set_amsdu_algo(struct mt7915_dev *dev, u16 wcid, u8 enable);
@@ -235,7 +235,7 @@
#define PKT_BIN_DEBUG_MAGIC 0xc8763123
enum {
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 9e490ad..17577fd 100644
+index 02fe61a3..76f4849e 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3,6 +3,7 @@
@@ -304,7 +304,7 @@
}
#endif
diff --git a/testmode.h b/testmode.h
-index 20fab3e..91d1e86 100644
+index 20fab3ec..91d1e867 100644
--- a/testmode.h
+++ b/testmode.h
@@ -17,7 +17,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/1017-wifi-mt76-mt7915-Add-mu-dump-support.patch b/recipes-wifi/linux-mt76/files/patches/1017-wifi-mt76-mt7915-Add-mu-dump-support.patch
index 30998f6..8e1378e 100644
--- a/recipes-wifi/linux-mt76/files/patches/1017-wifi-mt76-mt7915-Add-mu-dump-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1017-wifi-mt76-mt7915-Add-mu-dump-support.patch
@@ -1,7 +1,7 @@
-From fdac49c9616d72b03e0ba8ab1f17d777db8876cf Mon Sep 17 00:00:00 2001
+From 0623b3b87fe33c6ad8037aa01cf63b2a1ab2274f Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Thu, 11 Aug 2022 18:09:45 -0700
-Subject: [PATCH 1017/1051] wifi: mt76: mt7915: Add mu dump support
+Subject: [PATCH 1017/1052] wifi: mt76: mt7915: Add mu dump support
---
mt7915/vendor.c | 24 ++++++++++++++++++++++++
@@ -9,10 +9,10 @@
2 files changed, 25 insertions(+)
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 3a58684..ac6f637 100644
+index aaa0cf1d..eb0b380d 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -38,6 +38,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
+@@ -39,6 +39,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
static const struct nla_policy
mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
[MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
@@ -20,7 +20,7 @@
};
static const struct nla_policy
-@@ -1025,6 +1026,28 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
+@@ -1161,6 +1162,28 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
return 0;
}
@@ -49,7 +49,7 @@
static int
mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
struct sk_buff *skb, const void *data, int data_len,
-@@ -1211,6 +1234,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1347,6 +1370,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = mt7915_vendor_mu_ctrl,
@@ -58,7 +58,7 @@
.maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX,
},
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 284994a..8c2a996 100644
+index c8d30b52..c61ba260 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -73,6 +73,7 @@ enum mtk_vendor_attr_mu_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches/1018-wifi-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ct.patch b/recipes-wifi/linux-mt76/files/patches/1018-wifi-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ct.patch
index 0b9b72a..90266c6 100644
--- a/recipes-wifi/linux-mt76/files/patches/1018-wifi-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ct.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1018-wifi-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ct.patch
@@ -1,7 +1,7 @@
-From 14f9e5f7f36380a64d158e31f60956ddec016245 Mon Sep 17 00:00:00 2001
+From a2610e02282fb1825cdc2d76ebff9e979a6a977c Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 28 Oct 2022 10:15:56 +0800
-Subject: [PATCH 1018/1051] wifi: mt76: mt7915: add vendor subcmd three wire
+Subject: [PATCH 1018/1052] wifi: mt76: mt7915: add vendor subcmd three wire
(PTA) ctrl
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -15,10 +15,10 @@
6 files changed, 111 insertions(+), 29 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 012f9be..7e12c05 100644
+index a85179b8..e7eb6a93 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1251,7 +1251,7 @@ enum {
+@@ -1253,7 +1253,7 @@ enum {
MCU_EXT_CMD_SMESH_CTRL = 0xae,
MCU_EXT_CMD_RX_STAT_USER_CTRL = 0xb3,
MCU_EXT_CMD_SET_QOS_MAP = 0xb4,
@@ -28,7 +28,7 @@
MCU_EXT_CMD_CSI_CTRL = 0xc2,
MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index badc831..89b35e8 100644
+index f83d969c..3e4239f6 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -4736,37 +4736,33 @@ void mt7915_mcu_set_dynalgo(struct mt7915_phy *phy, u8 enable)
@@ -93,7 +93,7 @@
void mt7915_mcu_set_bypass_smthint(struct mt7915_phy *phy, u8 val)
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 1682c11..1b0bd06 100644
+index 1682c117..1b0bd06b 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -916,6 +916,35 @@ struct mt7915_mcu_rdd_ipi_scan {
@@ -133,10 +133,10 @@
#define OFDMA_DL BIT(0)
#define OFDMA_UL BIT(1)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 28403c9..d9a885d 100644
+index 2fb8e2fb..6027e7f7 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -767,6 +767,7 @@ void mt7915_mcu_set_mimo(struct mt7915_phy *phy, u8 direction);
+@@ -781,6 +781,7 @@ void mt7915_mcu_set_mimo(struct mt7915_phy *phy, u8 direction);
void mt7915_mcu_set_dynalgo(struct mt7915_phy *phy, u8 enable);
int mt7915_mcu_set_mu_edca(struct mt7915_phy *phy, u8 val);
void mt7915_mcu_set_cert(struct mt7915_phy *phy, u8 type);
@@ -145,10 +145,10 @@
void mt7915_vendor_register(struct mt7915_phy *phy);
int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index ac6f637..eeac18d 100644
+index eb0b380d..54b89030 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -41,6 +41,11 @@ mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
+@@ -42,6 +42,11 @@ mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
[MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 },
};
@@ -160,7 +160,7 @@
static const struct nla_policy
rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
[MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_GI] = {.type = NLA_U8 },
-@@ -992,7 +997,7 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+@@ -1128,7 +1133,7 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
mt7915_set_wireless_vif, &val32);
} else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]) {
val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]);
@@ -169,7 +169,7 @@
mt7915_mcu_set_bypass_smthint(phy, val8); /* Cert bypass smooth interpolation */
}
-@@ -1136,6 +1141,7 @@ static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy,
+@@ -1272,6 +1277,7 @@ static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy,
return 0;
}
@@ -177,7 +177,7 @@
static int
mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
struct sk_buff *skb, const void *data, int data_len,
-@@ -1179,6 +1185,31 @@ mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+@@ -1315,6 +1321,31 @@ mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
return len;
}
@@ -209,7 +209,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
.info = {
-@@ -1260,6 +1291,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1396,6 +1427,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.dumpit = mt7915_vendor_edcca_ctrl_dump,
.policy = edcca_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_EDCCA_CTRL_MAX,
@@ -228,7 +228,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 8c2a996..e61a6aa 100644
+index c61ba260..ddde0cc0 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -13,6 +13,7 @@ enum mtk_nl80211_vendor_subcmds {
diff --git a/recipes-wifi/linux-mt76/files/patches/1019-wifi-mt76-mt7915-add-ibf-control-vendor-cmd.patch b/recipes-wifi/linux-mt76/files/patches/1019-wifi-mt76-mt7915-add-ibf-control-vendor-cmd.patch
index 60b7d81..cfd1574 100644
--- a/recipes-wifi/linux-mt76/files/patches/1019-wifi-mt76-mt7915-add-ibf-control-vendor-cmd.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1019-wifi-mt76-mt7915-add-ibf-control-vendor-cmd.patch
@@ -1,7 +1,7 @@
-From b523d127286292b2915eda127d35001ee67ab461 Mon Sep 17 00:00:00 2001
+From 95a5898db592cf183d3275e67a511f3ad5c2f541 Mon Sep 17 00:00:00 2001
From: mtk27835 <shurong.wen@mediatek.com>
Date: Wed, 7 Sep 2022 14:01:29 -0700
-Subject: [PATCH 1019/1051] wifi: mt76: mt7915: add ibf control vendor cmd
+Subject: [PATCH 1019/1052] wifi: mt76: mt7915: add ibf control vendor cmd
Signed-off-by: mtk27835 <shurong.wen@mediatek.com>
---
@@ -10,10 +10,10 @@
2 files changed, 89 insertions(+), 1 deletion(-)
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index eeac18d..a21cbce 100644
+index 54b89030..b4facaaa 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -87,6 +87,11 @@ edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = {
+@@ -88,6 +88,11 @@ edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = {
[MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL] = { .type = NLA_U8 },
};
@@ -25,7 +25,7 @@
struct csi_null_tone {
u8 start;
u8 end;
-@@ -1209,6 +1214,54 @@ static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
+@@ -1345,6 +1350,54 @@ static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
return mt7915_mcu_set_cfg(phy, CFGINFO_3WIRE_EN_CFG, three_wire_mode);
}
@@ -80,7 +80,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
-@@ -1302,6 +1355,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1438,6 +1491,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.doit = mt7915_vendor_3wire_ctrl,
.policy = three_wire_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_3WIRE_CTRL_MAX,
@@ -100,7 +100,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index e61a6aa..876edf3 100644
+index ddde0cc0..24f35c8e 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -13,7 +13,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -113,7 +113,7 @@
};
-@@ -225,4 +226,26 @@ enum mtk_vendor_attr_phy_capa_dump {
+@@ -238,4 +239,26 @@ enum mtk_vendor_attr_phy_capa_dump {
NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP - 1
};
diff --git a/recipes-wifi/linux-mt76/files/patches/1020-wifi-mt76-mt7915-add-cal-free-data-merge-support.patch b/recipes-wifi/linux-mt76/files/patches/1020-wifi-mt76-mt7915-add-cal-free-data-merge-support.patch
index 7b56f68..a16e386 100644
--- a/recipes-wifi/linux-mt76/files/patches/1020-wifi-mt76-mt7915-add-cal-free-data-merge-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1020-wifi-mt76-mt7915-add-cal-free-data-merge-support.patch
@@ -1,7 +1,7 @@
-From 4f16df4de5a3b2d9080a7c07bfc1f0496de442cd Mon Sep 17 00:00:00 2001
+From 1c8aa13277994e9d4bedcc2399bdcbd73d3612ef Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 30 Mar 2023 15:12:37 +0800
-Subject: [PATCH] wifi: mt76: mt7915: add cal free data merge support
+Subject: [PATCH 1020/1052] wifi: mt76: mt7915: add cal free data merge support
1. add basic cal free data support
2. add E3 low yield rate workaround for panther E3 with 7976 adie
@@ -19,7 +19,7 @@
5 files changed, 250 insertions(+), 6 deletions(-)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 909df24..c369296 100644
+index 909df246..c3692969 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1286,6 +1286,46 @@ static const struct file_operations mt7915_csi_ops = {
@@ -78,7 +78,7 @@
debugfs_create_file("csi_stats", 0400, dir, phy, &mt7915_csi_ops);
#endif
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index c8b1c18..6133c20 100644
+index c8b1c18e..6133c200 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
@@ -48,8 +48,13 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev)
@@ -309,7 +309,7 @@
memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
ETH_ALEN);
diff --git a/mt7915/eeprom.h b/mt7915/eeprom.h
-index 99101f9..70fca0b 100644
+index 99101f91..70fca0b3 100644
--- a/mt7915/eeprom.h
+++ b/mt7915/eeprom.h
@@ -68,6 +68,8 @@ enum mt7915_eeprom_field {
@@ -322,7 +322,7 @@
MT7976_ONE_ADIE_DBDC = 0x7,
MT7975_ONE_ADIE = 0x8,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index cf622de..7bc5182 100644
+index 3e4239f6..85112791 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2968,6 +2968,7 @@ int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset, u8 *read_buf)
@@ -353,10 +353,10 @@
dev_kfree_skb(skb);
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 3fe901d..5ba6986 100644
+index 6027e7f7..7d068e1e 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -581,6 +581,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
+@@ -579,6 +579,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
diff --git a/recipes-wifi/linux-mt76/files/patches/1021-wifi-mt76-mt7915-support-on-off-SW-ACI-through-debug.patch b/recipes-wifi/linux-mt76/files/patches/1021-wifi-mt76-mt7915-support-on-off-SW-ACI-through-debug.patch
index 11f05a7..610fecd 100644
--- a/recipes-wifi/linux-mt76/files/patches/1021-wifi-mt76-mt7915-support-on-off-SW-ACI-through-debug.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1021-wifi-mt76-mt7915-support-on-off-SW-ACI-through-debug.patch
@@ -1,7 +1,7 @@
-From 615af047639896e1d92edf7c18322a1a6d993e92 Mon Sep 17 00:00:00 2001
+From cf95b91353888672b8fcf839592760de4d5f93ac Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 14 Oct 2022 11:15:13 +0800
-Subject: [PATCH 1021/1051] wifi: mt76: mt7915: support on off SW ACI through
+Subject: [PATCH 1021/1052] wifi: mt76: mt7915: support on off SW ACI through
debugfs
Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
@@ -11,10 +11,10 @@
2 files changed, 22 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 7e12c05..94fcf32 100644
+index e7eb6a93..49c3f1aa 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1253,6 +1253,7 @@ enum {
+@@ -1255,6 +1255,7 @@ enum {
MCU_EXT_CMD_SET_QOS_MAP = 0xb4,
MCU_EXT_CMD_SET_CFG = 0xb7,
MCU_EXT_CMD_EDCCA = 0xba,
@@ -23,7 +23,7 @@
MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
};
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 17577fd..8f2f496 100644
+index 76f4849e..3e84d753 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3770,6 +3770,25 @@ static int mt7915_show_eeprom_mode(struct seq_file *s, void *data)
diff --git a/recipes-wifi/linux-mt76/files/patches/1022-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch b/recipes-wifi/linux-mt76/files/patches/1022-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch
index 62eec89..100d631 100644
--- a/recipes-wifi/linux-mt76/files/patches/1022-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1022-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch
@@ -1,7 +1,7 @@
-From 942b504ff8a04d6faf2023418946be2167bd67d0 Mon Sep 17 00:00:00 2001
+From 94af1c45316f8510f60afd0348918345757f1c20 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 5 Dec 2022 18:21:51 +0800
-Subject: [PATCH 1022/1051] wifi: mt76: mt7915: add bf backoff limit table
+Subject: [PATCH 1022/1052] wifi: mt76: mt7915: add bf backoff limit table
support
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
@@ -18,7 +18,7 @@
9 files changed, 275 insertions(+), 54 deletions(-)
diff --git a/debugfs.c b/debugfs.c
-index 1c8328d..a626f7c 100644
+index 1c8328d5..a626f7cf 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -95,9 +95,9 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
@@ -34,7 +34,7 @@
}
EXPORT_SYMBOL_GPL(mt76_seq_puts_array);
diff --git a/eeprom.c b/eeprom.c
-index 9d029c0..aa33e7b 100644
+index 9d029c04..aa33e7b5 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -336,9 +336,10 @@ mt76_apply_array_limit(s8 *pwr, size_t pwr_len, const __be32 *data,
@@ -115,7 +115,7 @@
return max_power;
}
diff --git a/mt76.h b/mt76.h
-index fbcdfa9..54f805e 100644
+index 253a564f..580320fd 100644
--- a/mt76.h
+++ b/mt76.h
@@ -1089,6 +1089,14 @@ struct mt76_power_limits {
@@ -134,7 +134,7 @@
struct mt76_ethtool_worker_info {
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 5c08910..fa1d2ac 100644
+index c3692969..3830a735 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1020,7 +1020,7 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
@@ -234,7 +234,7 @@
static int
mt7915_twt_stats(struct seq_file *s, void *data)
{
-@@ -1310,7 +1373,9 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
+@@ -1355,7 +1418,9 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
debugfs_create_file("implicit_txbf", 0600, dir, dev,
&fops_implicit_txbf);
debugfs_create_file("txpower_sku", 0400, dir, phy,
@@ -246,10 +246,10 @@
mt7915_twt_stats);
debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
diff --git a/mt7915/init.c b/mt7915/init.c
-index 0994b8a..f548d09 100644
+index 0c58ab7b..a9cb496b 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -284,6 +284,8 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
+@@ -285,6 +285,8 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
int pwr_delta = mt7915_eeprom_get_power_delta(dev, sband->band);
struct mt76_power_limits limits;
@@ -258,7 +258,7 @@
for (i = 0; i < sband->n_channels; i++) {
struct ieee80211_channel *chan = &sband->channels[i];
u32 target_power = 0;
-@@ -300,6 +302,11 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
+@@ -301,6 +303,11 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
target_power = mt76_get_rate_power_limits(phy->mt76, chan,
&limits,
target_power);
@@ -271,7 +271,7 @@
target_power = DIV_ROUND_UP(target_power, 2);
chan->max_power = min_t(int, chan->max_reg_power,
diff --git a/mt7915/main.c b/mt7915/main.c
-index f927c5a..4e1a430 100644
+index de2f9098..4a5a0155 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -73,11 +73,7 @@ int mt7915_run(struct ieee80211_hw *hw)
@@ -288,7 +288,7 @@
goto out;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 372168d..4225e97 100644
+index 85112791..1b5ef875 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3422,7 +3422,8 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
@@ -536,7 +536,7 @@
return mt76_mcu_send_msg(&dev->mt76,
MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), &req,
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 1b0bd06..94eff26 100644
+index 1b0bd06b..94eff268 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -517,12 +517,18 @@ enum {
@@ -559,7 +559,7 @@
SPR_ENABLE = 0x1,
SPR_ENABLE_SD = 0x3,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index d32b12f..c595d81 100644
+index 7d068e1e..437cfb63 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -72,6 +72,7 @@
@@ -570,7 +570,7 @@
#define MT7915_MAX_TWT_AGRT 16
#define MT7915_MAX_STA_TWT_AGRT 8
-@@ -302,6 +303,9 @@ struct mt7915_phy {
+@@ -313,6 +314,9 @@ struct mt7915_phy {
struct list_head stats_list;
spinlock_t stats_lock;
@@ -580,7 +580,7 @@
#ifdef CONFIG_NL80211_TESTMODE
struct {
u32 *reg_backup;
-@@ -628,9 +632,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
+@@ -643,9 +647,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
u8 en);
int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band);
diff --git a/recipes-wifi/linux-mt76/files/patches/1023-wifi-mt76-mt7915-amsdu-set-and-get-control.patch b/recipes-wifi/linux-mt76/files/patches/1023-wifi-mt76-mt7915-amsdu-set-and-get-control.patch
index c95aa26..72fd7b9 100644
--- a/recipes-wifi/linux-mt76/files/patches/1023-wifi-mt76-mt7915-amsdu-set-and-get-control.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1023-wifi-mt76-mt7915-amsdu-set-and-get-control.patch
@@ -1,7 +1,7 @@
-From 0f64ab075028815e91162e78ba308d5022b89c85 Mon Sep 17 00:00:00 2001
+From 71155a316facf65574dc5a03cc6c70a824c3d220 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Wed, 14 Dec 2022 00:44:07 -0800
-Subject: [PATCH 1023/1051] wifi: mt76: mt7915: amsdu set and get control
+Subject: [PATCH 1023/1052] wifi: mt76: mt7915: amsdu set and get control
---
mt7915/mac.c | 7 +++++++
@@ -11,7 +11,7 @@
4 files changed, 50 insertions(+)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index dc75ff1..e14b3fd 100644
+index dc75ff1f..e14b3fdd 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1994,6 +1994,13 @@ static void mt7915_mac_sta_stats_work(struct mt7915_phy *phy)
@@ -29,10 +29,10 @@
void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index c595d81..804d554 100644
+index 437cfb63..82d374eb 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -761,6 +761,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -775,6 +775,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
bool pci, int *irq);
#ifdef CONFIG_MTK_VENDOR
@@ -41,10 +41,10 @@
void mt7915_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif);
void mt7915_mcu_set_rfeature_starec(void *data, struct mt7915_dev *dev,
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index a21cbce..e25a0ce 100644
+index b4facaaa..4848e0a1 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -31,10 +31,16 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
+@@ -32,10 +32,16 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
[MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA] = {.type = NLA_U8 },
[MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO] = {.type = NLA_U8 },
[MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE] = {.type = NLA_U16 },
@@ -61,7 +61,7 @@
static const struct nla_policy
mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
[MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
-@@ -1004,11 +1010,34 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+@@ -1140,11 +1146,34 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]);
mt7915_mcu_set_cfg(phy, CFGINFO_CERT_CFG, val8); /* Cert Enable for OMI */
mt7915_mcu_set_bypass_smthint(phy, val8); /* Cert bypass smooth interpolation */
@@ -96,7 +96,7 @@
static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data,
-@@ -1307,6 +1336,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1443,6 +1472,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = mt7915_vendor_wireless_ctrl,
@@ -105,7 +105,7 @@
.maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX,
},
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 876edf3..7c4e914 100644
+index 24f35c8e..8a13b3a3 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -75,6 +75,7 @@ enum mtk_vendor_attr_wireless_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches/1024-wifi-mt76-mt7915-Add-vendor-command-attribute-for-RT.patch b/recipes-wifi/linux-mt76/files/patches/1024-wifi-mt76-mt7915-Add-vendor-command-attribute-for-RT.patch
index 7951f6c..153f1e3 100644
--- a/recipes-wifi/linux-mt76/files/patches/1024-wifi-mt76-mt7915-Add-vendor-command-attribute-for-RT.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1024-wifi-mt76-mt7915-Add-vendor-command-attribute-for-RT.patch
@@ -1,7 +1,7 @@
-From 0b4edb9d0fa52ebe9bf4a1c1f152515296afc657 Mon Sep 17 00:00:00 2001
+From fbbc0bb4591648f645ed1b0b43f77e9922ecdfdd Mon Sep 17 00:00:00 2001
From: "himanshu.goyal" <himanshu.goyal@mediatek.com>
Date: Tue, 24 Jan 2023 14:32:08 +0800
-Subject: [PATCH 1024/1051] wifi: mt76: mt7915: Add vendor command attribute
+Subject: [PATCH 1024/1052] wifi: mt76: mt7915: Add vendor command attribute
for RTS BW signaling.
Signed-off-by: himanshu.goyal <himanshu.goyal@mediatek.com>
@@ -13,7 +13,7 @@
4 files changed, 20 insertions(+)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4225e97..2e6eefc 100644
+index 1b5ef875..ca18acfb 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -4863,6 +4863,12 @@ int mt7915_mcu_set_cfg(struct mt7915_phy *phy, u8 cfg_info, u8 type)
@@ -30,7 +30,7 @@
tlv_len = sizeof(struct three_wire_cfg);
req.three_wire.tag = cpu_to_le16(cfg_info);
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 94eff26..6ebcce0 100644
+index 94eff268..6ebcce0d 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -936,6 +936,13 @@ struct three_wire_cfg {
@@ -62,10 +62,10 @@
};
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index e25a0ce..8370216 100644
+index 4848e0a1..35891d49 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -34,6 +34,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
+@@ -35,6 +35,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU] = {.type = NLA_U8 },
[MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA] = {.type = NLA_U8 },
[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT] = {.type = NLA_U8 },
@@ -73,7 +73,7 @@
};
static const struct nla_policy
-@@ -1013,6 +1014,9 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+@@ -1149,6 +1150,9 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
} else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]) {
val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]);
mt7915_set_wireless_amsdu(hw, val8);
@@ -84,7 +84,7 @@
return 0;
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 7c4e914..3672420 100644
+index 8a13b3a3..f91ad695 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -77,6 +77,7 @@ enum mtk_vendor_attr_wireless_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-vendor-cmd-to-get-available-col.patch b/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-vendor-cmd-to-get-available-col.patch
index 9522fb0..dc85870 100644
--- a/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-vendor-cmd-to-get-available-col.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-vendor-cmd-to-get-available-col.patch
@@ -1,7 +1,7 @@
-From 399d30ba0e363d9c2f8a438fe2ed2154e6a7a02f Mon Sep 17 00:00:00 2001
+From a48f497ea998ba30f4ee8ab7e5c41e0eb7738119 Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Thu, 26 Jan 2023 08:50:47 +0800
-Subject: [PATCH 1025/1051] wifi: mt76: mt7915: add vendor cmd to get available
+Subject: [PATCH 1025/1052] wifi: mt76: mt7915: add vendor cmd to get available
color bitmap
Add a vendor cmd to notify user space available color bitmap.
@@ -14,10 +14,10 @@
2 files changed, 48 insertions(+)
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 8370216..9a26f7f 100644
+index 35891d49..df08704b 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -99,6 +99,11 @@ ibf_ctrl_policy[NUM_MTK_VENDOR_ATTRS_IBF_CTRL] = {
+@@ -100,6 +100,11 @@ ibf_ctrl_policy[NUM_MTK_VENDOR_ATTRS_IBF_CTRL] = {
[MTK_VENDOR_ATTR_IBF_CTRL_ENABLE] = { .type = NLA_U8 },
};
@@ -29,7 +29,7 @@
struct csi_null_tone {
u8 start;
u8 end;
-@@ -1295,6 +1300,27 @@ mt7915_vendor_ibf_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+@@ -1431,6 +1436,27 @@ mt7915_vendor_ibf_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
return 1;
}
@@ -57,7 +57,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
-@@ -1401,6 +1427,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1537,6 +1563,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.dumpit = mt7915_vendor_ibf_ctrl_dump,
.policy = ibf_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_IBF_CTRL_MAX,
@@ -76,7 +76,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 3672420..bd1c617 100644
+index f91ad695..5b8d99bf 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -15,6 +15,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -87,7 +87,7 @@
};
-@@ -261,4 +262,14 @@ enum mtk_vendor_attr_ibf_dump {
+@@ -274,4 +275,14 @@ enum mtk_vendor_attr_ibf_dump {
NUM_MTK_VENDOR_ATTRS_IBF_DUMP - 1
};
diff --git a/recipes-wifi/linux-mt76/files/patches/1026-wifi-mt76-mt7915-disable-SW-ACI-by-default.patch b/recipes-wifi/linux-mt76/files/patches/1026-wifi-mt76-mt7915-disable-SW-ACI-by-default.patch
index e96992e..fc382a9 100644
--- a/recipes-wifi/linux-mt76/files/patches/1026-wifi-mt76-mt7915-disable-SW-ACI-by-default.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1026-wifi-mt76-mt7915-disable-SW-ACI-by-default.patch
@@ -1,7 +1,7 @@
-From 7f50bd85cb6e13254fa6e72667e1b34599c64f27 Mon Sep 17 00:00:00 2001
+From 252b23b1e979d3b44ca148407d0166c9b618c9e2 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Fri, 24 Feb 2023 16:29:42 +0800
-Subject: [PATCH] wifi: mt76: mt7915: disable SW-ACI by default
+Subject: [PATCH 1026/1052] wifi: mt76: mt7915: disable SW-ACI by default
Support to enable/disable SW-ACI by module parameter "sw_aci_enable".
SW-ACI feature is disable by default.
@@ -13,7 +13,7 @@
4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 9fa01e9..05076b3 100644
+index 4a5a0155..75042189 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -8,6 +8,10 @@
@@ -39,7 +39,7 @@
if (phy != &dev->phy) {
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 8e895b3..236f666 100644
+index ca18acfb..7a7b3bac 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -5222,3 +5222,18 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value)
@@ -62,7 +62,7 @@
+ sizeof(req), NULL);
+}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 82d374e..3fa3257 100644
+index 82d374eb..3fa32574 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -801,6 +801,7 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
@@ -74,7 +74,7 @@
int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 3e84d75..d932360 100644
+index 3e84d753..d9323603 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3773,16 +3773,12 @@ static int mt7915_show_eeprom_mode(struct seq_file *s, void *data)
diff --git a/recipes-wifi/linux-mt76/files/patches/1027-wifi-mt76-mt7915-add-muru-user-number-debug-command.patch b/recipes-wifi/linux-mt76/files/patches/1027-wifi-mt76-mt7915-add-muru-user-number-debug-command.patch
index b0a287b..0cfc758 100644
--- a/recipes-wifi/linux-mt76/files/patches/1027-wifi-mt76-mt7915-add-muru-user-number-debug-command.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1027-wifi-mt76-mt7915-add-muru-user-number-debug-command.patch
@@ -1,7 +1,7 @@
-From 37b9de2d5d24fbdb33192977ce5d33d0ad7f2c0a Mon Sep 17 00:00:00 2001
+From ffe8743a0ee8310def4abad0968fee55cf409ea6 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Thu, 27 Apr 2023 15:37:33 +0800
-Subject: [PATCH 1027/1051] wifi: mt76: mt7915: add muru user number debug
+Subject: [PATCH 1027/1052] wifi: mt76: mt7915: add muru user number debug
command
---
@@ -11,10 +11,10 @@
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 498674d..24dc022 100644
+index 3fa32574..c745b31d 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -647,6 +647,7 @@ int mt7915_mcu_set_pulse_th(struct mt7915_dev *dev,
+@@ -662,6 +662,7 @@ int mt7915_mcu_set_pulse_th(struct mt7915_dev *dev,
int mt7915_mcu_set_radar_th(struct mt7915_dev *dev, int index,
const struct mt7915_dfs_pattern *pattern);
int mt7915_mcu_set_muru_ctrl(struct mt7915_dev *dev, u32 cmd, u32 val);
@@ -23,10 +23,10 @@
int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy);
int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch);
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 9a26f7f..432d750 100644
+index df08704b..6446439f 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -46,6 +46,8 @@ static const struct nla_policy
+@@ -47,6 +47,8 @@ static const struct nla_policy
mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
[MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
[MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 },
@@ -35,7 +35,7 @@
};
static const struct nla_policy
-@@ -1053,9 +1055,10 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
+@@ -1189,9 +1191,10 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
int data_len)
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
@@ -47,7 +47,7 @@
u32 val32 = 0;
err = nla_parse(tb, MTK_VENDOR_ATTR_MU_CTRL_MAX, data, data_len,
-@@ -1069,6 +1072,16 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
+@@ -1205,6 +1208,16 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
FIELD_PREP(RATE_CFG_VAL, val8);
ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
mt7915_set_wireless_vif, &val32);
@@ -65,7 +65,7 @@
return 0;
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index bd1c617..03d1660 100644
+index 5b8d99bf..11ccd0d8 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -103,6 +103,8 @@ enum mtk_vendor_attr_mu_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches/1028-wifi-mt76-mt7915-add-debugfs-for-fw-coredump.patch b/recipes-wifi/linux-mt76/files/patches/1028-wifi-mt76-mt7915-add-debugfs-for-fw-coredump.patch
index a2d4af1..650f7de 100644
--- a/recipes-wifi/linux-mt76/files/patches/1028-wifi-mt76-mt7915-add-debugfs-for-fw-coredump.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1028-wifi-mt76-mt7915-add-debugfs-for-fw-coredump.patch
@@ -1,7 +1,7 @@
-From ef06e880955373d91da964fe8bda86e12277ec55 Mon Sep 17 00:00:00 2001
+From 15cd113a03288b74f6486c898378d61b2204b09e Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 22 May 2023 15:30:21 +0800
-Subject: [PATCH 1028/1051] wifi: mt76: mt7915: add debugfs for fw coredump.
+Subject: [PATCH 1028/1052] wifi: mt76: mt7915: add debugfs for fw coredump.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -12,7 +12,7 @@
4 files changed, 58 insertions(+), 9 deletions(-)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index fa1d2ac..3044557 100644
+index 3830a735..06c62dd3 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -82,8 +82,10 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf,
@@ -67,7 +67,7 @@
/* SER statistics */
desc += scnprintf(buff + desc, bufsz - desc,
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index e14b3fd..35e97f8 100644
+index e14b3fdd..35e97f88 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1687,10 +1687,34 @@ void mt7915_mac_dump_work(struct work_struct *work)
@@ -117,7 +117,7 @@
}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 6ebcce0..035ad97 100644
+index 6ebcce0d..035ad97d 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -760,8 +760,12 @@ enum {
@@ -135,7 +135,7 @@
SER_ENABLE = 2,
SER_RECOVER
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 24dc022..6317051 100644
+index c745b31d..ef51d6e2 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -91,6 +91,13 @@ struct mt7915_sta;
@@ -152,7 +152,7 @@
enum mt7915_txq_id {
MT7915_TXQ_FWDL = 16,
MT7915_TXQ_MCU_WM,
-@@ -389,6 +396,7 @@ struct mt7915_dev {
+@@ -404,6 +411,7 @@ struct mt7915_dev {
/* protects coredump data */
struct mutex dump_mutex;
@@ -160,7 +160,7 @@
#ifdef CONFIG_DEV_COREDUMP
struct {
struct mt7915_crash_data *crash_data[__MT76_RAM_TYPE_MAX];
-@@ -585,6 +593,7 @@ int mt7915_txbf_init(struct mt7915_dev *dev);
+@@ -600,6 +608,7 @@ int mt7915_txbf_init(struct mt7915_dev *dev);
void mt7915_init_txpower(struct mt7915_phy *phy);
int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_en);
void mt7915_reset(struct mt7915_dev *dev);
diff --git a/recipes-wifi/linux-mt76/files/patches/1029-wifi-mt76-mt7915-remove-BW160-support.patch b/recipes-wifi/linux-mt76/files/patches/1029-wifi-mt76-mt7915-remove-BW160-support.patch
index 81d26e8..ab2f5d5 100644
--- a/recipes-wifi/linux-mt76/files/patches/1029-wifi-mt76-mt7915-remove-BW160-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1029-wifi-mt76-mt7915-remove-BW160-support.patch
@@ -1,7 +1,7 @@
-From 7c0b8498964ddc1708cd5fd949e70d70d7cc7207 Mon Sep 17 00:00:00 2001
+From 1ffedbe219a388f3b76a717cbf2d42e6ba9b25f2 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 24 May 2023 22:35:54 +0800
-Subject: [PATCH 1029/1051] wifi: mt76: mt7915: remove BW160 support
+Subject: [PATCH 1029/1052] wifi: mt76: mt7915: remove BW160 support
Remove BW160 capability in mt7915.
---
@@ -9,10 +9,10 @@
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index f548d09..20d6efd 100644
+index a9cb496b..a77078f7 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -440,11 +440,6 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+@@ -441,11 +441,6 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
vht_cap->cap |=
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
@@ -24,7 +24,7 @@
} else {
phy->mt76->sband_5g.sband.ht_cap.ampdu_density =
IEEE80211_HT_MPDU_DENSITY_2;
-@@ -865,13 +860,9 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
+@@ -873,13 +868,9 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
int sts = hweight8(phy->mt76->chainmask);
u8 c, sts_160 = sts;
@@ -41,7 +41,7 @@
#ifdef CONFIG_MAC80211_MESH
if (vif == NL80211_IFTYPE_MESH_POINT)
-@@ -955,15 +946,10 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
+@@ -963,15 +954,10 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
int i, idx = 0, nss = hweight8(phy->mt76->antenna_mask);
u16 mcs_map = 0;
u16 mcs_map_160 = 0;
diff --git a/recipes-wifi/linux-mt76/files/patches/1030-wifi-mt76-mt7915-add-txpower-info-dump-support.patch b/recipes-wifi/linux-mt76/files/patches/1030-wifi-mt76-mt7915-add-txpower-info-dump-support.patch
index b0f9ac0..c7b206b 100644
--- a/recipes-wifi/linux-mt76/files/patches/1030-wifi-mt76-mt7915-add-txpower-info-dump-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1030-wifi-mt76-mt7915-add-txpower-info-dump-support.patch
@@ -1,7 +1,7 @@
-From dc97f22df64689fe6d5cf9e410437c8d9510a41c Mon Sep 17 00:00:00 2001
+From ac55beffc7c153e47a63dd889a80f90656afa5a4 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 11 Jul 2023 17:06:04 +0800
-Subject: [PATCH 1030/1051] wifi: mt76: mt7915: add txpower info dump support
+Subject: [PATCH 1030/1052] wifi: mt76: mt7915: add txpower info dump support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -11,7 +11,7 @@
3 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 3044557..24e88f7 100644
+index 06c62dd3..223f9a37 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1259,6 +1259,91 @@ mt7915_txpower_path_show(struct seq_file *file, void *data)
@@ -106,7 +106,7 @@
static int
mt7915_twt_stats(struct seq_file *s, void *data)
{
-@@ -1388,6 +1473,8 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
+@@ -1433,6 +1518,8 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
&mt7915_txpower_fops);
debugfs_create_file("txpower_path", 0400, dir, phy,
&mt7915_txpower_path_fops);
@@ -116,7 +116,7 @@
mt7915_twt_stats);
debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 7039933..92c0a1e 100644
+index 7a7b3bac..34d36e50 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3624,6 +3624,8 @@ int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len,
@@ -129,7 +129,7 @@
dev_kfree_skb(skb);
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 035ad97..3089fb6 100644
+index 035ad97d..3089fb64 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -525,7 +525,8 @@ enum {
diff --git a/recipes-wifi/linux-mt76/files/patches/1031-wifi-mt76-mt7915-report-tx-and-rx-byte-to-tpt_led-wh.patch b/recipes-wifi/linux-mt76/files/patches/1031-wifi-mt76-mt7915-report-tx-and-rx-byte-to-tpt_led-wh.patch
index ac73e2d..2f9f4d1 100644
--- a/recipes-wifi/linux-mt76/files/patches/1031-wifi-mt76-mt7915-report-tx-and-rx-byte-to-tpt_led-wh.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1031-wifi-mt76-mt7915-report-tx-and-rx-byte-to-tpt_led-wh.patch
@@ -1,7 +1,7 @@
-From d2be9fd8f4889bfde955ab9aeb865d4359e0edd5 Mon Sep 17 00:00:00 2001
+From 693f54f4538631b84be41befd324f642182d37ca Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Fri, 23 Jun 2023 06:06:21 +0800
-Subject: [PATCH 1031/1051] wifi: mt76: mt7915: report tx and rx byte to
+Subject: [PATCH 1031/1052] wifi: mt76: mt7915: report tx and rx byte to
tpt_led when wed is enabled
Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
@@ -11,7 +11,7 @@
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index 170ef36..6eeea97 100644
+index 170ef367..6eeea971 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -605,9 +605,15 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
@@ -42,7 +42,7 @@
sband = &mphy->sband_5g.sband;
else if (mphy->chandef.chan->band == NL80211_BAND_6GHZ)
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index ddf1b72..437a9b0 100644
+index ed15d711..b1b219ce 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -588,6 +588,7 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
diff --git a/recipes-wifi/linux-mt76/files/patches/1032-wifi-mt76-mt7915-Establish-BA-in-VO-queue.patch b/recipes-wifi/linux-mt76/files/patches/1032-wifi-mt76-mt7915-Establish-BA-in-VO-queue.patch
index 9b232bf..a62749d 100644
--- a/recipes-wifi/linux-mt76/files/patches/1032-wifi-mt76-mt7915-Establish-BA-in-VO-queue.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1032-wifi-mt76-mt7915-Establish-BA-in-VO-queue.patch
@@ -1,14 +1,14 @@
-From 372460c5ed7a903c5cc5f814d588df5811df850e Mon Sep 17 00:00:00 2001
+From fcfa851c3dd6782c382dc1890f2623fdc0858f73 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 8 Aug 2023 11:20:58 +0800
-Subject: [PATCH 1032/1051] wifi: mt76: mt7915: Establish BA in VO queue
+Subject: [PATCH 1032/1052] wifi: mt76: mt7915: Establish BA in VO queue
---
mt76_connac_mac.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index 6eeea97..c23d266 100644
+index 6eeea971..c23d266e 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -1123,8 +1123,6 @@ void mt76_connac2_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
diff --git a/recipes-wifi/linux-mt76/files/patches/1033-wifi-mt76-mt7915-Disable-RegDB-when-enable-single-sk.patch b/recipes-wifi/linux-mt76/files/patches/1033-wifi-mt76-mt7915-Disable-RegDB-when-enable-single-sk.patch
index dc975a6..4ca8bff 100644
--- a/recipes-wifi/linux-mt76/files/patches/1033-wifi-mt76-mt7915-Disable-RegDB-when-enable-single-sk.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1033-wifi-mt76-mt7915-Disable-RegDB-when-enable-single-sk.patch
@@ -1,7 +1,7 @@
-From 1de98ecb4505e3f99759caf4e9df9e263dfa403a Mon Sep 17 00:00:00 2001
+From 6eb114c04f79a4e1642a6743e9895cb8038a4630 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Fri, 11 Aug 2023 16:46:53 +0800
-Subject: [PATCH 1033/1051] wifi: mt76: mt7915: Disable RegDB when enable
+Subject: [PATCH 1033/1052] wifi: mt76: mt7915: Disable RegDB when enable
single sku
---
@@ -11,7 +11,7 @@
3 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 24e88f7..502b493 100644
+index 223f9a37..2c1e1bea 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1020,10 +1020,16 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
@@ -40,15 +40,15 @@
- MT_WF_PHY_TPC_CTRL_STAT_MT7916(band);
+ reg = is_mt7915(&dev->mt76) ? MT_WF_IRPI_TPC_CTRL_STAT(band) :
+ MT_WF_IRPI_TPC_CTRL_STAT_MT7916(band);
-
-- len += scnprintf(buf + len, sz - len, "\nTx power (bbp) : %6ld\n",
-- mt76_get_field(dev, reg, MT_WF_PHY_TPC_POWER));
++
+ len += scnprintf(buf + len, sz - len, "\nTx power (bbp) : %6ld [0.5 dBm]\n",
+ mt76_get_field(dev, reg, MT_WF_IRPI_TPC_POWER));
+
+ len += scnprintf(buf + len, sz - len, "RegDB maximum power:\t%d [dBm]\n",
+ chan->max_reg_power);
-+
+
+- len += scnprintf(buf + len, sz - len, "\nTx power (bbp) : %6ld\n",
+- mt76_get_field(dev, reg, MT_WF_PHY_TPC_POWER));
+ if (chan->band == NL80211_BAND_2GHZ)
+ sband = phy->mt76->sband_2g.sband;
+ else if (chan->band == NL80211_BAND_5GHZ)
@@ -103,10 +103,10 @@
return ret;
}
diff --git a/mt7915/init.c b/mt7915/init.c
-index 20d6efd..4fa48fb 100644
+index a77078f7..6f616b54 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -283,9 +283,11 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
+@@ -284,9 +284,11 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
int nss_delta = mt76_tx_power_nss_delta(n_chains);
int pwr_delta = mt7915_eeprom_get_power_delta(dev, sband->band);
struct mt76_power_limits limits;
@@ -118,7 +118,7 @@
for (i = 0; i < sband->n_channels; i++) {
struct ieee80211_channel *chan = &sband->channels[i];
u32 target_power = 0;
-@@ -309,8 +311,13 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
+@@ -310,8 +312,13 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
target_power += nss_delta;
target_power = DIV_ROUND_UP(target_power, 2);
@@ -135,7 +135,7 @@
}
}
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 4d05e39..ca355d1 100644
+index 4d05e391..ca355d14 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -1215,6 +1215,10 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches/1034-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch b/recipes-wifi/linux-mt76/files/patches/1034-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch
index 92a60ce..89f875e 100644
--- a/recipes-wifi/linux-mt76/files/patches/1034-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1034-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch
@@ -1,7 +1,7 @@
-From fd4211f53ab7973c1875881dcdaa12e252b95670 Mon Sep 17 00:00:00 2001
+From 18fd1219383a2d2f2b0881d87ca8a1552e273bf1 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Thu, 24 Aug 2023 03:01:27 +0800
-Subject: [PATCH 1034/1051] wifi: mt76: mt7915: enable the mac80211 hw bmc ps
+Subject: [PATCH 1034/1052] wifi: mt76: mt7915: enable the mac80211 hw bmc ps
buffer function.
---
@@ -9,10 +9,10 @@
1 file changed, 1 insertion(+)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 4fa48fb..0f8a772 100644
+index 6f616b54..c4685f21 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -413,6 +413,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+@@ -414,6 +414,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
diff --git a/recipes-wifi/linux-mt76/files/patches/1035-wifi-mt76-update-debugfs-knob-for-tx-tokens.patch b/recipes-wifi/linux-mt76/files/patches/1035-wifi-mt76-update-debugfs-knob-for-tx-tokens.patch
index cd4a4bb..b41c81d 100644
--- a/recipes-wifi/linux-mt76/files/patches/1035-wifi-mt76-update-debugfs-knob-for-tx-tokens.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1035-wifi-mt76-update-debugfs-knob-for-tx-tokens.patch
@@ -1,7 +1,7 @@
-From cf2a6fb7145d4083bd06558fcad669f91517b6ad Mon Sep 17 00:00:00 2001
+From c324616943e4a51d5d288a26bdbb330be11d2d8f Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Thu, 24 Aug 2023 03:01:27 +0800
-Subject: [PATCH 1035/1051] wifi: mt76: update debugfs knob for tx tokens
+Subject: [PATCH 1035/1052] wifi: mt76: update debugfs knob for tx tokens
1. dump token pending time
2. dump per-band token counts
@@ -14,7 +14,7 @@
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 54f805e..cff22f5 100644
+index 580320fd..16b76b48 100644
--- a/mt76.h
+++ b/mt76.h
@@ -403,6 +403,7 @@ struct mt76_txwi_cache {
@@ -26,7 +26,7 @@
union {
struct sk_buff *skb;
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 35e97f8..a731446 100644
+index 35e97f88..a7314465 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -811,6 +811,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -39,7 +39,7 @@
mt7915_mac_write_txwi(mdev, txwi_ptr, tx_info->skb, wcid, pid, key,
qid, 0);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index ad7abda..5ce2b93 100644
+index d9323603..2cc0b2d8 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2203,17 +2203,31 @@ static int mt7915_mibinfo_band1(struct seq_file *s, void *data)
diff --git a/recipes-wifi/linux-mt76/files/patches/1036-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch b/recipes-wifi/linux-mt76/files/patches/1036-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch
index e9f3b10..98ae91e 100644
--- a/recipes-wifi/linux-mt76/files/patches/1036-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1036-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch
@@ -1,7 +1,7 @@
-From 93a4a8d162937bd5c49aac52d158fe8bda71731a Mon Sep 17 00:00:00 2001
+From 8e5290c521da92f931b169e1b2dccc7125e17253 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Tue, 5 Sep 2023 20:17:19 +0800
-Subject: [PATCH 1036/1051] wifi: mt76: mt7915: support enable/disable spatial
+Subject: [PATCH 1036/1052] wifi: mt76: mt7915: support enable/disable spatial
reuse through debugfs
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
@@ -12,7 +12,7 @@
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 92c0a1e..ef9f0ce 100644
+index 34d36e50..40d94c4f 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3756,8 +3756,7 @@ int mt7915_mcu_set_txbf(struct mt7915_dev *dev, u8 action)
@@ -26,10 +26,10 @@
struct mt7915_dev *dev = phy->dev;
struct mt7915_mcu_sr_ctrl req = {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 6317051..3ec65a7 100644
+index ef51d6e2..bc0f313c 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -798,6 +798,7 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
+@@ -814,6 +814,7 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val);
int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
@@ -38,7 +38,7 @@
#ifdef MTK_DEBUG
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 5ce2b93..b653c34 100644
+index 2cc0b2d8..c00184f8 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3799,6 +3799,17 @@ mt7915_sw_aci_set(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-add-debug-log-for-SER-flow.patch b/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-add-debug-log-for-SER-flow.patch
index 966e47d..d3fd14d 100644
--- a/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-add-debug-log-for-SER-flow.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-add-debug-log-for-SER-flow.patch
@@ -1,7 +1,7 @@
-From 664596920de78c1aa9d1c3dc0e07018ca5c7d43d Mon Sep 17 00:00:00 2001
+From 50046dd2dad794942f0f28fda6ede3b90261e0be Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 11 Sep 2023 17:11:24 +0800
-Subject: [PATCH 1037/1051] wifi: mt76: mt7915: add debug log for SER flow.
+Subject: [PATCH 1037/1052] wifi: mt76: mt7915: add debug log for SER flow.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -9,7 +9,7 @@
1 file changed, 9 insertions(+)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index a731446..c421447 100644
+index a7314465..c421447c 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1531,6 +1531,9 @@ void mt7915_mac_reset_work(struct work_struct *work)
diff --git a/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-mt7915-add-debuffs-knob-for-protect-thresh.patch b/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-mt7915-add-debuffs-knob-for-protect-thresh.patch
index b38bc29..a367ad8 100644
--- a/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-mt7915-add-debuffs-knob-for-protect-thresh.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-mt7915-add-debuffs-knob-for-protect-thresh.patch
@@ -1,7 +1,7 @@
-From bbcd1a6d3d84c1cb1a82fe996bf825c11878289c Mon Sep 17 00:00:00 2001
+From 5fa70ee3f31733b9ddee67fdc78fe637df251aca Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 2 Oct 2023 14:00:13 +0800
-Subject: [PATCH 1038/1051] wifi: mt76: mt7915: add debuffs knob for protect
+Subject: [PATCH 1038/1052] wifi: mt76: mt7915: add debuffs knob for protect
threshold
---
@@ -10,10 +10,10 @@
2 files changed, 12 insertions(+)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 3ec65a7..3dc99f8 100644
+index bc0f313c..183d59da 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -778,6 +778,7 @@ void mt7915_mcu_set_rfeature_starec(void *data, struct mt7915_dev *dev,
+@@ -792,6 +792,7 @@ void mt7915_mcu_set_rfeature_starec(void *data, struct mt7915_dev *dev,
struct ieee80211_vif *vif, struct ieee80211_sta *sta);
int mt7915_mcu_set_rfeature_trig_type(struct mt7915_phy *phy, u8 enable, u8 trig_type);
int mt7915_mcu_set_mu_dl_ack_policy(struct mt7915_phy *phy, u8 policy_num);
@@ -22,7 +22,7 @@
void mt7915_mcu_set_nusers_ofdma(struct mt7915_phy *phy, u8 type, u8 ofdma_user_cnt);
void mt7915_mcu_set_mimo(struct mt7915_phy *phy, u8 direction);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index b653c34..dad5ed7 100644
+index c00184f8..c8efd266 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2852,6 +2852,16 @@ static int mt7915_sta_tx_amsdu_set(void *data, u64 tx_amsdu)
diff --git a/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-add-mt7981-efuse-variants-support.patch b/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-add-mt7981-efuse-variants-support.patch
index 2260e5f..39612b0 100644
--- a/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-add-mt7981-efuse-variants-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-add-mt7981-efuse-variants-support.patch
@@ -1,7 +1,7 @@
-From 51410d3e134142548c1432c0ea5c07635d8646a5 Mon Sep 17 00:00:00 2001
+From 90dfcdd20e564dc3b82342141dfd6917899b7b66 Mon Sep 17 00:00:00 2001
From: "Henry.Yen" <henry.yen@mediatek.com>
Date: Mon, 11 Dec 2023 16:01:55 +0800
-Subject: [PATCH 1039/1051] wifi: mt76: mt7915 add mt7981 efuse variants
+Subject: [PATCH 1039/1052] wifi: mt76: mt7915 add mt7981 efuse variants
support
---
@@ -10,7 +10,7 @@
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index 6133c20..df5e396 100644
+index 6133c200..df5e396c 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
@@ -193,6 +193,21 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
@@ -50,10 +50,10 @@
mt7915_eeprom_parse_band_config(phy);
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 3dc99f8..3170aca 100644
+index 183d59da..c8f9ed52 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -409,6 +409,7 @@ struct mt7915_dev {
+@@ -424,6 +424,7 @@ struct mt7915_dev {
u32 hw_pattern;
@@ -61,7 +61,7 @@
bool dbdc_support;
bool flash_mode;
bool bin_file_mode;
-@@ -684,7 +685,11 @@ void mt7915_tm_rf_test_event(struct mt7915_dev *dev, struct sk_buff *skb);
+@@ -698,7 +699,11 @@ void mt7915_tm_rf_test_event(struct mt7915_dev *dev, struct sk_buff *skb);
static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev)
{
diff --git a/recipes-wifi/linux-mt76/files/patches/1040-wifi-mt76-mt7915-support-scs-feature.patch b/recipes-wifi/linux-mt76/files/patches/1040-wifi-mt76-mt7915-support-scs-feature.patch
index e826d19..0f39a4a 100644
--- a/recipes-wifi/linux-mt76/files/patches/1040-wifi-mt76-mt7915-support-scs-feature.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1040-wifi-mt76-mt7915-support-scs-feature.patch
@@ -1,7 +1,7 @@
-From 28300199dbd301df08b570d527aeb76adac50343 Mon Sep 17 00:00:00 2001
+From 5ba9ebc9e86610960d798ff1103350d2d3453a90 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Wed, 6 Dec 2023 08:53:03 +0800
-Subject: [PATCH 1040/1041] wifi: mt76: mt7915: support scs feature
+Subject: [PATCH 1040/1052] wifi: mt76: mt7915: support scs feature
Add support scs feature for connac2 codebase. This commit includes three
parts.
@@ -29,7 +29,7 @@
9 files changed, 188 insertions(+)
diff --git a/mt76.h b/mt76.h
-index 86e4a60..8450d3b 100644
+index 16b76b48..43f3c282 100644
--- a/mt76.h
+++ b/mt76.h
@@ -311,6 +311,7 @@ struct mt76_sta_stats {
@@ -49,7 +49,7 @@
enum mt76_wcid_flags {
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index dc2a47d..8b7fe87 100644
+index 49c3f1aa..febe3ed4 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1238,6 +1238,7 @@ enum {
@@ -61,10 +61,10 @@
MCU_EXT_CMD_FW_DBG_CTRL = 0x95,
MCU_EXT_CMD_OFFCH_SCAN_CTRL = 0x9a,
diff --git a/mt7915/init.c b/mt7915/init.c
-index 4dbb84a..ec61911 100644
+index c4685f21..a26e0d69 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -1219,6 +1219,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1222,6 +1222,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
spin_lock_init(&dev->phy.stats_lock);
INIT_WORK(&dev->rc_work, mt7915_mac_sta_rc_work);
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
@@ -73,7 +73,7 @@
INIT_LIST_HEAD(&dev->twt_list);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index c421447..fb98940 100644
+index c421447c..fb989405 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1463,6 +1463,8 @@ mt7915_mac_full_reset(struct mt7915_dev *dev)
@@ -116,7 +116,7 @@
wiphy_name(dev->mt76.hw->wiphy));
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index 05076b3..ba009e6 100644
+index 75042189..04301300 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -89,12 +89,24 @@ int mt7915_run(struct ieee80211_hw *hw)
@@ -153,7 +153,7 @@
mt7915_mcu_set_mac(dev, dev->phy.mt76->band_idx, false, false);
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 052ec99..297ded7 100644
+index 40d94c4f..fcbe4da4 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -5238,3 +5238,121 @@ int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val)
@@ -279,7 +279,7 @@
+ ieee80211_queue_delayed_work(mt76_hw(dev), &dev->scs_work, HZ);
+}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 3089fb6..742a785 100644
+index 3089fb64..742a7855 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -1200,4 +1200,8 @@ struct mt7915_mcu_edcca_info {
@@ -292,7 +292,7 @@
+};
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index c8f9ed5..6b27be9 100644
+index c8f9ed52..6b27be9c 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -283,6 +283,15 @@ struct mt7915_air_monitor_ctrl {
@@ -338,7 +338,7 @@
#ifdef MTK_DEBUG
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index c8efd26..e60dc85 100644
+index c8efd266..e60dc850 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3820,6 +3820,29 @@ mt7915_sr_enable_set(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/1041-wifi-mt76-mt7915-support-thermal-recal-debug-commnad.patch b/recipes-wifi/linux-mt76/files/patches/1041-wifi-mt76-mt7915-support-thermal-recal-debug-commnad.patch
index 4576a2c..51ad6bc 100644
--- a/recipes-wifi/linux-mt76/files/patches/1041-wifi-mt76-mt7915-support-thermal-recal-debug-commnad.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1041-wifi-mt76-mt7915-support-thermal-recal-debug-commnad.patch
@@ -1,7 +1,7 @@
-From 9fd80f6b724ba3f7272da8856e3b3d07d04dadb8 Mon Sep 17 00:00:00 2001
+From 71385726a0af02c6cb650a6be60511e6f0f1b3a4 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 21 Dec 2023 20:35:36 +0800
-Subject: [PATCH 1041/1041] wifi: mt76: mt7915: support thermal recal debug
+Subject: [PATCH 1041/1052] wifi: mt76: mt7915: support thermal recal debug
commnad
Add thermal recal debug command:
@@ -21,7 +21,7 @@
4 files changed, 35 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 8b7fe87..c34c6e6 100644
+index febe3ed4..8a0f5bea 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1234,6 +1234,7 @@ enum {
@@ -33,7 +33,7 @@
MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d,
MCU_EXT_CMD_MWDS_SUPPORT = 0x80,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 297ded7..b66e5ea 100644
+index fcbe4da4..2b653bfb 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -5356,3 +5356,18 @@ void mt7915_mcu_scs_sta_poll(struct work_struct *work)
@@ -56,7 +56,7 @@
+ sizeof(req), true);
+}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 6b27be9..496ccd9 100644
+index 6b27be9c..496ccd94 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -835,6 +835,7 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
@@ -68,7 +68,7 @@
#ifdef MTK_DEBUG
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index e60dc85..0677495 100644
+index e60dc850..0677495c 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3843,6 +3843,22 @@ mt7915_scs_enable_set(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/1042-wifi-mt76-mt7915-Add-support-for-lpi-and-duplicate-m.patch b/recipes-wifi/linux-mt76/files/patches/1042-wifi-mt76-mt7915-Add-support-for-lpi-and-duplicate-m.patch
index 2508bd1..4dbc453 100644
--- a/recipes-wifi/linux-mt76/files/patches/1042-wifi-mt76-mt7915-Add-support-for-lpi-and-duplicate-m.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1042-wifi-mt76-mt7915-Add-support-for-lpi-and-duplicate-m.patch
@@ -1,7 +1,7 @@
-From 15b2679217535569b2c27dad231ad2c38857a3d2 Mon Sep 17 00:00:00 2001
+From 45dbb4f20ca056bd56f8c723a10d0f5662d92f75 Mon Sep 17 00:00:00 2001
From: Allen Ye <allen.ye@mediatek.com>
Date: Fri, 15 Dec 2023 14:03:11 +0800
-Subject: [PATCH 1042/1051] wifi: mt76: mt7915: Add support for lpi and
+Subject: [PATCH 1042/1052] wifi: mt76: mt7915: Add support for lpi and
duplicate mode
Add support lpi and duplicate mode.
@@ -31,7 +31,7 @@
12 files changed, 210 insertions(+), 17 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index aa33e7b..261d65a 100644
+index aa33e7b5..261d65ad 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -224,8 +224,9 @@ static bool mt76_string_prop_find(struct property *prop, const char *str)
@@ -95,7 +95,7 @@
return target_power;
diff --git a/mt76.h b/mt76.h
-index 7ffba7d..a7a8ece 100644
+index 43f3c282..a18b3e57 100644
--- a/mt76.h
+++ b/mt76.h
@@ -853,6 +853,9 @@ struct mt76_phy {
@@ -118,7 +118,7 @@
mt76_find_channel_node(struct device_node *np, struct ieee80211_channel *chan);
diff --git a/mt76_connac2_mac.h b/mt76_connac2_mac.h
-index eb47653..49ba39f 100644
+index eb476536..49ba39ff 100644
--- a/mt76_connac2_mac.h
+++ b/mt76_connac2_mac.h
@@ -355,6 +355,13 @@ enum tx_port_idx {
@@ -136,7 +136,7 @@
MT_TX_FRAG_NONE,
MT_TX_FRAG_FIRST,
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index c23d266..d170815 100644
+index c23d266e..d1708152 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -572,7 +572,8 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
@@ -161,10 +161,10 @@
txwi[7] &= ~cpu_to_le32(MT_TXD7_HW_AMSDU);
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index e445046..4f87e25 100644
+index 8a0f5bea..3148526a 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1258,6 +1258,7 @@ enum {
+@@ -1260,6 +1260,7 @@ enum {
MCU_EXT_CMD_SWLNA_ACI_CTRL = 0xc0,
MCU_EXT_CMD_CSI_CTRL = 0xc2,
MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
@@ -173,7 +173,7 @@
enum {
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 502b493..b2a4ff4 100644
+index 2c1e1bea..f031b54c 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1297,7 +1297,6 @@ mt7915_txpower_info_show(struct seq_file *file, void *data)
@@ -194,10 +194,10 @@
out:
diff --git a/mt7915/init.c b/mt7915/init.c
-index 2196d5f..9932266 100644
+index a26e0d69..e8a6fcda 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -287,7 +287,7 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
+@@ -288,7 +288,7 @@ static void __mt7915_init_txpower(struct mt7915_phy *phy,
phy->sku_limit_en = true;
phy->sku_path_en = true;
@@ -206,7 +206,7 @@
for (i = 0; i < sband->n_channels; i++) {
struct ieee80211_channel *chan = &sband->channels[i];
u32 target_power = 0;
-@@ -331,8 +331,10 @@ void mt7915_init_txpower(struct mt7915_phy *phy)
+@@ -332,8 +332,10 @@ void mt7915_init_txpower(struct mt7915_phy *phy)
__mt7915_init_txpower(phy, &phy->mt76->sband_2g.sband);
if (phy->mt76->cap.has_5ghz)
__mt7915_init_txpower(phy, &phy->mt76->sband_5g.sband);
@@ -219,7 +219,7 @@
static void
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 87409a4..196cc33 100644
+index 2b653bfb..0fba0a6d 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1522,7 +1522,8 @@ mt7915_mcu_set_spe_idx(struct mt7915_dev *dev, struct ieee80211_vif *vif,
@@ -355,10 +355,10 @@
u8 en)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 2981e5a..d524fbf 100644
+index 496ccd94..74008d4f 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -810,6 +810,7 @@ int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
+@@ -826,6 +826,7 @@ void mt7915_csi_mac_filter_clear(struct mt7915_phy *phy);
void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
struct ieee80211_sta *sta);
@@ -367,7 +367,7 @@
int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 53294c1..352b8e9 100644
+index 0677495c..3291aafc 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3945,6 +3945,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
@@ -379,10 +379,10 @@
debugfs_create_devm_seqfile(dev->mt76.dev, "eeprom_mode", dir,
mt7915_show_eeprom_mode);
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 432d750..566fec0 100644
+index 6446439f..a9e87a17 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -106,6 +106,13 @@ bss_color_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL] = {
+@@ -107,6 +107,13 @@ bss_color_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL] = {
[MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP] = { .type = NLA_U64 },
};
@@ -396,7 +396,7 @@
struct csi_null_tone {
u8 start;
u8 end;
-@@ -1335,6 +1342,63 @@ mt7915_vendor_bss_color_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev
+@@ -1471,6 +1478,63 @@ mt7915_vendor_bss_color_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev
return len;
}
@@ -460,7 +460,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
.info = {
-@@ -1451,6 +1515,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1587,6 +1651,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.dumpit = mt7915_vendor_bss_color_ctrl_dump,
.policy = bss_color_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX,
@@ -479,7 +479,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 03d1660..5b8a1fb 100644
+index 11ccd0d8..3040007f 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -16,6 +16,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -490,7 +490,7 @@
};
-@@ -274,4 +275,18 @@ enum mtk_vendor_attr_bss_color_ctrl {
+@@ -287,4 +288,18 @@ enum mtk_vendor_attr_bss_color_ctrl {
MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX =
NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL - 1
};
diff --git a/recipes-wifi/linux-mt76/files/patches/1043-wifi-mt76-testmode-add-cheetah-support.patch b/recipes-wifi/linux-mt76/files/patches/1043-wifi-mt76-testmode-add-cheetah-support.patch
index fcc126c..c568929 100644
--- a/recipes-wifi/linux-mt76/files/patches/1043-wifi-mt76-testmode-add-cheetah-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1043-wifi-mt76-testmode-add-cheetah-support.patch
@@ -1,7 +1,7 @@
-From 6adb4d938ebedcb3e842640678b8aa510ee0b088 Mon Sep 17 00:00:00 2001
+From 3eec1f57a5ad5fd0322ac69360cac993ef9f8902 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 31 Oct 2023 16:29:13 +0800
-Subject: [PATCH 1043/1051] wifi: mt76: testmode: add cheetah support
+Subject: [PATCH 1043/1052] wifi: mt76: testmode: add cheetah support
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -9,7 +9,7 @@
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index faf6014..ecd6271 100644
+index faf60146..ecd62712 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -2151,7 +2151,7 @@ mt7915_tm_group_prek(struct mt7915_phy *phy, enum mt76_testmode_state state)
diff --git a/recipes-wifi/linux-mt76/files/patches/1044-wifi-mt76-mt7915-add-no_beacon-vendor-command-for-ce.patch b/recipes-wifi/linux-mt76/files/patches/1044-wifi-mt76-mt7915-add-no_beacon-vendor-command-for-ce.patch
index 0f1deb4..bcc0450 100644
--- a/recipes-wifi/linux-mt76/files/patches/1044-wifi-mt76-mt7915-add-no_beacon-vendor-command-for-ce.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1044-wifi-mt76-mt7915-add-no_beacon-vendor-command-for-ce.patch
@@ -1,7 +1,7 @@
-From 2a8762458470dcbeb3619d6833b7a072b3f57c4d Mon Sep 17 00:00:00 2001
+From e91a2d40ac3cb7c76827b894c03e31e577944f68 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Date: Wed, 24 Jan 2024 14:39:14 +0800
-Subject: [PATCH 1044/1051] wifi: mt76: mt7915: add no_beacon vendor command
+Subject: [PATCH 1044/1052] wifi: mt76: mt7915: add no_beacon vendor command
for cert
Add the vendor command to disable/enable beacon
@@ -21,7 +21,7 @@
4 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 196cc33..fda1efe 100644
+index 0fba0a6d..b1cb7747 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -5101,6 +5101,17 @@ int mt7915_mcu_set_rfeature_trig_type(struct mt7915_phy *phy, u8 enable, u8 trig
@@ -43,10 +43,10 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index d524fbf..223e034 100644
+index 74008d4f..8b2e360e 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -811,6 +811,7 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
+@@ -827,6 +827,7 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
struct ieee80211_sta *sta);
int mt7915_mcu_set_lpi(struct mt7915_phy *phy, bool en);
@@ -55,10 +55,10 @@
int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 566fec0..6154d1a 100644
+index a9e87a17..309480d1 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -113,6 +113,11 @@ txpower_ctrl_policy[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL] = {
+@@ -114,6 +114,11 @@ txpower_ctrl_policy[NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL] = {
[MTK_VENDOR_ATTR_TXPOWER_CTRL_BCN_DUP] = { .type = NLA_U8 },
};
@@ -70,7 +70,7 @@
struct csi_null_tone {
u8 start;
u8 end;
-@@ -1399,6 +1404,30 @@ static int mt7915_vendor_txpower_ctrl(struct wiphy *wiphy,
+@@ -1535,6 +1540,30 @@ static int mt7915_vendor_txpower_ctrl(struct wiphy *wiphy,
return 0;
}
@@ -101,7 +101,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
.info = {
-@@ -1526,7 +1555,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1662,7 +1691,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.doit = mt7915_vendor_txpower_ctrl,
.policy = txpower_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_TXPOWER_CTRL_MAX,
@@ -122,7 +122,7 @@
void mt7915_vendor_register(struct mt7915_phy *phy)
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 5b8a1fb..661d636 100644
+index 3040007f..bcde5d3c 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -16,6 +16,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -133,7 +133,7 @@
MTK_NL80211_VENDOR_SUBCMD_TXPOWER_CTRL = 0xce,
};
-@@ -289,4 +290,15 @@ enum mtk_vendor_attr_txpower_ctrl {
+@@ -302,4 +303,15 @@ enum mtk_vendor_attr_txpower_ctrl {
NUM_MTK_VENDOR_ATTRS_TXPOWER_CTRL - 1
};
diff --git a/recipes-wifi/linux-mt76/files/patches/1045-wifi-mt76-mt7915-support-spatial-reuse-debug-command.patch b/recipes-wifi/linux-mt76/files/patches/1045-wifi-mt76-mt7915-support-spatial-reuse-debug-command.patch
index d30d6be..495efa1 100644
--- a/recipes-wifi/linux-mt76/files/patches/1045-wifi-mt76-mt7915-support-spatial-reuse-debug-command.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1045-wifi-mt76-mt7915-support-spatial-reuse-debug-command.patch
@@ -1,7 +1,7 @@
-From e64321af1c112f7a5f4c72a23fe96573b7f14a1f Mon Sep 17 00:00:00 2001
+From 40e0945208ca6569cc032b59f935223b8fac19f4 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 15 Feb 2024 11:16:16 +0800
-Subject: [PATCH 1045/1051] wifi: mt76: mt7915: support spatial reuse debug
+Subject: [PATCH 1045/1052] wifi: mt76: mt7915: support spatial reuse debug
commands
Support 3 spatial reuse debug commands:
@@ -19,10 +19,10 @@
5 files changed, 191 insertions(+), 4 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 4f87e25..292ef0f 100644
+index 3148526a..d8b001f1 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1031,6 +1031,7 @@ enum {
+@@ -1032,6 +1032,7 @@ enum {
MCU_EXT_EVENT_WA_TX_STAT = 0x74,
MCU_EXT_EVENT_BCC_NOTIFY = 0x75,
MCU_EXT_EVENT_MURU_CTRL = 0x9f,
@@ -31,7 +31,7 @@
};
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index fda1efe..cb78961 100644
+index b1cb7747..e505664e 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -452,6 +452,91 @@ mt7915_mcu_rx_bss_acq_pkt_cnt(struct mt7915_dev *dev, struct sk_buff * skb)
@@ -158,7 +158,7 @@
return 0;
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 742a785..f476767 100644
+index 742a7855..f4767671 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -42,6 +42,45 @@ struct mt7915_mcu_thermal_notify {
@@ -233,10 +233,10 @@
THERMAL_PROTECT_PARAMETER_CTRL,
THERMAL_PROTECT_BASIC_INFO,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 223e034..a6901dd 100644
+index 8b2e360e..10d48495 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -356,6 +356,9 @@ struct mt7915_phy {
+@@ -371,6 +371,9 @@ struct mt7915_phy {
struct mt7915_air_monitor_ctrl amnt_ctrl;
#endif
struct mt7915_scs_ctrl scs_ctrl;
@@ -247,7 +247,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 352b8e9..0f72f30 100644
+index 3291aafc..c8dd569c 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3809,16 +3809,34 @@ mt7915_sw_aci_set(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/1046-wifi-mt76-try-more-times-when-send-message-timeout.patch b/recipes-wifi/linux-mt76/files/patches/1046-wifi-mt76-try-more-times-when-send-message-timeout.patch
index 8416215..cec5940 100644
--- a/recipes-wifi/linux-mt76/files/patches/1046-wifi-mt76-try-more-times-when-send-message-timeout.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1046-wifi-mt76-try-more-times-when-send-message-timeout.patch
@@ -1,10 +1,9 @@
-From 526b34aec94a2d244441a844c84862e35f1162a5 Mon Sep 17 00:00:00 2001
+From 73508da4263fcc10cd059fd89ef4017f9725324d Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Thu, 7 Mar 2024 11:13:45 +0800
-Subject: [PATCH 1046/1051] wifi: mt76: try more times when send message
+Subject: [PATCH 1046/1052] wifi: mt76: try more times when send message
timeout.
-CR-Id: WCNCR00334773
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
dma.c | 7 ++++--
@@ -13,7 +12,7 @@
3 files changed, 64 insertions(+), 52 deletions(-)
diff --git a/dma.c b/dma.c
-index bc8afcf..133a50d 100644
+index bc8afcff..133a50dc 100644
--- a/dma.c
+++ b/dma.c
@@ -504,9 +504,12 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
@@ -40,7 +39,7 @@
static int
diff --git a/mcu.c b/mcu.c
-index fa4b054..de185cc 100644
+index fa4b0544..de185cc9 100644
--- a/mcu.c
+++ b/mcu.c
@@ -4,6 +4,7 @@
@@ -133,7 +132,7 @@
return ret;
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index fb98940..b3c9163 100644
+index fb989405..b3c91633 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1348,12 +1348,6 @@ mt7915_mac_restart(struct mt7915_dev *dev)
diff --git a/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch b/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch
index b8314fd..d7f7244 100644
--- a/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch
@@ -1,9 +1,8 @@
-From 0f8d644d9c7ab28e9e4da56151987a3e4be1f55f Mon Sep 17 00:00:00 2001
+From 1b93f1495d5f28a7620add2ebea0f691ff6e8a0d Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Tue, 6 Feb 2024 14:46:59 +0800
-Subject: [PATCH 1047/1051] wifi: mt76: mt7915: add SER overlap handle
+Subject: [PATCH 1047/1052] wifi: mt76: mt7915: add SER overlap handle
-CR-ID: WCNCR00355921
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
dma.c | 3 ++-
@@ -14,7 +13,7 @@
5 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/dma.c b/dma.c
-index 133a50d..100d2af 100644
+index 133a50dc..100d2aff 100644
--- a/dma.c
+++ b/dma.c
@@ -506,7 +506,8 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
@@ -28,7 +27,7 @@
goto error;
}
diff --git a/mcu.c b/mcu.c
-index de185cc..1bc94e8 100644
+index de185cc9..1bc94e85 100644
--- a/mcu.c
+++ b/mcu.c
@@ -42,7 +42,9 @@ struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
@@ -53,7 +52,7 @@
dev_err(dev->dev, "send message %08x timeout, try again(%d).\n",
cmd, (MT76_MSG_MAX_RETRY_CNT - retry_cnt));
diff --git a/mt76.h b/mt76.h
-index a7a8ece..e6482e5 100644
+index a18b3e57..49ddaade 100644
--- a/mt76.h
+++ b/mt76.h
@@ -478,6 +478,14 @@ enum {
@@ -80,7 +79,7 @@
u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index b3c9163..c84b957 100644
+index b3c91633..c84b9573 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1538,6 +1538,7 @@ void mt7915_mac_reset_work(struct work_struct *work)
@@ -116,7 +115,7 @@
wake_up(&dev->reset_wait);
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index cb78961..f890063 100644
+index e505664e..272db06a 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -198,6 +198,13 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
diff --git a/recipes-wifi/linux-mt76/files/patches/1048-wifi-mt76-mt7915-add-background-radar-hw-cap-check.patch b/recipes-wifi/linux-mt76/files/patches/1048-wifi-mt76-mt7915-add-background-radar-hw-cap-check.patch
index 17e299e..ec0a323 100644
--- a/recipes-wifi/linux-mt76/files/patches/1048-wifi-mt76-mt7915-add-background-radar-hw-cap-check.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1048-wifi-mt76-mt7915-add-background-radar-hw-cap-check.patch
@@ -1,7 +1,7 @@
-From 3ad316d5a0d9caa9a07597ac59df0663daf3e319 Mon Sep 17 00:00:00 2001
+From 04882a33afbee2fd86cdb244a0faf0748f163b31 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 4 Mar 2024 11:29:06 +0800
-Subject: [PATCH 1048/1051] wifi: mt76: mt7915: add background radar hw cap
+Subject: [PATCH 1048/1052] wifi: mt76: mt7915: add background radar hw cap
check
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -12,7 +12,7 @@
3 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index b2a4ff4..03daf44 100644
+index f031b54c..3fd1654c 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -459,6 +459,11 @@ mt7915_rdd_monitor(struct seq_file *s, void *data)
@@ -28,7 +28,7 @@
ret = -EINVAL;
goto out;
diff --git a/mt7915/eeprom.h b/mt7915/eeprom.h
-index 70fca0b..adeee10 100644
+index 70fca0b3..adeee104 100644
--- a/mt7915/eeprom.h
+++ b/mt7915/eeprom.h
@@ -55,6 +55,7 @@ enum mt7915_eeprom_field {
@@ -76,10 +76,10 @@
#endif
diff --git a/mt7915/init.c b/mt7915/init.c
-index 9932266..dc1b34d 100644
+index e8a6fcda..03c86ae0 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -404,9 +404,10 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+@@ -405,9 +405,10 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
if (!is_mt7915(&dev->mt76))
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
diff --git a/recipes-wifi/linux-mt76/files/patches/1049-wifi-mt76-mt7915-add-foolproof-mechanism-for-ZWDFS-d.patch b/recipes-wifi/linux-mt76/files/patches/1049-wifi-mt76-mt7915-add-foolproof-mechanism-for-ZWDFS-d.patch
index 8aaa151..e626535 100644
--- a/recipes-wifi/linux-mt76/files/patches/1049-wifi-mt76-mt7915-add-foolproof-mechanism-for-ZWDFS-d.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1049-wifi-mt76-mt7915-add-foolproof-mechanism-for-ZWDFS-d.patch
@@ -1,7 +1,7 @@
-From 1de92bb3d5a816769f306322ae3c213adbacc6f1 Mon Sep 17 00:00:00 2001
+From 7f45a6881d88e92180fe2b162800b8334d005a5f Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 6 Mar 2024 11:30:34 +0800
-Subject: [PATCH 1049/1051] wifi: mt76: mt7915: add foolproof mechanism for
+Subject: [PATCH 1049/1052] wifi: mt76: mt7915: add foolproof mechanism for
ZWDFS during radar detected & triggered
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -11,7 +11,7 @@
2 files changed, 8 insertions(+)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 03daf44..d8ca90a 100644
+index 3fd1654c..522e2999 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -231,6 +231,11 @@ mt7915_radar_trigger(void *data, u64 val)
@@ -27,7 +27,7 @@
val, 0, 0);
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index f890063..853a50e 100644
+index 272db06a..250b05ec 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -302,6 +302,9 @@ mt7915_mcu_rx_radar_detected(struct mt7915_dev *dev, struct sk_buff *skb)
diff --git a/recipes-wifi/linux-mt76/files/patches/1050-mtk-wifi-mt76-mt7915-assign-DEAUTH-to-ALTX-queue-for.patch b/recipes-wifi/linux-mt76/files/patches/1050-mtk-wifi-mt76-mt7915-assign-DEAUTH-to-ALTX-queue-for.patch
index 2c5f484..05e22ba 100644
--- a/recipes-wifi/linux-mt76/files/patches/1050-mtk-wifi-mt76-mt7915-assign-DEAUTH-to-ALTX-queue-for.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1050-mtk-wifi-mt76-mt7915-assign-DEAUTH-to-ALTX-queue-for.patch
@@ -1,7 +1,7 @@
-From 236bc42c90160e3526d8901f3d983ebc76316ee2 Mon Sep 17 00:00:00 2001
+From 2ed70c162a13b4b4af3bfc7a806e8cfab29126f7 Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Tue, 19 Mar 2024 08:35:26 +0800
-Subject: [PATCH 1050/1051] mtk: wifi: mt76: mt7915: assign DEAUTH to ALTX
+Subject: [PATCH 1050/1052] mtk: wifi: mt76: mt7915: assign DEAUTH to ALTX
queue for CERT
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 10 insertions(+)
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index d170815..21dadb5 100644
+index d1708152..21dadb55 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -385,6 +385,8 @@ mt76_connac2_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,
diff --git a/recipes-wifi/linux-mt76/files/patches/1051-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch b/recipes-wifi/linux-mt76/files/patches/1051-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch
index b969ef3..eabad84 100644
--- a/recipes-wifi/linux-mt76/files/patches/1051-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1051-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch
@@ -1,7 +1,7 @@
-From 29807a01daba2d3042a76b2427fbb24e1da71b28 Mon Sep 17 00:00:00 2001
+From 1d18008ab9d67f318932ed993103bd46d9f0215d Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 21 Mar 2024 16:52:34 +0800
-Subject: [PATCH 1051/1051] wifi: mt76: mt7915: set channel after sta is
+Subject: [PATCH 1051/1052] wifi: mt76: mt7915: set channel after sta is
associated to adjust switch reason
when sta is associated to AP operating in DFS channel, a channel
@@ -16,7 +16,7 @@
1 file changed, 26 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index da998e1..c97974a 100644
+index 04301300..eab45737 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -794,6 +794,31 @@ out:
@@ -51,7 +51,7 @@
int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
-@@ -1784,6 +1809,7 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1835,6 +1860,7 @@ const struct ieee80211_ops mt7915_ops = {
.set_sar_specs = mt7915_set_sar_specs,
.channel_switch_beacon = mt7915_channel_switch_beacon,
.post_channel_switch = mt7915_post_channel_switch,
diff --git a/recipes-wifi/linux-mt76/files/patches/1052-wifi-mt76-mt7915-Clear-private-driver-data-in-case-o.patch b/recipes-wifi/linux-mt76/files/patches/1052-wifi-mt76-mt7915-Clear-private-driver-data-in-case-o.patch
index 2f6e452..a9ff608 100644
--- a/recipes-wifi/linux-mt76/files/patches/1052-wifi-mt76-mt7915-Clear-private-driver-data-in-case-o.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1052-wifi-mt76-mt7915-Clear-private-driver-data-in-case-o.patch
@@ -1,8 +1,8 @@
-From f92bc600352365982f4c674de61454dfdcba6bcd Mon Sep 17 00:00:00 2001
+From 903edd4667682289fca8cb7fac0f407c34598e5c Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Fri, 5 Jul 2024 17:50:29 +0800
-Subject: [PATCH] wifi: mt76: mt7915: Clear private driver data in case of
- reuse
+Subject: [PATCH 1052/1052] wifi: mt76: mt7915: Clear private driver data in
+ case of reuse
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
---
@@ -10,7 +10,7 @@
1 file changed, 3 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 6912ea7..4a4c372 100644
+index eab45737..8c498683 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -230,6 +230,9 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
diff --git a/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch b/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch
index 1d5e567..0653704 100644
--- a/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch
@@ -1,4 +1,4 @@
-From 3af8d78c5f9622276367d9e71921fe25f9d211b5 Mon Sep 17 00:00:00 2001
+From aba91915c426953a680062a8e3528b7ca90054e9 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 10:38:53 +0800
Subject: [PATCH 2000/2015] wifi: mt76: mt7915: wed: add wed tx support
@@ -14,7 +14,7 @@
6 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
-index 8e7068c..e1d6ca2 100644
+index 5356c52c..93856347 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -130,6 +130,7 @@ struct mt76_connac_sta_key_conf {
@@ -26,7 +26,7 @@
struct mt76_connac_fw_txp {
__le16 flags;
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index c84b957..1c8b873 100644
+index c84b9573..1c8b8732 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -878,9 +878,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
@@ -67,10 +67,10 @@
static void
diff --git a/mt7915/main.c b/mt7915/main.c
-index c97974a..ed7ade1 100644
+index 8c498683..ff0337a6 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1761,14 +1761,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1816,14 +1816,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
if (!mtk_wed_device_active(wed))
return -ENODEV;
@@ -88,7 +88,7 @@
ctx->dev = NULL;
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 437a9b0..91100f1 100644
+index b1b219ce..53648212 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -13,7 +13,7 @@
@@ -109,7 +109,7 @@
ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
if (ret)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index a6901dd..2dce288 100644
+index 10d48495..d93ab970 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -62,7 +62,7 @@
@@ -122,7 +122,7 @@
#define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
diff --git a/wed.c b/wed.c
-index f7a3f1b..47c81a2 100644
+index f7a3f1b3..47c81a28 100644
--- a/wed.c
+++ b/wed.c
@@ -187,7 +187,7 @@ void mt76_wed_offload_disable(struct mtk_wed_device *wed)
diff --git a/recipes-wifi/linux-mt76/files/patches/2001-wifi-mt76-mt7915-wed-add-wds-support-when-wed-is-ena.patch b/recipes-wifi/linux-mt76/files/patches/2001-wifi-mt76-mt7915-wed-add-wds-support-when-wed-is-ena.patch
index c8e6888..35edec4 100644
--- a/recipes-wifi/linux-mt76/files/patches/2001-wifi-mt76-mt7915-wed-add-wds-support-when-wed-is-ena.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2001-wifi-mt76-mt7915-wed-add-wds-support-when-wed-is-ena.patch
@@ -1,4 +1,4 @@
-From 0454c032c589da59ef4e44654d2f650e273e215a Mon Sep 17 00:00:00 2001
+From 2845e9a6b55d63d970541c8322eec387bfa252e4 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Tue, 13 Dec 2022 17:51:26 +0800
Subject: [PATCH 2001/2015] wifi: mt76: mt7915: wed: add wds support when wed
@@ -15,7 +15,7 @@
6 files changed, 82 insertions(+), 10 deletions(-)
diff --git a/mt76.h b/mt76.h
-index e6482e5..6168758 100644
+index 49ddaade..411a9576 100644
--- a/mt76.h
+++ b/mt76.h
@@ -78,6 +78,12 @@ enum mt76_wed_type {
@@ -32,10 +32,10 @@
u32 (*rr)(struct mt76_dev *dev, u32 offset);
void (*wr)(struct mt76_dev *dev, u32 offset, u32 val);
diff --git a/mt7915/main.c b/mt7915/main.c
-index ed7ade1..6276230 100644
+index ff0337a6..778c73e9 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -831,8 +831,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -834,8 +834,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
#endif
int ret, idx;
u32 addr;
@@ -52,7 +52,7 @@
if (idx < 0)
return -ENOSPC;
-@@ -1323,6 +1330,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
+@@ -1335,6 +1342,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
else
clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
@@ -66,7 +66,7 @@
mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
}
-@@ -1768,8 +1782,12 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1823,8 +1837,12 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
path->dev = ctx->dev;
path->mtk_wdma.wdma_idx = wed->wdma_idx;
path->mtk_wdma.bss = mvif->mt76.idx;
@@ -81,7 +81,7 @@
ctx->dev = NULL;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 853a50e..4390f42 100644
+index 250b05ec..7927a523 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2588,10 +2588,18 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
@@ -108,7 +108,7 @@
ret = mt7915_mcu_set_mwds(dev, 1);
if (ret)
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index f476767..52baaa7 100644
+index f4767671..52baaa73 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -392,6 +392,7 @@ enum {
@@ -120,7 +120,7 @@
MCU_WA_PARAM_RED_SHOW_STA = 0xf,
MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
diff --git a/util.c b/util.c
-index fc76c66..61b2d30 100644
+index d6c01a2d..995d7880 100644
--- a/util.c
+++ b/util.c
@@ -42,9 +42,14 @@ bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
@@ -188,7 +188,7 @@
int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy)
{
diff --git a/util.h b/util.h
-index 260965d..99b7263 100644
+index 260965dd..99b7263c 100644
--- a/util.h
+++ b/util.h
@@ -27,7 +27,12 @@ enum {
diff --git a/recipes-wifi/linux-mt76/files/patches/2002-wifi-mt76-mt7915-wed-add-fill-receive-path-to-report.patch b/recipes-wifi/linux-mt76/files/patches/2002-wifi-mt76-mt7915-wed-add-fill-receive-path-to-report.patch
index be6d9da..6e78804 100644
--- a/recipes-wifi/linux-mt76/files/patches/2002-wifi-mt76-mt7915-wed-add-fill-receive-path-to-report.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2002-wifi-mt76-mt7915-wed-add-fill-receive-path-to-report.patch
@@ -1,4 +1,4 @@
-From 21586d3a17ba293d3d80bd93fb404729647820bd Mon Sep 17 00:00:00 2001
+From 0f848ffb35cc45beb156069d3856b14414e9a6ee Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 19 May 2023 07:05:22 +0800
Subject: [PATCH 2002/2015] wifi: mt76: mt7915: wed: add fill receive path to
@@ -10,10 +10,10 @@
1 file changed, 18 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 6276230..fbb2aff 100644
+index 778c73e9..abafa5e4 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1798,6 +1798,23 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1848,6 +1848,23 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
return 0;
}
@@ -37,7 +37,7 @@
#endif
const struct ieee80211_ops mt7915_ops = {
-@@ -1855,6 +1872,7 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1910,6 +1927,7 @@ const struct ieee80211_ops mt7915_ops = {
.set_radar_background = mt7915_set_radar_background,
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
.net_fill_forward_path = mt7915_net_fill_forward_path,
diff --git a/recipes-wifi/linux-mt76/files/patches/2003-wifi-mt76-mt7915-wed-find-rx-token-by-physical-addre.patch b/recipes-wifi/linux-mt76/files/patches/2003-wifi-mt76-mt7915-wed-find-rx-token-by-physical-addre.patch
index f2e3d14..ef36792 100644
--- a/recipes-wifi/linux-mt76/files/patches/2003-wifi-mt76-mt7915-wed-find-rx-token-by-physical-addre.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2003-wifi-mt76-mt7915-wed-find-rx-token-by-physical-addre.patch
@@ -1,4 +1,4 @@
-From 5a0028b27ba80cb34d905a668e335fb2c55685d1 Mon Sep 17 00:00:00 2001
+From 6d6ae068e478b101556ae723c23533220a8daeb5 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 14:32:35 +0800
Subject: [PATCH 2003/2015] wifi: mt76: mt7915: wed: find rx token by physical
@@ -13,7 +13,7 @@
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/dma.c b/dma.c
-index 100d2af..185c6f1 100644
+index 100d2aff..185c6f12 100644
--- a/dma.c
+++ b/dma.c
@@ -444,9 +444,32 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
diff --git a/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch b/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
index f9bf272..65b6630 100644
--- a/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
@@ -1,4 +1,4 @@
-From 08b72ac5e48038ff9c6a13adeb5273c07ba6e5a6 Mon Sep 17 00:00:00 2001
+From 065fd51b334f21e004e8a0e03e4d90a4e8265d98 Mon Sep 17 00:00:00 2001
From: Lian Chen <lian.chen@mediatek.com>
Date: Mon, 7 Nov 2022 14:47:44 +0800
Subject: [PATCH 2004/2015] wifi: mt76: mt7915: wed: HW ATF support for mt7986
@@ -16,10 +16,10 @@
7 files changed, 796 insertions(+), 3 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 292ef0f..3786e69 100644
+index d8b001f1..1721f9b5 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1209,6 +1209,7 @@ enum {
+@@ -1211,6 +1211,7 @@ enum {
MCU_EXT_CMD_THERMAL_CTRL = 0x2c,
MCU_EXT_CMD_WTBL_UPDATE = 0x32,
MCU_EXT_CMD_SET_DRR_CTRL = 0x36,
@@ -27,7 +27,7 @@
MCU_EXT_CMD_SET_RDD_CTRL = 0x3a,
MCU_EXT_CMD_ATE_CTRL = 0x3d,
MCU_EXT_CMD_PROTECT_CTRL = 0x3e,
-@@ -1218,6 +1219,7 @@ enum {
+@@ -1220,6 +1221,7 @@ enum {
MCU_EXT_CMD_MUAR_UPDATE = 0x48,
MCU_EXT_CMD_BCN_OFFLOAD = 0x49,
MCU_EXT_CMD_RX_AIRTIME_CTRL = 0x4a,
@@ -36,7 +36,7 @@
MCU_EXT_CMD_EFUSE_FREE_BLOCK = 0x4f,
MCU_EXT_CMD_TX_POWER_FEATURE_CTRL = 0x58,
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index d8ca90a..3ae4aca 100644
+index 522e2999..576ec1a5 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -12,6 +12,10 @@
@@ -409,7 +409,7 @@
static int
mt7915_radar_trigger(void *data, u64 val)
{
-@@ -1526,6 +1882,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
+@@ -1571,6 +1927,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
mt7915_twt_stats);
debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
@@ -418,10 +418,10 @@
if (!dev->dbdc_support || phy->mt76->band_idx) {
debugfs_create_u32("dfs_hw_pattern", 0400, dir,
diff --git a/mt7915/init.c b/mt7915/init.c
-index dc1b34d..f38c8a1 100644
+index 03c86ae0..7f210669 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -588,9 +588,64 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
+@@ -589,9 +589,64 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
}
}
@@ -484,9 +484,9 @@
int i;
+ struct wiphy *wiphy = dev->phy.mt76->hw->wiphy;
- if (!is_mt7915(&dev->mt76))
- mt76_clear(dev, MT_MDP_DCR2, MT_MDP_DCR2_RX_TRANS_SHORT);
-@@ -604,6 +659,9 @@ void mt7915_mac_init(struct mt7915_dev *dev)
+ /* config pse qid6 wfdma port selection */
+ if (!is_mt7915(&dev->mt76) && dev->hif2)
+@@ -610,6 +665,9 @@ void mt7915_mac_init(struct mt7915_dev *dev)
mt7915_mac_init_band(dev, i);
mt7915_init_led_mux(dev);
@@ -497,7 +497,7 @@
int mt7915_txbf_init(struct mt7915_dev *dev)
diff --git a/mt7915/main.c b/mt7915/main.c
-index fbb2aff..feb2c89 100644
+index abafa5e4..ecfd9307 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -226,6 +226,7 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
@@ -508,7 +508,7 @@
struct mt76_txq *mtxq;
bool ext_phy = phy != &dev->phy;
int idx, ret = 0;
-@@ -288,6 +289,9 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
+@@ -291,6 +292,9 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
mt7915_mcu_add_sta(dev, vif, NULL, true);
rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid);
@@ -518,7 +518,7 @@
return ret;
}
-@@ -826,6 +830,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -829,6 +833,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
bool ext_phy = mvif->phy != &dev->phy;
@@ -526,7 +526,7 @@
#ifdef CONFIG_MTK_VENDOR
struct mt7915_phy *phy = ext_phy ? mt7915_ext_phy(dev) : &dev->phy;
#endif
-@@ -876,6 +881,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -879,6 +884,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (phy->muru_onoff & MUMIMO_DL_CERT)
mt7915_mcu_set_mimo(phy, 0);
#endif
@@ -543,7 +543,7 @@
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4390f42..e6e3152 100644
+index 7927a523..570dd171 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1866,7 +1866,7 @@ mt7915_mcu_add_group(struct mt7915_dev *dev, struct ieee80211_vif *vif,
@@ -746,7 +746,7 @@
{
#define MT_BF_PROCESSING 4
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 2dce288..1d0cfa1 100644
+index d93ab970..9ea30f1d 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -141,6 +141,58 @@ struct mt7915_twt_flow {
@@ -816,7 +816,7 @@
};
struct mt7915_vif_cap {
-@@ -492,6 +545,8 @@ struct mt7915_dev {
+@@ -507,6 +560,8 @@ struct mt7915_dev {
#endif
struct delayed_work scs_work;
@@ -825,7 +825,7 @@
bool wmm_pbc_enable;
struct work_struct wmm_pbc_work;
-@@ -528,6 +583,15 @@ enum mt7915_rdd_cmd {
+@@ -543,6 +598,15 @@ enum mt7915_rdd_cmd {
RDD_IRQ_OFF,
};
@@ -841,7 +841,7 @@
static inline struct mt7915_phy *
mt7915_hw_phy(struct ieee80211_hw *hw)
{
-@@ -657,6 +721,11 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
+@@ -672,6 +736,11 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
u8 en);
int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band);
@@ -854,7 +854,7 @@
int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy);
int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len,
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 0f72f30..14ea5bc 100644
+index c8dd569c..d6e92b12 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -1518,6 +1518,136 @@ static void chip_get_sta_pause(struct mt7915_dev *dev, u32 *sta_pause)
diff --git a/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch b/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch
index 053fc86..ae9b7c0 100644
--- a/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch
@@ -1,4 +1,4 @@
-From 4faced46403673e8089b9c4cc89d55f7d9fd5e6d Mon Sep 17 00:00:00 2001
+From b6184a94736ddea3277b1bea374686edb9aef6b4 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 6 Jan 2023 18:18:50 +0800
Subject: [PATCH 2005/2015] wifi: mt76: mt7915: wed: add rxwi for further in
@@ -17,7 +17,7 @@
8 files changed, 87 insertions(+), 80 deletions(-)
diff --git a/dma.c b/dma.c
-index 185c6f1..9cd97d2 100644
+index 185c6f12..9cd97d24 100644
--- a/dma.c
+++ b/dma.c
@@ -64,17 +64,17 @@ mt76_alloc_txwi(struct mt76_dev *dev)
@@ -245,10 +245,10 @@
unmap:
for (n--; n > 0; n--)
diff --git a/mac80211.c b/mac80211.c
-index f9dfdf8..225b290 100644
+index 750a642a..e50c68f8 100644
--- a/mac80211.c
+++ b/mac80211.c
-@@ -618,7 +618,6 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
+@@ -619,7 +619,6 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
spin_lock_init(&dev->lock);
spin_lock_init(&dev->cc_lock);
spin_lock_init(&dev->status_lock);
@@ -256,7 +256,7 @@
mutex_init(&dev->mutex);
init_waitqueue_head(&dev->tx_wait);
-@@ -651,6 +650,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
+@@ -652,6 +651,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
INIT_LIST_HEAD(&dev->txwi_cache);
INIT_LIST_HEAD(&dev->rxwi_cache);
dev->token_size = dev->drv->token_size;
@@ -265,7 +265,7 @@
for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++)
skb_queue_head_init(&dev->rx_skb[i]);
diff --git a/mt76.h b/mt76.h
-index 6168758..5e71267 100644
+index 411a9576..40884fd8 100644
--- a/mt76.h
+++ b/mt76.h
@@ -193,6 +193,7 @@ struct mt76_queue_entry {
@@ -323,7 +323,7 @@
void mt76_free_pending_rxwi(struct mt76_dev *dev);
void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
struct napi_struct *napi);
-@@ -1819,9 +1825,9 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
+@@ -1831,9 +1837,9 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi,
u8 phy_idx);
void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
@@ -336,7 +336,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 0baa82c..552410a 100644
+index 0baa82c8..552410aa 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -512,7 +512,6 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -356,7 +356,7 @@
}
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 91100f1..3391a94 100644
+index 53648212..baf35a53 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -725,7 +725,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -377,7 +377,7 @@
.tx_complete_skb = mt76_connac_tx_complete_skb,
.rx_skb = mt7915_queue_rx_skb,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 1d0cfa1..f5a7e1e 100644
+index 9ea30f1d..55af5c8c 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -64,6 +64,7 @@
@@ -389,7 +389,7 @@
#define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
#define MT7915_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
diff --git a/tx.c b/tx.c
-index db0d4df..92afbf5 100644
+index db0d4df5..92afbf5d 100644
--- a/tx.c
+++ b/tx.c
@@ -864,16 +864,16 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi,
@@ -434,7 +434,7 @@
}
EXPORT_SYMBOL_GPL(mt76_rx_token_release);
diff --git a/wed.c b/wed.c
-index 47c81a2..c03b52f 100644
+index 47c81a28..c03b52f9 100644
--- a/wed.c
+++ b/wed.c
@@ -16,18 +16,18 @@ void mt76_wed_release_rx_buf(struct mtk_wed_device *wed)
diff --git a/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch b/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch
index 57dba95..a0c7a95 100644
--- a/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch
@@ -1,4 +1,4 @@
-From 358136dd0d94d84efda5c04e7b392111adcb2895 Mon Sep 17 00:00:00 2001
+From 35000e804c9cad780ee340efba7cebf461366cd3 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 11 Jan 2023 10:56:27 +0800
Subject: [PATCH 2006/2015] wifi: mt76: add debugfs knob to show packet error
@@ -15,7 +15,7 @@
6 files changed, 194 insertions(+), 1 deletion(-)
diff --git a/mt76.h b/mt76.h
-index 5e71267..0ab1d74 100644
+index 40884fd8..7100934a 100644
--- a/mt76.h
+++ b/mt76.h
@@ -321,8 +321,10 @@ struct mt76_sta_stats {
@@ -30,10 +30,10 @@
u64 rx_bytes;
u32 rx_packets;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 3786e69..91294a8 100644
+index 1721f9b5..3d00961c 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -1207,6 +1207,7 @@ enum {
+@@ -1209,6 +1209,7 @@ enum {
MCU_EXT_CMD_EDCA_UPDATE = 0x27,
MCU_EXT_CMD_DEV_INFO_UPDATE = 0x2A,
MCU_EXT_CMD_THERMAL_CTRL = 0x2c,
@@ -42,7 +42,7 @@
MCU_EXT_CMD_SET_DRR_CTRL = 0x36,
MCU_EXT_CMD_SET_FEATURE_CTRL = 0x38,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index e6e3152..8a07360 100644
+index 570dd171..8733a07d 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -4565,6 +4565,114 @@ int mt7915_mcu_get_tx_rate(struct mt7915_phy *phy, u16 wcidx)
@@ -161,7 +161,7 @@
struct cfg80211_he_bss_color *he_bss_color)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 52baaa7..ec7ad7d 100644
+index 52baaa73..ec7ad7db 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -854,7 +854,8 @@ mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
@@ -200,10 +200,10 @@
CAPI_SU,
CAPI_MU,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index f5a7e1e..aafdafd 100644
+index 55af5c8c..731f5f3e 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -755,6 +755,7 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
+@@ -770,6 +770,7 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
struct cfg80211_chan_def *chandef);
int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wcid);
@@ -212,7 +212,7 @@
int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 14ea5bc..c63bf90 100644
+index d6e92b12..d64a3aec 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -4027,6 +4027,66 @@ mt7915_sr_scene_cond_show(struct seq_file *file, void *data)
diff --git a/recipes-wifi/linux-mt76/files/patches/2007-wifi-mt76-mt7915-add-ctxd-support-for-mt7916.patch b/recipes-wifi/linux-mt76/files/patches/2007-wifi-mt76-mt7915-add-ctxd-support-for-mt7916.patch
index 4f182ca..8052770 100644
--- a/recipes-wifi/linux-mt76/files/patches/2007-wifi-mt76-mt7915-add-ctxd-support-for-mt7916.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2007-wifi-mt76-mt7915-add-ctxd-support-for-mt7916.patch
@@ -1,4 +1,4 @@
-From c6929b147d890eeef315aabfd868860e1b8d3288 Mon Sep 17 00:00:00 2001
+From fac0ee814e10b01fc8536f4da0e2e7cec474b5d7 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Thu, 6 Apr 2023 17:50:52 +0800
Subject: [PATCH 2007/2015] wifi: mt76: mt7915: add ctxd support for mt7916
@@ -10,7 +10,7 @@
2 files changed, 35 insertions(+)
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 552410a..4f9f5a3 100644
+index 552410aa..4f9f5a38 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -435,6 +435,26 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -41,7 +41,7 @@
} else {
mt76_clear(dev, MT_WFDMA_HOST_CONFIG, MT_WFDMA_HOST_CONFIG_WED);
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index ca355d1..d4acefc 100644
+index ca355d14..d4acefca 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -607,6 +607,7 @@ enum offs_rev {
diff --git a/recipes-wifi/linux-mt76/files/patches/2008-wifi-mt76-connac-wed-add-wed-rx-copy-skb.patch b/recipes-wifi/linux-mt76/files/patches/2008-wifi-mt76-connac-wed-add-wed-rx-copy-skb.patch
index c96e9cc..6705920 100644
--- a/recipes-wifi/linux-mt76/files/patches/2008-wifi-mt76-connac-wed-add-wed-rx-copy-skb.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2008-wifi-mt76-connac-wed-add-wed-rx-copy-skb.patch
@@ -1,4 +1,4 @@
-From 0e3c9337e58e45f3e2ec3a00692dedc994c1bac8 Mon Sep 17 00:00:00 2001
+From cfad406a8e50de85347861782835596f599bfe59 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Sun, 4 Feb 2024 17:52:44 +0800
Subject: [PATCH 2008/2015] wifi: mt76: connac: wed: add wed rx copy skb
@@ -10,7 +10,7 @@
2 files changed, 80 insertions(+), 28 deletions(-)
diff --git a/dma.c b/dma.c
-index 9cd97d2..d17fc88 100644
+index 9cd97d24..d17fc88c 100644
--- a/dma.c
+++ b/dma.c
@@ -225,10 +225,10 @@ void mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q)
@@ -138,7 +138,7 @@
static void
diff --git a/wed.c b/wed.c
-index c03b52f..70e4057 100644
+index c03b52f9..70e40575 100644
--- a/wed.c
+++ b/wed.c
@@ -9,12 +9,9 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-enable-wa-log-to-uart.patch b/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-enable-wa-log-to-uart.patch
index 14ad66b..730a493 100644
--- a/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-enable-wa-log-to-uart.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-enable-wa-log-to-uart.patch
@@ -1,4 +1,4 @@
-From fc34c39c5e3484ab7d438dd0f5a701c5256cc643 Mon Sep 17 00:00:00 2001
+From 3be6f92d47cdfd1ab676c9728cc84560fd2cee91 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 8 Sep 2023 18:26:21 +0800
Subject: [PATCH 2009/2015] wifi: mt76: mt7915: enable wa log to uart
@@ -9,7 +9,7 @@
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 3ae4aca..76d1951 100644
+index 576ec1a5..03ccb51b 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -951,7 +951,11 @@ mt7915_fw_debug_wa_set(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/2010-wifi-mt76-mt7915-add-error-message-when-driver-recei.patch b/recipes-wifi/linux-mt76/files/patches/2010-wifi-mt76-mt7915-add-error-message-when-driver-recei.patch
index 616fa20..8bccb66 100644
--- a/recipes-wifi/linux-mt76/files/patches/2010-wifi-mt76-mt7915-add-error-message-when-driver-recei.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2010-wifi-mt76-mt7915-add-error-message-when-driver-recei.patch
@@ -1,4 +1,4 @@
-From 2cdf9a78e39cbb91519b09393ea438c49df5b594 Mon Sep 17 00:00:00 2001
+From 24b3e43ac4d858dd17013087e4ea0b4b86002079 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 8 Sep 2023 18:29:32 +0800
Subject: [PATCH 2010/2015] wifi: mt76: mt7915: add error message when driver
@@ -10,7 +10,7 @@
1 file changed, 6 insertions(+)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 1c8b873..3f907e6 100644
+index 1c8b8732..3f907e61 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1007,6 +1007,12 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
diff --git a/recipes-wifi/linux-mt76/files/patches/2011-wifi-mt76-mt7915-wed-change-wed-token-init-size-to-a.patch b/recipes-wifi/linux-mt76/files/patches/2011-wifi-mt76-mt7915-wed-change-wed-token-init-size-to-a.patch
index 54bdd75..21e6647 100644
--- a/recipes-wifi/linux-mt76/files/patches/2011-wifi-mt76-mt7915-wed-change-wed-token-init-size-to-a.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2011-wifi-mt76-mt7915-wed-change-wed-token-init-size-to-a.patch
@@ -1,4 +1,4 @@
-From a21e557d571d24801dbc7ebd403cefaec0b30f02 Mon Sep 17 00:00:00 2001
+From a1da16a0e8de7d47d6dbd43e2e677edd6285387a Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Mon, 11 Sep 2023 17:57:32 +0800
Subject: [PATCH 2011/2015] wifi: mt76: mt7915: wed: change wed token init size
@@ -16,7 +16,7 @@
7 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 0ab1d74..5bf6ba6 100644
+index 7100934a..07dc6b34 100644
--- a/mt76.h
+++ b/mt76.h
@@ -29,6 +29,8 @@
@@ -29,7 +29,7 @@
#define MT_QFLAG_WED_TYPE GENMASK(4, 2)
#define MT_QFLAG_WED BIT(5)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 3f907e6..02f794d 100644
+index 3f907e61..02f794d4 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -940,7 +940,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
@@ -64,7 +64,7 @@
msdu);
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 8a07360..708e7cd 100644
+index 8733a07d..e856f37f 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2509,6 +2509,9 @@ mt7915_mcu_init_rx_airtime(struct mt7915_dev *dev)
@@ -89,7 +89,7 @@
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_PARAM_CMD(SET), &req,
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 3391a94..6309dd9 100644
+index baf35a53..6ade056a 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -695,11 +695,14 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -119,7 +119,7 @@
ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
if (ret)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index aafdafd..945c82e 100644
+index 731f5f3e..61500841 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -62,7 +62,9 @@
@@ -134,7 +134,7 @@
#define MT7915_RX_TOKEN_SIZE 4096
diff --git a/tx.c b/tx.c
-index 92afbf5..df2bb07 100644
+index 92afbf5d..df2bb07d 100644
--- a/tx.c
+++ b/tx.c
@@ -828,7 +828,7 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi,
@@ -189,7 +189,7 @@
if (dev->token_count < dev->token_size - MT76_TOKEN_FREE_THR &&
diff --git a/wed.c b/wed.c
-index 70e4057..5ed681e 100644
+index 70e40575..5ed681ed 100644
--- a/wed.c
+++ b/wed.c
@@ -118,7 +118,7 @@ int mt76_wed_offload_enable(struct mtk_wed_device *wed)
diff --git a/recipes-wifi/linux-mt76/files/patches/2012-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch b/recipes-wifi/linux-mt76/files/patches/2012-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch
index 9b86205..7854dec 100644
--- a/recipes-wifi/linux-mt76/files/patches/2012-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2012-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch
@@ -1,7 +1,7 @@
-From 4e0a12871b8c134c99bd702f425c492ddc1f50b6 Mon Sep 17 00:00:00 2001
+From c9a8c7cdd9a5e042dc691fb70c24d4ee6832f297 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 1 Nov 2023 07:50:08 +0800
-Subject: [PATCH 1/5] wifi: mt76: mt7915: wed: add per bss statistic info
+Subject: [PATCH 2012/2015] wifi: mt76: mt7915: wed: add per bss statistic info
---
mt7915/init.c | 1 +
@@ -14,10 +14,10 @@
7 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index f38c8a1..7bc8039 100644
+index 7f210669..26dc1a7a 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -400,6 +400,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+@@ -401,6 +401,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_DISCOVERY);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
@@ -26,7 +26,7 @@
if (!is_mt7915(&dev->mt76))
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 02f794d..0c12170 100644
+index 02f794d4..0c121700 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1071,6 +1071,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
@@ -79,10 +79,10 @@
spin_lock_bh(&phy->stats_lock);
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index feb2c89..722635e 100644
+index ecfd9307..802d9e6f 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1219,6 +1219,9 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
+@@ -1231,6 +1231,9 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
struct rate_info *txrate = &msta->wcid.rate;
struct rate_info rxrate = {};
@@ -92,7 +92,7 @@
if (is_connac_v2(&phy->dev->mt76) &&
!mt7915_mcu_get_rx_rate(phy, vif, sta, &rxrate)) {
sinfo->rxrate = rxrate;
-@@ -1247,7 +1250,7 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
+@@ -1259,7 +1262,7 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
sinfo->tx_bytes = msta->wcid.stats.tx_bytes;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64);
@@ -102,7 +102,7 @@
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 708e7cd..342fe42 100644
+index e856f37f..a1b4afee 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -4750,7 +4750,8 @@ int mt7915_mcu_twt_agrt_update(struct mt7915_dev *dev,
@@ -153,7 +153,7 @@
out:
dev_kfree_skb(skb);
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6309dd9..142f308 100644
+index 6ade056a..ab807369 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -592,7 +592,7 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
@@ -199,10 +199,10 @@
}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 945c82e..6e7ed9e 100644
+index 61500841..5e7b7ebe 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -756,7 +756,8 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
+@@ -771,7 +771,8 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct rate_info *rate);
int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
struct cfg80211_chan_def *chandef);
@@ -213,7 +213,7 @@
int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set);
int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index c63bf90..2c9f198 100644
+index d64a3aec..c4eb7368 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -4034,7 +4034,7 @@ static int mt7915_reset_counter(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/2013-wifi-mt76-add-debugfs-for-tx-drop-counters.patch b/recipes-wifi/linux-mt76/files/patches/2013-wifi-mt76-add-debugfs-for-tx-drop-counters.patch
index 8cb87e0..19fb831 100644
--- a/recipes-wifi/linux-mt76/files/patches/2013-wifi-mt76-add-debugfs-for-tx-drop-counters.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2013-wifi-mt76-add-debugfs-for-tx-drop-counters.patch
@@ -1,7 +1,7 @@
-From d58cdc551155267c9c57606b0f8098dbcfbb75fc Mon Sep 17 00:00:00 2001
+From 86545609cc73f064e34e6783175b502623e08217 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 18 Mar 2024 14:16:34 +0800
-Subject: [PATCH 1/4] wifi: mt76: add debugfs for tx drop counters
+Subject: [PATCH 2013/2015] wifi: mt76: add debugfs for tx drop counters
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
@@ -13,7 +13,7 @@
5 files changed, 99 insertions(+), 8 deletions(-)
diff --git a/dma.c b/dma.c
-index d17fc88..da3e8bc 100644
+index d17fc88c..da3e8bc3 100644
--- a/dma.c
+++ b/dma.c
@@ -612,13 +612,18 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
@@ -96,7 +96,7 @@
}
diff --git a/mt76.h b/mt76.h
-index da5875f..2d59091 100644
+index 07dc6b34..08f1a7ce 100644
--- a/mt76.h
+++ b/mt76.h
@@ -849,6 +849,27 @@ struct mt76_vif {
@@ -136,7 +136,7 @@
struct mt76_dev {
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 0c12170..1e2ef8c 100644
+index 0c121700..1e2ef8c0 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -782,9 +782,15 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -176,7 +176,7 @@
t->jiffies = jiffies;
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 2c9f198..1b2fbf9 100644
+index c4eb7368..abb09b76 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -4033,6 +4033,12 @@ static int mt7915_reset_counter(void *data, u64 val)
@@ -239,7 +239,7 @@
+
#endif
diff --git a/tx.c b/tx.c
-index df2bb07..e4eb74b 100644
+index df2bb07d..e4eb74b7 100644
--- a/tx.c
+++ b/tx.c
@@ -330,8 +330,10 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
diff --git a/recipes-wifi/linux-mt76/files/patches/2014-wifi-mt76-add-debugfs-for-rx-drop-counters.patch b/recipes-wifi/linux-mt76/files/patches/2014-wifi-mt76-add-debugfs-for-rx-drop-counters.patch
index 8668aaf..248ddd3 100644
--- a/recipes-wifi/linux-mt76/files/patches/2014-wifi-mt76-add-debugfs-for-rx-drop-counters.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2014-wifi-mt76-add-debugfs-for-rx-drop-counters.patch
@@ -1,7 +1,7 @@
-From dd3b663524af8f38dc1e2a04e1722f5b7d96d514 Mon Sep 17 00:00:00 2001
+From 8c618a9481eb07cd9699cb6266d34b6fd485f44a Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 23 May 2024 02:33:47 +0800
-Subject: [PATCH 2/4] wifi: mt76: add debugfs for rx drop counters
+Subject: [PATCH 2014/2015] wifi: mt76: add debugfs for rx drop counters
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
@@ -15,7 +15,7 @@
7 files changed, 140 insertions(+), 13 deletions(-)
diff --git a/agg-rx.c b/agg-rx.c
-index 07c386c..97a963a 100644
+index 07c386c7..97a963ad 100644
--- a/agg-rx.c
+++ b/agg-rx.c
@@ -151,6 +151,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
@@ -52,7 +52,7 @@
}
diff --git a/dma.c b/dma.c
-index da3e8bc..782463f 100644
+index da3e8bc3..782463f6 100644
--- a/dma.c
+++ b/dma.c
@@ -251,13 +251,16 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
@@ -158,7 +158,7 @@
skb_reserve(skb, q->buf_offset);
diff --git a/dma.h b/dma.h
-index 619dc0f..6b2ee7e 100644
+index 619dc0fe..6b2ee7ec 100644
--- a/dma.h
+++ b/dma.h
@@ -92,27 +92,29 @@ mt76_dma_reset_tx_queue(struct mt76_dev *dev, struct mt76_queue *q)
@@ -198,7 +198,7 @@
#endif
diff --git a/mac80211.c b/mac80211.c
-index c31d130..6980fe7 100644
+index e50c68f8..e01ce59a 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -775,6 +775,7 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
@@ -236,7 +236,7 @@
static void
diff --git a/mt76.h b/mt76.h
-index 2d59091..11898b8 100644
+index 08f1a7ce..32327d3b 100644
--- a/mt76.h
+++ b/mt76.h
@@ -175,6 +175,33 @@ enum mt76_dfs_state {
@@ -305,7 +305,7 @@
struct mt76_dev {
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 1e2ef8c..195b5f6 100644
+index 1e2ef8c0..195b5f62 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1175,9 +1175,11 @@ void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -342,7 +342,7 @@
break;
}
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 1b2fbf9..a33a90d 100644
+index abb09b76..5413291a 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -4032,9 +4032,12 @@ static int mt7915_reset_counter(void *data, u64 val)
diff --git a/recipes-wifi/linux-mt76/files/patches/2015-wifi-mt76-mt7915-support-backaward-compatiable.patch b/recipes-wifi/linux-mt76/files/patches/2015-wifi-mt76-mt7915-support-backaward-compatiable.patch
index c7c6707..fbca3a6 100644
--- a/recipes-wifi/linux-mt76/files/patches/2015-wifi-mt76-mt7915-support-backaward-compatiable.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2015-wifi-mt76-mt7915-support-backaward-compatiable.patch
@@ -1,7 +1,7 @@
-From eebe902614c5e2759492afcd1f84665d241077cb Mon Sep 17 00:00:00 2001
+From fd382c52114f01db7d28f60b3e8917b4c9dfd301 Mon Sep 17 00:00:00 2001
From: Rex Lu <rex.lu@mediatek.com>
Date: Mon, 11 Dec 2023 19:21:16 +0800
-Subject: [PATCH 3/4] wifi: mt76: mt7915: support backaward compatiable
+Subject: [PATCH 2015/2015] wifi: mt76: mt7915: support backaward compatiable
---
mt7915/mmio.c | 4 ++--
@@ -9,7 +9,7 @@
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 142f308..11db3ed 100644
+index ab807369..1ea91676 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -697,7 +697,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -31,7 +31,7 @@
wed->wlan.nbuf = is_mt7915(&dev->mt76) ?
diff --git a/wed.c b/wed.c
-index 5ed681e..652f59e 100644
+index 5ed681ed..652f59e1 100644
--- a/wed.c
+++ b/wed.c
@@ -175,7 +175,7 @@ int mt76_wed_dma_setup(struct mt76_dev *dev, struct mt76_queue *q, bool reset)
diff --git a/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch b/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
index 976378d..7e7fe6f 100644
--- a/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
+++ b/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
@@ -1,32 +1,32 @@
-From b797380172c9191f7de318ee2db475583d67ed0d Mon Sep 17 00:00:00 2001
+From 1d910139c69d3baae9937d8416bc172bcd07d160 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 5 Apr 2023 08:29:19 +0800
-Subject: [PATCH 4/4] mt76: revert for backports-5.15 wireless stack
+Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
wifi: mt76: mt7915: add support for he ldpc control from hostapd
wifi: mt76: only include mt76_connac3_mac for WiFi7 chipsets
---
Makefile | 6 +-
dma.c | 2 +-
- mac80211.c | 15 +--
+ mac80211.c | 19 ++--
mt7615/dma.c | 4 +-
mt7615/main.c | 6 +-
- mt7615/mcu.c | 8 +-
+ mt7615/mcu.c | 6 +-
mt76_connac_mac.c | 2 +-
mt76_connac_mcu.c | 119 ++++++++++------------
mt76x02_mac.c | 6 +-
mt7915/debugfs.c | 4 +-
mt7915/dma.c | 4 +-
- mt7915/init.c | 3 +-
- mt7915/main.c | 36 ++-----
- mt7915/mcu.c | 246 ++++++++++++++++++++++++++++++----------------
+ mt7915/init.c | 12 ++-
+ mt7915/main.c | 40 ++------
+ mt7915/mcu.c | 252 ++++++++++++++++++++++++++++++----------------
mt7915/testmode.c | 8 +-
- tx.c | 22 ++---
+ tx.c | 22 ++--
wed.c | 1 +
- 17 files changed, 265 insertions(+), 227 deletions(-)
+ 17 files changed, 275 insertions(+), 238 deletions(-)
diff --git a/Makefile b/Makefile
-index 5352d00..073e37d 100644
+index 5352d000..073e37d7 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,11 @@ mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \
@@ -43,7 +43,7 @@
mt792x-lib-y := mt792x_core.o mt792x_mac.o mt792x_trace.o \
mt792x_debugfs.o mt792x_dma.o
diff --git a/dma.c b/dma.c
-index 782463f..39fafce 100644
+index 782463f6..39fafce0 100644
--- a/dma.c
+++ b/dma.c
@@ -1052,7 +1052,7 @@ mt76_dma_init(struct mt76_dev *dev,
@@ -56,7 +56,7 @@
napi_enable(&dev->napi[i]);
}
diff --git a/mac80211.c b/mac80211.c
-index 6980fe7..e9c2dc2 100644
+index e01ce59a..a41bf2f9 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -1062,14 +1062,9 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
@@ -77,16 +77,18 @@
status->rate_idx = mstat.rate_idx;
status->nss = mstat.nss;
status->band = mstat.band;
-@@ -1592,7 +1587,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
+@@ -1592,8 +1587,8 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
static void
__mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
-- if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
+- if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif, 0))
+- ieee80211_csa_finish(vif, 0);
+ if (vif->csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
- ieee80211_csa_finish(vif);
++ ieee80211_csa_finish(vif);
}
-@@ -1614,7 +1609,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ void mt76_csa_finish(struct mt76_dev *dev)
+@@ -1614,10 +1609,10 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
struct mt76_dev *dev = priv;
@@ -94,9 +96,13 @@
+ if (!vif->csa_active)
return;
- dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
+- dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif, 0);
++ dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
+ }
+
+ void mt76_csa_check(struct mt76_dev *dev)
diff --git a/mt7615/dma.c b/mt7615/dma.c
-index e7135b2..6767c39 100644
+index e7135b2f..6767c39d 100644
--- a/mt7615/dma.c
+++ b/mt7615/dma.c
@@ -282,8 +282,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
@@ -111,7 +117,7 @@
mt76_poll(dev, MT_WPDMA_GLO_CFG,
diff --git a/mt7615/main.c b/mt7615/main.c
-index dab16b5..d32a752 100644
+index c27acaf0..1bdd703a 100644
--- a/mt7615/main.c
+++ b/mt7615/main.c
@@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
@@ -142,18 +148,9 @@
if (changed & BSS_CHANGED_MU_GROUPS)
mt7615_update_mu_group(hw, vif, info);
diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index c9444c6..466f38e 100644
+index a9310660..c76594d6 100644
--- a/mt7615/mcu.c
+++ b/mt7615/mcu.c
-@@ -353,7 +353,7 @@ out:
- static void
- mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
- {
-- if (vif->bss_conf.csa_active)
-+ if (vif->csa_active)
- ieee80211_csa_finish(vif);
- }
-
@@ -699,7 +699,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev,
if (!enable)
goto out;
@@ -182,7 +179,7 @@
.bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
};
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index 21dadb5..fbad20e 100644
+index 21dadb55..fbad20ec 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -1132,7 +1132,7 @@ void mt76_connac2_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
@@ -195,7 +192,7 @@
tid = le32_get_bits(txwi[1], MT_TXD1_TID);
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 15e61c9..dd23643 100644
+index 0ce7ecdc..aee9b5bf 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -199,7 +199,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
@@ -578,7 +575,7 @@
return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
}
diff --git a/mt76x02_mac.c b/mt76x02_mac.c
-index d5db6ff..fec3d10 100644
+index d5db6ffd..fec3d10d 100644
--- a/mt76x02_mac.c
+++ b/mt76x02_mac.c
@@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
@@ -603,10 +600,10 @@
if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
ba_size = 0;
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 76d1951..e22e777 100644
+index 03ccb51b..72867ff7 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
-@@ -2052,8 +2052,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
+@@ -2100,8 +2100,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
for (i = 0; i <= phy.bw; i++) {
@@ -618,7 +615,7 @@
field = RATE_PARAM_FIXED;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 4f9f5a3..fde6a38 100644
+index 4f9f5a38..fde6a385 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -596,8 +596,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -633,10 +630,10 @@
mt7915_dma_enable(dev, false);
diff --git a/mt7915/init.c b/mt7915/init.c
-index 7bc8039..f1cacc1 100644
+index 26dc1a7a..e8e3b94a 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -1155,8 +1155,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
+@@ -1163,8 +1163,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss);
} else {
he_cap_elem->phy_cap_info[9] |=
@@ -646,11 +643,41 @@
}
if (band == NL80211_BAND_6GHZ) {
+@@ -1198,7 +1197,8 @@ void mt7915_set_stream_he_caps(struct mt7915_phy *phy)
+ n = mt7915_init_he_caps(phy, NL80211_BAND_2GHZ, data);
+
+ band = &phy->mt76->sband_2g.sband;
+- _ieee80211_set_sband_iftype_data(band, data, n);
++ band->iftype_data = data;
++ band->n_iftype_data = n;
+ }
+
+ if (phy->mt76->cap.has_5ghz) {
+@@ -1206,7 +1206,8 @@ void mt7915_set_stream_he_caps(struct mt7915_phy *phy)
+ n = mt7915_init_he_caps(phy, NL80211_BAND_5GHZ, data);
+
+ band = &phy->mt76->sband_5g.sband;
+- _ieee80211_set_sband_iftype_data(band, data, n);
++ band->iftype_data = data;
++ band->n_iftype_data = n;
+ }
+
+ if (phy->mt76->cap.has_6ghz) {
+@@ -1214,7 +1215,8 @@ void mt7915_set_stream_he_caps(struct mt7915_phy *phy)
+ n = mt7915_init_he_caps(phy, NL80211_BAND_6GHZ, data);
+
+ band = &phy->mt76->sband_6g.sband;
+- _ieee80211_set_sband_iftype_data(band, data, n);
++ band->iftype_data = data;
++ band->n_iftype_data = n;
+ }
+ }
+
diff --git a/mt7915/main.c b/mt7915/main.c
-index 722635e..98efaf8 100644
+index 802d9e6f..93120b9f 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -548,7 +548,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
+@@ -551,7 +551,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
static int
mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -659,7 +686,7 @@
const struct ieee80211_tx_queue_params *params)
{
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
-@@ -650,7 +650,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
+@@ -653,7 +653,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *info,
@@ -668,7 +695,7 @@
{
struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -666,7 +666,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
+@@ -669,7 +669,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
vif->type == NL80211_IFTYPE_STATION)
set_bss_info = set_sta = !is_zero_ether_addr(info->bssid);
if (changed & BSS_CHANGED_ASSOC)
@@ -677,7 +704,7 @@
if (changed & BSS_CHANGED_BEACON_ENABLED &&
vif->type != NL80211_IFTYPE_AP)
set_bss_info = set_sta = info->enable_beacon;
-@@ -714,27 +714,8 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
+@@ -717,27 +717,8 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
mutex_unlock(&dev->mt76.mutex);
}
@@ -706,7 +733,7 @@
{
struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -742,8 +723,6 @@ mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -745,8 +726,6 @@ mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
@@ -715,7 +742,7 @@
err = mt7915_mcu_add_bss_info(phy, vif, true);
if (err)
goto out;
-@@ -755,8 +734,7 @@ out:
+@@ -758,8 +737,7 @@ out:
}
static void
@@ -725,7 +752,7 @@
{
struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -1379,10 +1357,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
+@@ -1391,10 +1369,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
{
struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = mt7915_hw_dev(hw);
@@ -738,8 +765,19 @@
txpower = 0;
mutex_lock(&dev->mt76.mutex);
+@@ -1885,10 +1863,6 @@ mt7915_net_fill_receive_path(struct ieee80211_hw *hw,
+ #endif
+
+ const struct ieee80211_ops mt7915_ops = {
+- .add_chanctx = ieee80211_emulate_add_chanctx,
+- .remove_chanctx = ieee80211_emulate_remove_chanctx,
+- .change_chanctx = ieee80211_emulate_change_chanctx,
+- .switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx,
+ .tx = mt7915_tx,
+ .start = mt7915_start,
+ .stop = mt7915_stop,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 7a67b52..34ea5bf 100644
+index a1b4afee..2c5943b4 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -67,7 +67,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
@@ -793,7 +831,7 @@
}
static int
-@@ -243,7 +243,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
+@@ -243,10 +243,10 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
static void
mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
@@ -801,7 +839,11 @@
+ if (!vif->csa_active || vif->type == NL80211_IFTYPE_STATION)
return;
+- ieee80211_csa_finish(vif, 0);
++ ieee80211_csa_finish(vif);
+ }
+
- ieee80211_csa_finish(vif);
+ static void
@@ -349,7 +349,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
static void
mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
@@ -811,6 +853,19 @@
return;
ieee80211_color_change_finish(vif);
+@@ -681,10 +681,10 @@ static bool mt7915_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw,
+ .tolerated = true,
+ };
+
+- if (!(vif->bss_conf.chanreq.oper.chan->flags & IEEE80211_CHAN_RADAR))
++ if (!(vif->bss_conf.chandef.chan->flags & IEEE80211_CHAN_RADAR))
+ return false;
+
+- cfg80211_bss_iter(hw->wiphy, &vif->bss_conf.chanreq.oper,
++ cfg80211_bss_iter(hw->wiphy, &vif->bss_conf.chandef,
+ mt7915_check_he_obss_narrow_bw_ru_iter,
+ &iter_data);
+
@@ -945,13 +945,13 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
struct ieee80211_vif *vif)
{
@@ -1353,7 +1408,7 @@
len = sku_len[SKU_HE_RU242] * 4;
}
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index ecd6271..b2c442b 100644
+index ecd62712..b2c442b0 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -418,12 +418,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
@@ -1374,7 +1429,7 @@
sta->wme = 1;
diff --git a/tx.c b/tx.c
-index e4eb74b..a3654a9 100644
+index e4eb74b7..a3654a9b 100644
--- a/tx.c
+++ b/tx.c
@@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
@@ -1430,7 +1485,7 @@
ieee80211_tx_status_ext(hw, &status);
spin_unlock_bh(&dev->rx_lock);
diff --git a/wed.c b/wed.c
-index 652f59e..1c2ad30 100644
+index 652f59e1..1c2ad302 100644
--- a/wed.c
+++ b/wed.c
@@ -80,6 +80,7 @@ u32 mt76_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
diff --git a/recipes-wifi/linux-mt76/files/patches/patches.inc b/recipes-wifi/linux-mt76/files/patches/patches.inc
index f5d6773..2dd33c4 100644
--- a/recipes-wifi/linux-mt76/files/patches/patches.inc
+++ b/recipes-wifi/linux-mt76/files/patches/patches.inc
@@ -21,6 +21,7 @@
file://0019-wifi-mt76-mt7915-adjust-rx-filter.patch \
file://0020-wifi-mt76-mt7915-add-additional-chain-signal-info-to.patch \
file://0021-wifi-mt76-mt7915-remove-unnecessary-register-setting.patch \
+ file://0022-wifi-mt76-mt7915-add-PID-to-only-report-data-frame-T.patch \
file://0999-wifi-mt76-mt7915-build-pass-for-Linux-Kernel-5.4-fix.patch \
file://1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch \
file://1001-wifi-mt76-mt7915-csi-implement-csi-support.patch \
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp.bin
index 3203f47..ed3597b 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_23.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_23.bin
index 6bb8783..37511a9 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_23.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_23.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_24.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_24.bin
new file mode 100644
index 0000000..19aec4c
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_dsp_24.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch.bin
index 62b15ff..dfc722e 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_23.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_23.bin
index c6127eb..1fb990b 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_23.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_23.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_24.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_24.bin
new file mode 100644
index 0000000..6feaa4d
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_rom_patch_24.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa.bin
index 0ddfc82..3489c57 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_23.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_23.bin
index 54c9f8d..c15a207 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_23.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_23.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_24.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_24.bin
new file mode 100644
index 0000000..d6bedba
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wa_24.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm.bin
index ca62f15..542cd54 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_23.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_23.bin
index f645c9b..132beb0 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_23.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_23.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_24.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_24.bin
new file mode 100644
index 0000000..46b92ed
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_24.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm.bin
index 66cc70b..a6a4a71 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_23.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_23.bin
index 5643c9a..db10ce2 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_23.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_23.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_24.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_24.bin
new file mode 100644
index 0000000..91cd9ae
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7992_wm_tm_24.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_dsp.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_dsp.bin
index e9765d9..45fd63d 100755
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_dsp.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_dsp.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_eeprom_233_2i5i6i.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_eeprom_233_2i5i6i.bin
new file mode 100644
index 0000000..11eaa85
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_eeprom_233_2i5i6i.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch.bin
index 524024f..8538d92 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch_233.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch_233.bin
index 17a1475..f729c9a 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch_233.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_rom_patch_233.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa.bin
index 3e04fe1..73a281b 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa_233.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa_233.bin
index bf1ff57..d8b85e0 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa_233.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wa_233.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm.bin
index c26be71..8d5fd6e 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_233.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_233.bin
index c685756..95ab39f 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_233.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_233.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm.bin
index e275cbb..ce1e3f4 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm.bin
Binary files differ
diff --git a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm_233.bin b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm_233.bin
index 04a5951..13684f1 100644
--- a/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm_233.bin
+++ b/recipes-wifi/linux-mt76/files/src/firmware/mt7996/mt7996_wm_tm_233.bin
Binary files differ