WCNCR00165815][rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch
new file mode 100644
index 0000000..c4c2b78
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch
@@ -0,0 +1,52 @@
+From 00cd9ac2311cf4b66ab7c3d6eb3593b52bea1bec Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 2 Dec 2022 10:16:49 +0800
+Subject: [PATCH 1/4] wifi: mt76: mt7915: call
+ mt7915_mcu_set_thermal_throttling() only after init_work
+
+Enable thermal management by default shall not be executed during mcu
+init. This causes thermal configuration being reset to the firmware
+default settings.
+
+Fixes: 0063b86c9120 ("mt76: mt7915e: Enable thermal management by default")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 3 +--
+ mt7915/main.c | 6 ++++++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index 6fd5c63e..a03d0b3b 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -201,8 +201,7 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ phy->throttle_temp[0] = 110;
+ phy->throttle_temp[1] = 120;
+
+- return mt7915_mcu_set_thermal_throttling(phy,
+- MT7915_THERMAL_THROTTLE_MAX);
++ return 0;
+ }
+
+ static void mt7915_led_set_config(struct led_classdev *led_cdev,
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 0511d6a5..98af032e 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -57,6 +57,12 @@ int mt7915_run(struct ieee80211_hw *hw)
+ mt7915_mac_enable_nf(dev, phy->mt76->band_idx);
+ }
+
++ ret = mt7915_mcu_set_thermal_throttling(phy,
++ MT7915_THERMAL_THROTTLE_MAX);
++
++ if (ret)
++ goto out;
++
+ ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b,
+ phy->mt76->band_idx);
+ if (ret)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch
new file mode 100644
index 0000000..618a14e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch
@@ -0,0 +1,151 @@
+From 906bad79c7beb43c81a80fdb97898ebb977e527a Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 5 Dec 2022 14:09:18 +0800
+Subject: [PATCH 2/4] wifi: mt76: mt7915: rework
+ mt7915_mcu_set_thermal_throttling
+
+This patch includes 2 changes:
+1. Firmware expects to disable thermal protect first before
+reconfiguring.
+2. Separate setting thermal_protect and setting thermal_tx_duty into
+different functions. These two firmware commands do not need to send
+together.
+
+Fixes: 34b877d972be ("mt76: mt7915: add thermal cooling device support")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 3 ---
+ mt7915/main.c | 5 +++++
+ mt7915/mcu.c | 54 ++++++++++++++++++++++++++++---------------------
+ mt7915/mt7915.h | 1 +
+ 4 files changed, 37 insertions(+), 26 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index a03d0b3b..df3a35d5 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -134,9 +134,6 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev,
+ if (state > MT7915_CDEV_THROTTLE_MAX)
+ return -EINVAL;
+
+- if (phy->throttle_temp[0] > phy->throttle_temp[1])
+- return 0;
+-
+ if (state == phy->cdev_state)
+ return 0;
+
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 98af032e..7589af4b 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -60,6 +60,11 @@ int mt7915_run(struct ieee80211_hw *hw)
+ ret = mt7915_mcu_set_thermal_throttling(phy,
+ MT7915_THERMAL_THROTTLE_MAX);
+
++ if (ret)
++ goto out;
++
++ ret = mt7915_mcu_set_thermal_protect(phy);
++
+ if (ret)
+ goto out;
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 35441dcb..7c14a189 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -3077,6 +3077,29 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy)
+ }
+
+ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state)
++{
++ struct mt7915_dev *dev = phy->dev;
++ struct mt7915_mcu_thermal_ctrl req = {
++ .band_idx = phy->mt76->band_idx,
++ .ctrl_id = THERMAL_PROTECT_DUTY_CONFIG,
++ };
++ int level, ret;
++
++ /* set duty cycle and level */
++ for (level = 0; level < 4; level++) {
++ req.duty.duty_level = level;
++ req.duty.duty_cycle = state;
++ state /= 2;
++
++ ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
++ &req, sizeof(req), false);
++ if (ret)
++ return ret;
++ }
++ return 0;
++}
++
++int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy)
+ {
+ struct mt7915_dev *dev = phy->dev;
+ struct {
+@@ -3089,29 +3112,18 @@ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state)
+ } __packed req = {
+ .ctrl = {
+ .band_idx = phy->mt76->band_idx,
++ .type.protect_type = 1,
++ .type.trigger_type = 1,
+ },
+ };
+- int level;
+-
+- if (!state) {
+- req.ctrl.ctrl_id = THERMAL_PROTECT_DISABLE;
+- goto out;
+- }
+-
+- /* set duty cycle and level */
+- for (level = 0; level < 4; level++) {
+- int ret;
++ int ret;
+
+- req.ctrl.ctrl_id = THERMAL_PROTECT_DUTY_CONFIG;
+- req.ctrl.duty.duty_level = level;
+- req.ctrl.duty.duty_cycle = state;
+- state /= 2;
++ req.ctrl.ctrl_id = THERMAL_PROTECT_DISABLE;
++ ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
++ &req, sizeof(req.ctrl), false);
+
+- ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
+- &req, sizeof(req.ctrl), false);
+- if (ret)
+- return ret;
+- }
++ if (ret)
++ return ret;
+
+ /* set high-temperature trigger threshold */
+ req.ctrl.ctrl_id = THERMAL_PROTECT_ENABLE;
+@@ -3120,10 +3132,6 @@ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state)
+ req.trigger_temp = cpu_to_le32(phy->throttle_temp[1]);
+ req.sustain_time = cpu_to_le16(10);
+
+-out:
+- req.ctrl.type.protect_type = 1;
+- req.ctrl.type.trigger_type = 1;
+-
+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
+ &req, sizeof(req), false);
+ }
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 6351feba..855779f8 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -543,6 +543,7 @@ int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy);
+ int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch);
+ int mt7915_mcu_get_temperature(struct mt7915_phy *phy);
+ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state);
++int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy);
+ 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,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch
new file mode 100644
index 0000000..f1c0093
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch
@@ -0,0 +1,73 @@
+From 2cd5969305cc6ba22a1a3ffc45f46758d09bbd1e Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 12 Dec 2022 11:30:37 +0800
+Subject: [PATCH 3/4] wifi: mt76: mt7915: rework mt7915_thermal_temp_store()
+
+Call mt7915_mcu_set_thermal_protect() through
+mt7915_thermal_temp_store() to update firmware trigger/restore temp
+directly.
+
+Fixes: 02ee68b95d81 ("mt76: mt7915: add control knobs for thermal throttling")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 18 ++++++++++++++++--
+ mt7915/mt7915.h | 3 +++
+ 2 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index df3a35d5..98655e4d 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -83,9 +83,23 @@ 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);
++
++ if ((i - 1 == MT7915_CRIT_TEMP_IDX &&
++ val > phy->throttle_temp[MT7915_MAX_TEMP_IDX]) ||
++ (i - 1 == MT7915_MAX_TEMP_IDX &&
++ val < phy->throttle_temp[MT7915_CRIT_TEMP_IDX])) {
++ dev_err(phy->dev->mt76.dev,
++ "temp1_max shall be greater than temp1_crit.");
++ return -EINVAL;
++ }
++
+ phy->throttle_temp[i - 1] = val;
+ mutex_unlock(&phy->dev->mt76.mutex);
+
++ ret = mt7915_mcu_set_thermal_protect(phy);
++ if (ret)
++ return ret;
++
+ return count;
+ }
+
+@@ -195,8 +209,8 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ return PTR_ERR(hwmon);
+
+ /* initialize critical/maximum high temperature */
+- phy->throttle_temp[0] = 110;
+- phy->throttle_temp[1] = 120;
++ phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = 110;
++ phy->throttle_temp[MT7915_MAX_TEMP_IDX] = 120;
+
+ return 0;
+ }
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 855779f8..e58650bb 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -70,6 +70,9 @@
+
+ #define MT7915_WED_RX_TOKEN_SIZE 12288
+
++#define MT7915_CRIT_TEMP_IDX 0
++#define MT7915_MAX_TEMP_IDX 1
++
+ struct mt7915_vif;
+ struct mt7915_sta;
+ struct mt7915_dfs_pulse;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch
new file mode 100644
index 0000000..8f9fa45
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch
@@ -0,0 +1,78 @@
+From 30bd3547690ec1463b34c726577ae821e92a4390 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 12 Dec 2022 13:18:49 +0800
+Subject: [PATCH 4/4] wifi: mt76: mt7915: add error message in
+ mt7915_thermal_set_cur_throttle_state()
+
+Add dev_err so that it is easier to see invalid setting while looking at
+dmesg.
+
+Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 12 +++++++-----
+ mt7915/mt7915.h | 2 ++
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index 98655e4d..b23a2fb8 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -145,8 +145,11 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev,
+ u8 throttling = MT7915_THERMAL_THROTTLE_MAX - state;
+ int ret;
+
+- if (state > MT7915_CDEV_THROTTLE_MAX)
++ if (state > MT7915_CDEV_THROTTLE_MAX) {
++ dev_err(phy->dev->mt76.dev,
++ "please specify a valid throttling state\n");
+ return -EINVAL;
++ }
+
+ if (state == phy->cdev_state)
+ return 0;
+@@ -175,7 +178,7 @@ static void mt7915_unregister_thermal(struct mt7915_phy *phy)
+ struct wiphy *wiphy = phy->mt76->hw->wiphy;
+
+ if (!phy->cdev)
+- return;
++ return;
+
+ sysfs_remove_link(&wiphy->dev.kobj, "cooling_device");
+ thermal_cooling_device_unregister(phy->cdev);
+@@ -209,8 +212,8 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ return PTR_ERR(hwmon);
+
+ /* initialize critical/maximum high temperature */
+- phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = 110;
+- phy->throttle_temp[MT7915_MAX_TEMP_IDX] = 120;
++ phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = MT7915_CRIT_TEMP;
++ phy->throttle_temp[MT7915_MAX_TEMP_IDX] = MT7915_MAX_TEMP;
+
+ return 0;
+ }
+@@ -1185,7 +1188,6 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev)
+ mt7986_wmac_disable(dev);
+ }
+
+-
+ int mt7915_register_device(struct mt7915_dev *dev)
+ {
+ struct mt7915_phy *phy2;
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index e58650bb..942d70c5 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -72,6 +72,8 @@
+
+ #define MT7915_CRIT_TEMP_IDX 0
+ #define MT7915_MAX_TEMP_IDX 1
++#define MT7915_CRIT_TEMP 110
++#define MT7915_MAX_TEMP 120
+
+ struct mt7915_vif;
+ struct mt7915_sta;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch
index c9e83a4..18417be 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch
@@ -1,7 +1,7 @@
-From 33d41ea84a29d895fc07019aa5c6f79811e59b14 Mon Sep 17 00:00:00 2001
+From 53904fff8723ca80699e95efeb4b3fe9ededafbd 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 1001/1009] mt76: mt7915: add mtk internal debug tools for mt76
+Subject: [PATCH 1001/1042] mt76: mt7915: add mtk internal debug tools for mt76
---
mt76_connac_mcu.h | 7 +
@@ -22,7 +22,7 @@
create mode 100644 mt7915/mtk_mcu.c
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index f1e942b9..9d0d6130 100644
+index f1e942b..9d0d613 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1146,6 +1146,7 @@ enum {
@@ -47,7 +47,7 @@
MCU_EXT_CMD_CAL_CACHE = 0x67,
MCU_EXT_CMD_SET_RADAR_TH = 0x7c,
diff --git a/mt7915/Makefile b/mt7915/Makefile
-index 797ae498..a42866e9 100644
+index 797ae49..a42866e 100644
--- a/mt7915/Makefile
+++ b/mt7915/Makefile
@@ -3,7 +3,7 @@
@@ -60,7 +60,7 @@
mt7915e-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7915e-$(CONFIG_MT7986_WMAC) += soc.o
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 5a46813a..f1f3f2f3 100644
+index 5a46813..f1f3f2f 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -8,6 +8,9 @@
@@ -204,7 +204,7 @@
if (dev->relay_fwlog)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index f0d5a360..149527df 100644
+index f0d5a36..149527d 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -300,6 +300,10 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb,
@@ -243,7 +243,7 @@
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index 0511d6a5..b44507f4 100644
+index 0511d6a..b44507f 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -62,7 +62,11 @@ int mt7915_run(struct ieee80211_hw *hw)
@@ -259,7 +259,7 @@
goto out;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 35441dcb..56e5ea55 100644
+index 35441dc..56e5ea5 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -199,6 +199,11 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
@@ -351,7 +351,7 @@
+}
+#endif
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 29b5434b..aa89106e 100644
+index 29b5434..aa89106 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -278,6 +278,10 @@ enum {
@@ -366,7 +366,7 @@
enum mcu_mmps_mode {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 6351feba..7c129f7f 100644
+index 6351feb..7c129f7 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -9,6 +9,7 @@
@@ -434,7 +434,7 @@
#endif
diff --git a/mt7915/mt7915_debug.h b/mt7915/mt7915_debug.h
new file mode 100644
-index 00000000..ecdc02ab
+index 0000000..ecdc02a
--- /dev/null
+++ b/mt7915/mt7915_debug.h
@@ -0,0 +1,1350 @@
@@ -1790,7 +1790,7 @@
+#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
new file mode 100644
-index 00000000..747a9014
+index 0000000..747a901
--- /dev/null
+++ b/mt7915/mtk_debugfs.c
@@ -0,0 +1,2925 @@
@@ -4721,7 +4721,7 @@
+#endif
diff --git a/mt7915/mtk_mcu.c b/mt7915/mtk_mcu.c
new file mode 100644
-index 00000000..143dae26
+index 0000000..143dae2
--- /dev/null
+++ b/mt7915/mtk_mcu.c
@@ -0,0 +1,51 @@
@@ -4777,7 +4777,7 @@
+ sizeof(req), true);
+}
diff --git a/tools/fwlog.c b/tools/fwlog.c
-index e5d4a105..3d51d9ec 100644
+index e5d4a10..3d51d9e 100644
--- a/tools/fwlog.c
+++ b/tools/fwlog.c
@@ -26,7 +26,7 @@ static const char *debugfs_path(const char *phyname, const char *file)
@@ -4891,5 +4891,5 @@
return ret;
}
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1002-mt76-mt7915-csi-implement-csi-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1002-mt76-mt7915-csi-implement-csi-support.patch
index 7bc8f15..ed75241 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1002-mt76-mt7915-csi-implement-csi-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1002-mt76-mt7915-csi-implement-csi-support.patch
@@ -1,7 +1,7 @@
-From d5e0407913c33119fd697d626cb3fd87b44f9689 Mon Sep 17 00:00:00 2001
+From 06233088901511040fafaba99f8e6f85faf63557 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 1002/1009] mt76: mt7915: csi: implement csi support
+Subject: [PATCH 1002/1042] mt76: mt7915: csi: implement csi support
---
mt76_connac_mcu.h | 2 +
@@ -17,7 +17,7 @@
create mode 100644 mt7915/vendor.h
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 9d0d6130..26e7cf6f 100644
+index 9d0d613..26e7cf6 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -998,6 +998,7 @@ enum {
@@ -37,7 +37,7 @@
enum {
diff --git a/mt7915/Makefile b/mt7915/Makefile
-index a42866e9..14ce98a6 100644
+index a42866e..14ce98a 100644
--- a/mt7915/Makefile
+++ b/mt7915/Makefile
@@ -1,9 +1,9 @@
@@ -53,7 +53,7 @@
mt7915e-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7915e-$(CONFIG_MT7986_WMAC) += soc.o
diff --git a/mt7915/init.c b/mt7915/init.c
-index 6fd5c63e..79080aee 100644
+index 6fd5c63..79080ae 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -645,6 +645,12 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
@@ -131,7 +131,7 @@
ARRAY_SIZE(mt76_rates));
if (ret)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 56e5ea55..f483d443 100644
+index 56e5ea5..f483d44 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -36,6 +36,10 @@ static bool sr_scene_detect = true;
@@ -267,7 +267,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 aa89106e..f3dedd5b 100644
+index aa89106..f3dedd5 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -532,4 +532,80 @@ mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
@@ -352,7 +352,7 @@
+
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 7c129f7f..8bb6d091 100644
+index 7c129f7..8bb6d09 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -288,6 +288,20 @@ struct mt7915_phy {
@@ -391,7 +391,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 00000000..98fd9c2d
+index 0000000..98fd9c2
--- /dev/null
+++ b/mt7915/vendor.c
@@ -0,0 +1,452 @@
@@ -849,7 +849,7 @@
+}
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
new file mode 100644
-index 00000000..9d3db2a7
+index 0000000..9d3db2a
--- /dev/null
+++ b/mt7915/vendor.h
@@ -0,0 +1,60 @@
@@ -914,5 +914,5 @@
+
+#endif
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1003-mt76-mt7915-air-monitor-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1003-mt76-mt7915-air-monitor-support.patch
index 1078874..95ba41a 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1003-mt76-mt7915-air-monitor-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1003-mt76-mt7915-air-monitor-support.patch
@@ -1,7 +1,7 @@
-From 0a7547997d9a2f44574b4562b9b77dfda62cc342 Mon Sep 17 00:00:00 2001
+From 348d91e6cd920a4728d71711e9279596837b4a85 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 1003/1009] mt76: mt7915: air monitor support
+Subject: [PATCH 1003/1042] mt76: mt7915: air monitor support
---
mt76_connac_mcu.h | 2 +
@@ -13,7 +13,7 @@
6 files changed, 440 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 26e7cf6f..841fcdec 100644
+index 26e7cf6..841fcde 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1192,6 +1192,8 @@ enum {
@@ -26,7 +26,7 @@
};
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 149527df..015f2705 100644
+index 149527d..015f270 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -548,6 +548,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 b44507f4..33db7202 100644
+index b44507f..33db720 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -691,6 +691,9 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -55,7 +55,7 @@
}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 8bb6d091..33ca8e8c 100644
+index 8bb6d09..33ca8e8 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -244,6 +244,35 @@ struct mt7915_hif {
@@ -114,7 +114,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 98fd9c2d..b94d787e 100644
+index 98fd9c2..b94d787 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -430,6 +430,353 @@ out:
@@ -491,7 +491,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 9d3db2a7..976817f3 100644
+index 9d3db2a..976817f 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -4,6 +4,7 @@
@@ -545,5 +545,5 @@
+
#endif
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch
index 242cfec..3c804e0 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch
@@ -1,7 +1,7 @@
-From 9252e4a6fbacaef7a3310d7d6773a6ad903e07c2 Mon Sep 17 00:00:00 2001
+From fb6b74ae5596a63325eaa024cf2ca4abdc9ba67e Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 22 Jun 2022 10:45:53 +0800
-Subject: [PATCH 1004/1009] mt76: mt7915: add support for muru_onoff via
+Subject: [PATCH 1004/1042] mt76: mt7915: add support for muru_onoff via
debugfs
---
@@ -12,7 +12,7 @@
4 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 79080aee..172bdcf2 100644
+index 79080ae..172bdcf 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -680,6 +680,7 @@ static void mt7915_init_work(struct work_struct *work)
@@ -24,7 +24,7 @@
void mt7915_wfsys_reset(struct mt7915_dev *dev)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index f483d443..e0e25a91 100644
+index f483d44..e0e25a9 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -876,13 +876,18 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
@@ -50,7 +50,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 f3dedd5b..b6840b22 100644
+index f3dedd5..b6840b2 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -608,4 +608,10 @@ struct csi_data {
@@ -65,7 +65,7 @@
+
#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 747a9014..176937ad 100644
+index 747a901..176937a 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2480,6 +2480,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data)
@@ -116,5 +116,5 @@
&fops_fw_debug_module);
debugfs_create_file("fw_debug_level", 0600, dir, dev,
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1005-mt76-mt7915-certification-patches.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1005-mt76-mt7915-certification-patches.patch
index 823536c..636f0a6 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1005-mt76-mt7915-certification-patches.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1005-mt76-mt7915-certification-patches.patch
@@ -1,7 +1,7 @@
-From ce4f3cb268d50b49fbde125fc00b8bcac938f45d Mon Sep 17 00:00:00 2001
+From 0e5f3fbc65dd09924683c8c5e6ba62f60cbd2843 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 1005/1009] mt76: mt7915: certification patches
+Subject: [PATCH 1005/1042] mt76: mt7915: certification patches
---
mt76_connac_mcu.h | 1 +
@@ -16,7 +16,7 @@
9 files changed, 956 insertions(+), 5 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 841fcdec..18ae3acb 100644
+index 841fcde..18ae3ac 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1194,6 +1194,7 @@ enum {
@@ -28,7 +28,7 @@
};
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 015f2705..229e68c3 100644
+index 015f270..229e68c 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 33db7202..3d309bc0 100644
+index 33db720..3d309bc 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -667,6 +667,9 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -109,7 +109,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 e0e25a91..4e36910c 100644
+index e0e25a9..4e36910 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3881,6 +3881,472 @@ mt7915_mcu_report_csi(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -586,7 +586,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b6840b22..d7322fe8 100644
+index b6840b2..d7322fe 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -415,10 +415,14 @@ enum {
@@ -820,7 +820,7 @@
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 33ca8e8c..415fe82a 100644
+index 33ca8e8..415fe82 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -714,6 +714,19 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -844,7 +844,7 @@
int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
u8 cfg, u8 v1, u32 v2, u8 *mac_addr);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 176937ad..e24b4d78 100644
+index 176937a..e24b4d7 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2486,7 +2486,8 @@ static int mt7915_muru_onoff_get(void *data, u64 *val)
@@ -869,7 +869,7 @@
}
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index b94d787e..7456c577 100644
+index b94d787..7456c57 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -22,6 +22,29 @@ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
@@ -1081,7 +1081,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 976817f3..1b08321c 100644
+index 976817f..1b08321 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -6,6 +6,48 @@
@@ -1134,5 +1134,5 @@
enum mtk_vendor_attr_csi_ctrl {
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch
index 407133d..23681ef 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch
@@ -1,7 +1,7 @@
-From 3443cd5ba3c9678a1bb644cdcf40d3554abfbfb3 Mon Sep 17 00:00:00 2001
+From 9427ac3e09d513858340177b70927f17cacd709c Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Fri, 27 May 2022 15:51:48 +0800
-Subject: [PATCH 1006/1009] mt76: mt7915:add support for runtime set in-band
+Subject: [PATCH 1006/1042] mt76: mt7915:add support for runtime set in-band
discovery
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4e36910c..47dee76e 100644
+index 4e36910..47dee76 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1993,8 +1993,7 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
@@ -33,5 +33,5 @@
buf = (u8 *)tlv + sizeof(*discov);
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
index 2e6b0f5..0d0a199 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
@@ -1,7 +1,7 @@
-From 82128a5100d8760dcb5a0b66011345a279ca55fb Mon Sep 17 00:00:00 2001
+From 19680b3e37b2fbee253100ff02f6aabf9c8025f6 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 22 Jun 2022 10:53:43 +0800
-Subject: [PATCH 1007/1009] mt76: mt7915: add mt76 vendor muru onoff command
+Subject: [PATCH 1007/1042] mt76: mt7915: add mt76 vendor muru onoff command
---
mt7915/mcu.c | 7 +++++++
@@ -11,7 +11,7 @@
4 files changed, 63 insertions(+)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 47dee76e..ec306f01 100644
+index 47dee76..ec306f0 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3900,6 +3900,13 @@ void mt7915_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -29,7 +29,7 @@
}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index d7322fe8..eaadd331 100644
+index d7322fe..eaadd33 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -422,6 +422,7 @@ enum {
@@ -41,7 +41,7 @@
};
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7456c577..c7551848 100644
+index 7456c57..c755184 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -34,6 +34,11 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
@@ -109,7 +109,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 1b08321c..a8e4ebf9 100644
+index 1b08321..a8e4ebf 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -8,6 +8,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -139,5 +139,5 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1008-mt76-mt7915-drop-undefined-action-frame.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1008-mt76-mt7915-drop-undefined-action-frame.patch
index 3538edb..0f987a7 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1008-mt76-mt7915-drop-undefined-action-frame.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1008-mt76-mt7915-drop-undefined-action-frame.patch
@@ -1,14 +1,14 @@
-From 0d3ed509726d42b595448135272a18e72d32ea85 Mon Sep 17 00:00:00 2001
+From fbc8ac0d6765825b5db2917b094c8327a547f1f6 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 1008/1009] mt76: mt7915: drop undefined action frame
+Subject: [PATCH 1008/1042] 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 229e68c3..fc7b7903 100644
+index 229e68c..fc7b790 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -761,6 +761,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -32,5 +32,5 @@
if (id < 0)
return id;
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1009-mt76-mt7915-add-fw_version-dump.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1009-mt76-mt7915-add-fw_version-dump.patch
index c0a81f3..d17456e 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/1009-mt76-mt7915-add-fw_version-dump.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1009-mt76-mt7915-add-fw_version-dump.patch
@@ -1,7 +1,7 @@
-From 2c612e7daf9f26ee8f1a77bb5d52858ae033923e Mon Sep 17 00:00:00 2001
+From 52bdf313f5aa51dc7617fd32ca35267fd6b1a8f6 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 17 Aug 2022 13:40:24 +0800
-Subject: [PATCH 1009/1009] mt76: mt7915: add fw_version dump
+Subject: [PATCH 1009/1042] mt76: mt7915: add fw_version dump
---
mt76.h | 4 ++++
@@ -10,7 +10,7 @@
3 files changed, 32 insertions(+)
diff --git a/mt76.h b/mt76.h
-index 1037d23b..beea57d5 100644
+index 1037d23..beea57d 100644
--- a/mt76.h
+++ b/mt76.h
@@ -837,6 +837,10 @@ struct mt76_dev {
@@ -25,7 +25,7 @@
struct mt76_power_limits {
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 5a047e63..cf6ec55f 100644
+index 5a047e6..cf6ec55 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -2968,6 +2968,9 @@ int mt76_connac2_load_ram(struct mt76_dev *dev, const char *fw_wm,
@@ -59,7 +59,7 @@
struct mt76_connac2_patch_sec *sec;
u32 len, addr, mode;
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index e24b4d78..d96f222a 100644
+index e24b4d7..766b278 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2721,6 +2721,22 @@ static int mt7915_agginfo_read_band1(struct seq_file *s, void *data)
@@ -70,7 +70,7 @@
+{
+ struct mt7915_dev *dev = dev_get_drvdata(s->private);
+ struct mt76_dev *mdev = NULL;
-+ seq_printf(s, "Version: 2.2.7.0\n");
++ seq_printf(s, "Version: 2.2.8.0\n");
+
+ if (!test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
+ return 0;
@@ -96,5 +96,5 @@
}
#endif
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch b/recipes-wifi/linux-mt76/files/patches-3.x/1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch
new file mode 100644
index 0000000..a10e878
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch
@@ -0,0 +1,143 @@
+From 0656e6d8dbeec9f83a1f20a0013112b814a0c4f0 Mon Sep 17 00:00:00 2001
+From: TomLiu <tomml.liu@mediatek.com>
+Date: Wed, 14 Dec 2022 00:44:07 -0800
+Subject: [PATCH] [mt76]amsdu set and get control
+
+---
+ mt7915/mac.c | 10 ++++++++++
+ mt7915/mt7915.h | 1 +
+ mt7915/vendor.c | 31 +++++++++++++++++++++++++++++++
+ mt7915/vendor.h | 12 ++++++++++++
+ 4 files changed, 54 insertions(+)
+
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index 3bbe757..0ef0fab 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -2072,6 +2072,16 @@ static void mt7915_mac_severe_check(struct mt7915_phy *phy)
+ phy->trb_ts = trb;
+ }
+
++void mt7915_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en) {
++ struct mt76_phy *mphy = hw->priv;
++ struct mt76_dev *mdev = mphy->dev;
++
++ if (en)
++ ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
++ else
++ ieee80211_hw_clear(hw, SUPPORTS_AMSDU_IN_AMPDU);
++}
++
+ #ifdef CONFIG_MTK_VENDOR
+ void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta)
+ {
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 0fb1de3..8ee553a 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -820,6 +820,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+ bool pci, int *irq);
+
+ #ifdef CONFIG_MTK_VENDOR
++void mt7915_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en);
+ void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta);
+ 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 22af66d..a1f526c 100644
+--- a/mt7915/vendor.c
++++ b/mt7915/vendor.c
+@@ -30,10 +30,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 },
++ [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 },
+ };
+
++static const struct nla_policy
++wireless_dump_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP] = {
++ [MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU] = { .type = NLA_U8 },
++};
++
+ static const struct nla_policy
+ hemu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_HEMU_CTRL] = {
+ [MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF] = {.type = NLA_U8 },
+@@ -983,11 +989,35 @@ 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 */
++ } 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);
+ }
+
+ return 0;
+ }
+
++static int
++mt7915_vendor_wireless_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
++ struct sk_buff *skb, const void *data, int data_len,
++ unsigned long *storage)
++{
++ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++ struct mt7915_phy *phy = mt7915_hw_phy(hw);
++ struct mt7915_dev *dev = phy->dev;
++ int len = 0;
++ if (*storage == 1)
++ return -ENOENT;
++ *storage = 1;
++
++ if (nla_put_u8(skb,
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, ieee80211_hw_check(hw, SUPPORTS_AMSDU_IN_AMPDU)))
++ return -ENOMEM;
++ len += 2;
++
++ return len;
++}
++
+ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data,
+@@ -1287,6 +1317,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,
++ .dumpit = mt7915_vendor_wireless_ctrl_dump,
+ .policy = wireless_ctrl_policy,
+ .maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX,
+ },
+diff --git a/mt7915/vendor.h b/mt7915/vendor.h
+index 949c885..cbff910 100644
+--- a/mt7915/vendor.h
++++ b/mt7915/vendor.h
+@@ -74,6 +74,7 @@ enum mtk_vendor_attr_wireless_ctrl {
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO,
++ MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT = 9,
+
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA, /* reserve */
+@@ -83,6 +84,17 @@ enum mtk_vendor_attr_wireless_ctrl {
+ NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1
+ };
+
++enum mtk_vendor_attr_wireless_dump {
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_UNSPEC,
++
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP,
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX =
++ NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP - 1
++};
++
+ enum mtk_vendor_attr_hemu_ctrl {
+ MTK_VENDOR_ATTR_HEMU_CTRL_UNSPEC,
+
+--
+2.32.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3001-mt76-mt7915-wed-add-wed-tx-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3001-mt76-mt7915-wed-add-wed-tx-support.patch
old mode 100644
new mode 100755
index 3086d77..74bc9e6
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3001-mt76-mt7915-wed-add-wed-tx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3001-mt76-mt7915-wed-add-wed-tx-support.patch
@@ -1,7 +1,7 @@
From aa48497ccb0236e8724d8434be06055e31297e93 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 3001/3011] mt76: mt7915: wed: add wed tx support
+Subject: [PATCH 3001/3012] mt76: mt7915: wed: add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch
new file mode 100755
index 0000000..b3442f4
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch
@@ -0,0 +1,207 @@
+From 2d158600e7c9b18069111d5935e9dbaf8c9277f3 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 3002/3012] mt76: mt7915: wed: add wds support when wed is
+ enabled
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ mt76.h | 6 ++++++
+ mt7915/main.c | 22 ++++++++++++++++++++--
+ mt7915/mcu.c | 13 +++++++++++--
+ mt7915/mcu.h | 1 +
+ util.c | 40 +++++++++++++++++++++++++++++++++++++---
+ util.h | 7 ++++++-
+ 6 files changed, 81 insertions(+), 8 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index 01baceaf..7b222e73 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -60,6 +60,12 @@ enum mt76_wed_type {
+ MT76_WED_Q_RX,
+ };
+
++enum mt76_wed_state {
++ MT76_WED_DEFAULT,
++ MT76_WED_ACTIVE,
++ MT76_WED_WDS_ACTIVE,
++};
++
+ struct mt76_bus_ops {
+ 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 370bfad7..75c78b8e 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -675,8 +675,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ #endif
+ int ret, idx;
+ u32 addr;
++ u8 flags = MT76_WED_DEFAULT;
+
+- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ !is_mt7915(&dev->mt76)) {
++ flags = test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ?
++ MT76_WED_WDS_ACTIVE : MT76_WED_ACTIVE;
++ }
++
++ idx = __mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA, flags);
+ if (idx < 0)
+ return -ENOSPC;
+
+@@ -1148,6 +1155,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
+ else
+ clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
+
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ !is_mt7915(&dev->mt76)) {
++ mt7915_sta_remove(hw, vif, sta);
++ mt76_sta_pre_rcu_remove(hw, vif, sta);
++ mt7915_sta_add(hw, vif, sta);
++ }
++
+ mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
+ }
+
+@@ -1519,8 +1533,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;
+- path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
+ path->mtk_wdma.queue = phy != &dev->phy;
++ if (test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ||
++ is_mt7915(&dev->mt76))
++ path->mtk_wdma.wcid = msta->wcid.idx;
++ else
++ path->mtk_wdma.wcid = 0x3ff;
+
+ ctx->dev = NULL;
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 4b7ad450..bdfb71e2 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -2350,8 +2350,17 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+ if (ret)
+ return ret;
+
+- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
+- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ if (is_mt7915(&dev->mt76))
++ ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
++ 0, 0, 0);
++ else
++ ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
++ MCU_WA_PARAM_WED_VERSION,
++ dev->mt76.mmio.wed.rev_id, 0);
++ if (ret)
++ return ret;
++ }
+
+ ret = mt7915_mcu_set_mwds(dev, 1);
+ if (ret)
+diff --git a/mt7915/mcu.h b/mt7915/mcu.h
+index d110e210..edb8b510 100644
+--- a/mt7915/mcu.h
++++ b/mt7915/mcu.h
+@@ -284,6 +284,7 @@ enum {
+ MCU_WA_PARAM_PDMA_RX = 0x04,
+ MCU_WA_PARAM_CPU_UTIL = 0x0b,
+ MCU_WA_PARAM_RED = 0x0e,
++ MCU_WA_PARAM_WED_VERSION = 0x32,
+ #ifdef MTK_DEBUG
+ MCU_WA_PARAM_RED_SHOW_STA = 0xf,
+ MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
+diff --git a/util.c b/util.c
+index 58196442..5cd5ede0 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,
+ }
+ EXPORT_SYMBOL_GPL(__mt76_poll_msec);
+
+-int mt76_wcid_alloc(u32 *mask, int size)
++int __mt76_wcid_alloc(u32 *mask, int size, u8 flag)
+ {
++#define MT76_WED_WDS_MIN 256
++#define MT76_WED_WDS_CNT 16
++
+ int i, idx = 0, cur;
++ int min = MT76_WED_WDS_MIN;
++ int max = min + MT76_WED_WDS_CNT;
+
+ for (i = 0; i < DIV_ROUND_UP(size, 32); i++) {
+ idx = ffs(~mask[i]);
+@@ -53,16 +58,45 @@ int mt76_wcid_alloc(u32 *mask, int size)
+
+ idx--;
+ cur = i * 32 + idx;
+- if (cur >= size)
++
++ switch (flag) {
++ case MT76_WED_ACTIVE:
++ if (cur >= min && cur < max)
++ continue;
++
++ if (cur >= size) {
++ u32 end = MT76_WED_WDS_CNT - 1;
++
++ i = min / 32;
++ idx = ffs(~mask[i] & GENMASK(end, 0));
++ if (!idx)
++ goto error;
++ idx--;
++ cur = min + idx;
++ }
++
+ break;
++ case MT76_WED_WDS_ACTIVE:
++ if (cur < min)
++ continue;
++ if (cur >= max)
++ goto error;
++
++ break;
++ default:
++ if (cur >= size)
++ goto error;
++ break;
++ }
+
+ mask[i] |= BIT(idx);
+ return cur;
+ }
+
++error:
+ return -1;
+ }
+-EXPORT_SYMBOL_GPL(mt76_wcid_alloc);
++EXPORT_SYMBOL_GPL(__mt76_wcid_alloc);
+
+ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy)
+ {
+diff --git a/util.h b/util.h
+index 260965dd..99b7263c 100644
+--- a/util.h
++++ b/util.h
+@@ -27,7 +27,12 @@ enum {
+ #define MT76_INCR(_var, _size) \
+ (_var = (((_var) + 1) % (_size)))
+
+-int mt76_wcid_alloc(u32 *mask, int size);
++int __mt76_wcid_alloc(u32 *mask, int size, u8 flags);
++
++static inline int mt76_wcid_alloc(u32 *mask, int size)
++{
++ return __mt76_wcid_alloc(mask, size, 0);
++}
+
+ static inline void
+ mt76_wcid_mask_set(u32 *mask, int idx)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch
deleted file mode 100644
index 829a48a..0000000
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch
+++ /dev/null
@@ -1,230 +0,0 @@
-From 8c5f91270dc8d3a1b8d36a00130bbe0450dbfe61 Mon Sep 17 00:00:00 2001
-From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Sat, 10 Sep 2022 17:09:21 +0800
-Subject: [PATCH 3002/3011] mt76: mt7915: wed: add-wed-tx-wds-support-on-mt7986
-
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
----
- mac80211.c | 5 ++++-
- mt76.h | 2 ++
- mt7915/init.c | 9 +++++++++
- mt7915/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
- mt7915/mcu.c | 12 ++++++++++--
- mt7915/mcu.h | 1 +
- mt7915/mmio.c | 1 +
- mt7915/mt7915.h | 4 ++++
- 8 files changed, 74 insertions(+), 5 deletions(-)
-
-diff --git a/mac80211.c b/mac80211.c
-index de9ef237..15d300a9 100644
---- a/mac80211.c
-+++ b/mac80211.c
-@@ -1385,7 +1385,10 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif,
-
- mt76_packet_id_flush(dev, wcid);
-
-- mt76_wcid_mask_clear(dev->wcid_mask, idx);
-+ if (dev->drv->wed_wds_check && dev->drv->wed_wds_check(dev, sta))
-+ mt76_wcid_mask_clear(dev->wcid_wds_mask, idx);
-+ else
-+ mt76_wcid_mask_clear(dev->wcid_mask, idx);
- mt76_wcid_mask_clear(dev->wcid_phy_mask, idx);
- }
- EXPORT_SYMBOL_GPL(__mt76_sta_remove);
-diff --git a/mt76.h b/mt76.h
-index 01baceaf..fb8c15eb 100644
---- a/mt76.h
-+++ b/mt76.h
-@@ -465,6 +465,7 @@ struct mt76_driver_ops {
-
- void (*sta_remove)(struct mt76_dev *dev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
-+ bool (*wed_wds_check)(struct mt76_dev *dev, struct ieee80211_sta *sta);
- };
-
- struct mt76_channel_state {
-@@ -849,6 +850,7 @@ struct mt76_dev {
- spinlock_t status_lock;
-
- u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
-+ u32 wcid_wds_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
- u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
-
- u64 vif_mask;
-diff --git a/mt7915/init.c b/mt7915/init.c
-index 3f0a9d93..1ed519be 100644
---- a/mt7915/init.c
-+++ b/mt7915/init.c
-@@ -793,6 +793,15 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
- return ret;
- }
-
-+ /* wds workaround for mt7986 */
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7986(&dev->mt76)) {
-+ for(idx = MT7915_WTBL_WDS_START; idx < MT7915_WTBL_WDS_END; idx++)
-+ mt76_wcid_mask_set(dev->mt76.wcid_mask, idx);
-+
-+ for (idx = 0; idx < DIV_ROUND_UP(MT7915_WTBL_STA, 32); idx++)
-+ dev->mt76.wcid_wds_mask[idx] = ~dev->mt76.wcid_mask[idx];
-+ }
-+
- /* Beacon and mgmt frames should occupy wcid 0 */
- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
- if (idx)
-diff --git a/mt7915/main.c b/mt7915/main.c
-index 370bfad7..0e08bde6 100644
---- a/mt7915/main.c
-+++ b/mt7915/main.c
-@@ -663,6 +663,24 @@ mt7915_channel_switch_beacon(struct ieee80211_hw *hw,
- mutex_unlock(&dev->mt76.mutex);
- }
-
-+bool
-+mt7915_wed_wds_check(struct mt76_dev *mdev, struct ieee80211_sta *sta)
-+{
-+ struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
-+
-+ if (!mtk_wed_device_active(&mdev->mmio.wed))
-+ return false;
-+
-+ if(!is_mt7986(mdev))
-+ return false;
-+
-+ if((msta->wcid.idx < MT7915_WTBL_WDS_START ||
-+ msta->wcid.idx > MT7915_WTBL_WDS_END))
-+ return false;
-+
-+ return true;
-+}
-+
- int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
- {
-@@ -675,8 +693,18 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- #endif
- int ret, idx;
- u32 addr;
-+ bool wed_wds = false;
-+
-+ if (mtk_wed_device_active(&mdev->mmio.wed) && is_mt7986(mdev))
-+ wed_wds = !!test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
-
-- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
-+ if (wed_wds)
-+ idx = mt76_wcid_alloc(mdev->wcid_wds_mask, MT7915_WTBL_STA);
-+ else {
-+ idx = mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA);
-+ if (idx < 0)
-+ idx = mt76_wcid_alloc(mdev->wcid_wds_mask, MT7915_WTBL_STA);
-+ }
- if (idx < 0)
- return -ENOSPC;
-
-@@ -1148,6 +1176,15 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
- else
- clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
-
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
-+ is_mt7986(&dev->mt76) &&
-+ (msta->wcid.idx < MT7915_WTBL_WDS_START ||
-+ msta->wcid.idx > MT7915_WTBL_WDS_END)) {
-+ mt7915_sta_remove(hw, vif, sta);
-+ mt76_sta_pre_rcu_remove(hw, vif, sta);
-+ mt7915_sta_add(hw, vif, sta);
-+ }
-+
- mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
- }
-
-@@ -1519,7 +1556,11 @@ 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;
-- path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
-+
-+ if (test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags))
-+ path->mtk_wdma.wcid = msta->wcid.idx;
-+ else
-+ path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
- path->mtk_wdma.queue = phy != &dev->phy;
-
- ctx->dev = NULL;
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4b7ad450..3b16a7fb 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -2321,6 +2321,7 @@ mt7915_mcu_init_rx_airtime(struct mt7915_dev *dev)
- int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
- {
- int ret;
-+ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
-
- /* force firmware operation mode into normal state,
- * which should be set before firmware download stage.
-@@ -2350,8 +2351,15 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
- if (ret)
- return ret;
-
-- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
-- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
-+ if (mtk_wed_device_active(wed)) {
-+ if (is_mt7915(&dev->mt76))
-+ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
-+ 0, 0, 0);
-+ else
-+ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
-+ MCU_WA_PARAM_WED_VERSION,
-+ wed->rev_id, 0);
-+ }
-
- ret = mt7915_mcu_set_mwds(dev, 1);
- if (ret)
-diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index d110e210..b30cc820 100644
---- a/mt7915/mcu.h
-+++ b/mt7915/mcu.h
-@@ -288,6 +288,7 @@ enum {
- MCU_WA_PARAM_RED_SHOW_STA = 0xf,
- MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
- #endif
-+ MCU_WA_PARAM_WED_VERSION = 0x32,
- };
-
- enum mcu_mmps_mode {
-diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index ac574722..ffe23406 100644
---- a/mt7915/mmio.c
-+++ b/mt7915/mmio.c
-@@ -998,6 +998,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
- .sta_add = mt7915_mac_sta_add,
- .sta_remove = mt7915_mac_sta_remove,
- .update_survey = mt7915_update_channel,
-+ .wed_wds_check = mt7915_wed_wds_check,
- };
- struct mt7915_dev *dev;
- struct mt76_dev *mdev;
-diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 2e6519e7..836d485f 100644
---- a/mt7915/mt7915.h
-+++ b/mt7915/mt7915.h
-@@ -18,6 +18,9 @@
- #define MT7915_WTBL_STA (MT7915_WTBL_RESERVED - \
- MT7915_MAX_INTERFACES)
-
-+#define MT7915_WTBL_WDS_START 256
-+#define MT7915_WTBL_WDS_END 271
-+
- #define MT7915_WATCHDOG_TIME (HZ / 10)
- #define MT7915_RESET_TIMEOUT (30 * HZ)
-
-@@ -726,6 +729,7 @@ void mt7915_tx_token_put(struct mt7915_dev *dev);
- void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- struct sk_buff *skb, u32 *info);
- bool mt7915_rx_check(struct mt76_dev *mdev, void *data, int len);
-+bool mt7915_wed_wds_check(struct mt76_dev *mdev, struct ieee80211_sta *sta);
- void mt7915_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
- void mt7915_stats_work(struct work_struct *work);
- int mt76_dfs_start_rdd(struct mt7915_dev *dev, bool force);
---
-2.25.1
-
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch
old mode 100644
new mode 100755
index ee14206..0185209
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch
@@ -1,7 +1,7 @@
From ca14459b70818a138fa83ec38bfc91bce44b645c Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 12:05:06 +0800
-Subject: [PATCH 3003/3011] mt76: connac: wed: add wed rx copy skb
+Subject: [PATCH 3003/3012] mt76: connac: wed: add wed rx copy skb
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch
old mode 100644
new mode 100755
index 0835b2c..0dc64bc
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch
@@ -1,7 +1,7 @@
From 9c13748447e65404ad43c95b11479b71557851d8 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Thu, 19 May 2022 13:44:42 +0800
-Subject: [PATCH 3004/3011] mt76: mt7915: wed: add fill receive path to report
+Subject: [PATCH 3004/3012] mt76: mt7915: wed: add fill receive path to report
wed idx
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
@@ -13,7 +13,7 @@
index 0e08bde6..d8571642 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1567,6 +1567,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1544,6 +1544,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
return 0;
}
@@ -38,7 +38,7 @@
#endif
const struct ieee80211_ops mt7915_ops = {
-@@ -1619,5 +1637,6 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1596,5 +1614,6 @@ 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-3.x/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch
old mode 100644
new mode 100755
index 895588a..3222bb1
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch
@@ -1,7 +1,7 @@
-From e199b3a9a4dcf01c00fd367e7dea297b0c0e308b Mon Sep 17 00:00:00 2001
+From 5a4e0813aaaf66a658c9907b7834cb61e10ae682 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 14:07:46 +0800
-Subject: [PATCH 3005/3011] mt76: mt7915: wed: add ser support when wed on
+Subject: [PATCH 3005/3012] mt76: mt7915: wed: add ser support when wed on
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
@@ -120,10 +120,10 @@
#endif
diff --git a/mt76.h b/mt76.h
-index fb8c15eb..b107516d 100644
+index 7b222e73..75975cb5 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -1391,6 +1391,7 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+@@ -1395,6 +1395,7 @@ 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);
void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
@@ -247,7 +247,7 @@
if (ext_phy)
ieee80211_stop_queues(ext_phy->hw);
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index ffe23406..6fb3419d 100644
+index ac574722..ecc38e05 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -617,6 +617,8 @@ static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
@@ -268,10 +268,10 @@
dev->mt76.rx_token_size = wed->wlan.rx_npkt;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 836d485f..8ea75fb9 100644
+index 2e6519e7..f9c02912 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -562,6 +562,7 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
+@@ -559,6 +559,7 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch
old mode 100644
new mode 100755
index ed5376a..58d589d
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch
@@ -1,7 +1,7 @@
-From 07b444485d3b25b459d5e2a9a9b84ccb0613a1db Mon Sep 17 00:00:00 2001
+From 2c9f6ad4b961b736f60003d50b3e145c7b33a79d Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 2 Sep 2022 14:40:40 +0800
-Subject: [PATCH 3006/3011] mt76: mt7915: wed: enable red per-band token drop
+Subject: [PATCH 3006/3012] mt76: mt7915: wed: enable red per-band token drop
for HW Path
Limit the number of token used by each band. If a band uses too many token,
@@ -10,30 +10,34 @@
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
- mt7915/mcu.c | 53 +++++++++++++++++++++++++++++++++++++++----------
+ mt7915/mcu.c | 57 ++++++++++++++++++++++++++++++++++++++++---------
mt7915/mcu.h | 1 +
mt7915/mt7915.h | 3 ++-
- 3 files changed, 46 insertions(+), 11 deletions(-)
+ 3 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 3b16a7fb..2cfd5f4a 100644
+index bdfb71e2..daa0006b 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -2359,8 +2359,13 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
- MCU_WA_PARAM_WED_VERSION,
- wed->rev_id, 0);
+@@ -2360,8 +2360,17 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+ dev->mt76.mmio.wed.rev_id, 0);
+ if (ret)
+ return ret;
+
-+ mt7915_mcu_set_red(dev, true);
++ ret = mt7915_mcu_set_red(dev, true);
++ if (ret)
++ return ret;
+ } else {
+ mt7915_mcu_set_red(dev, false);
++ if (ret)
++ return ret;
}
+
ret = mt7915_mcu_set_mwds(dev, 1);
if (ret)
return ret;
-@@ -2370,12 +2375,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+@@ -2371,12 +2380,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
if (ret)
return ret;
@@ -47,7 +51,7 @@
}
int mt7915_mcu_init(struct mt7915_dev *dev)
-@@ -4507,6 +4507,35 @@ int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a
+@@ -4508,6 +4512,35 @@ int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a
return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), wait_resp);
}
@@ -83,7 +87,7 @@
int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled)
{
-@@ -4517,17 +4546,21 @@ int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled)
+@@ -4518,17 +4551,21 @@ int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled)
u32 red_type = enabled > 0 ? RED_BY_WA_ENABLE : RED_DISABLE;
__le32 req = cpu_to_le32(red_type);
@@ -110,22 +114,22 @@
int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b30cc820..9f882042 100644
+index edb8b510..7963a700 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
-@@ -289,6 +289,7 @@ enum {
- MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
- #endif
+@@ -285,6 +285,7 @@ enum {
+ MCU_WA_PARAM_CPU_UTIL = 0x0b,
+ MCU_WA_PARAM_RED = 0x0e,
MCU_WA_PARAM_WED_VERSION = 0x32,
+ MCU_WA_PARAM_RED_SETTING = 0x40,
- };
-
- enum mcu_mmps_mode {
+ #ifdef MTK_DEBUG
+ MCU_WA_PARAM_RED_SHOW_STA = 0xf,
+ MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 8ea75fb9..def78c67 100644
+index f9c02912..819cec99 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -775,13 +775,14 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
+@@ -771,13 +771,14 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
#endif
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/recipes-wifi/linux-mt76/files/patches-3.x/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch
old mode 100644
new mode 100755
index c4af9df..52127c6
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch
@@ -1,7 +1,7 @@
From f30bc7032eeb4a32393bdec69e719e3a1c9ceeae Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 22 Sep 2022 09:54:53 +0800
-Subject: [PATCH 3007/3011] mt76: mt7915: wed: update mt7916 trinfo when hw
+Subject: [PATCH 3007/3012] mt76: mt7915: wed: update mt7916 trinfo when hw
path enable
---
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch
old mode 100644
new mode 100755
index afafd01..0309f74
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch
@@ -1,13 +1,13 @@
From 82ba992b09e55d1291387351cc9dc0da0c6cb66b 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 3008/3011] mt76: mt7915: wed: find rx token by physical
+Subject: [PATCH 3008/3012] mt76: mt7915: wed: 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.
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
dma.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch
old mode 100644
new mode 100755
index dc1c019..8d47adc
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch
@@ -1,12 +1,12 @@
From 7b8d03a4a4996e29c178a870c29b8ba7bd45c6d6 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 25 Nov 2022 14:37:58 +0800
-Subject: [PATCH 3009/3011] mt76: mt7915: wed: drop scatter and gather frame
+Subject: [PATCH 3009/3012] mt76: mt7915: wed: drop scatter and gather frame
The scatter and gather frame may be incorrect because WED and WO may
send frames to host driver interleaved.
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
dma.c | 9 +++++++++
dma.h | 1 +
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
old mode 100644
new mode 100755
index e4ed9eb..56903c1
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
@@ -1,7 +1,7 @@
-From 1312c8e16c778c9c42f993466caf6fee4b7d2f3f Mon Sep 17 00:00:00 2001
+From 40d816ec96c946c37635205f6f4a28795be5ffc0 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 3010/3011] mt76: mt7915: wed: HW ATF support for mt7986
+Subject: [PATCH 3010/3012] mt76: mt7915: wed: HW ATF support for mt7986
Signed-off-by: Lian Chen <lian.chen@mediatek.com>
---
@@ -468,7 +468,7 @@
diff --git a/mt7915/init.c b/mt7915/init.c
old mode 100644
new mode 100755
-index 1ed519be..c347509b
+index 3f0a9d93..b9216233
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -550,10 +550,46 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
@@ -529,7 +529,7 @@
int mt7915_txbf_init(struct mt7915_dev *dev)
diff --git a/mt7915/main.c b/mt7915/main.c
-index d8571642..dcf1583d 100644
+index 31cac5e1..a8e722f1 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -199,6 +199,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
@@ -551,7 +551,7 @@
out:
mutex_unlock(&dev->mt76.mutex);
-@@ -688,6 +693,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -670,6 +675,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;
@@ -559,7 +559,7 @@
#ifdef CONFIG_MTK_VENDOR
struct mt7915_phy *phy;
#endif
-@@ -742,6 +748,16 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -721,6 +727,16 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7915_mcu_set_mimo(phy, 0);
}
#endif
@@ -577,10 +577,10 @@
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 2cfd5f4a..4acca9d9 100644
+index daa0006b..3db8e436 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -3506,6 +3506,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
+@@ -3511,6 +3511,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
&req, sizeof(req), false);
}
@@ -753,10 +753,10 @@
{
struct {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index def78c67..0fb1de3e 100644
+index 819cec99..ed293e70 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -133,6 +133,58 @@ struct mt7915_twt_flow {
+@@ -130,6 +130,58 @@ struct mt7915_twt_flow {
DECLARE_EWMA(avg_signal, 10, 8)
@@ -815,7 +815,7 @@
struct mt7915_sta {
struct mt76_wcid wcid; /* must be first */
-@@ -154,6 +206,7 @@ struct mt7915_sta {
+@@ -151,6 +203,7 @@ struct mt7915_sta {
u8 flowid_mask;
struct mt7915_twt_flow flow[MT7915_MAX_STA_TWT_AGRT];
} twt;
@@ -823,7 +823,7 @@
};
struct mt7915_vif_cap {
-@@ -468,6 +521,8 @@ struct mt7915_dev {
+@@ -465,6 +518,8 @@ struct mt7915_dev {
} dbg;
const struct mt7915_dbg_reg_desc *dbg_reg;
#endif
@@ -832,7 +832,7 @@
};
enum {
-@@ -500,6 +555,15 @@ enum mt7915_rdd_cmd {
+@@ -497,6 +552,15 @@ enum mt7915_rdd_cmd {
RDD_IRQ_OFF,
};
@@ -848,7 +848,7 @@
static inline struct mt7915_phy *
mt7915_hw_phy(struct ieee80211_hw *hw)
{
-@@ -627,6 +691,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
+@@ -624,6 +688,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-3.x/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch
old mode 100644
new mode 100755
index 0a00aef..fd0f0b6
--- a/recipes-wifi/linux-mt76/files/patches-3.x/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch
@@ -1,7 +1,7 @@
-From b9cfe422dcdce6badd19d45b23affb51e6820300 Mon Sep 17 00:00:00 2001
+From 6a67d8e3c682c1f4332c2a45e0e4214c54605e67 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 2 Dec 2022 17:17:06 +0800
-Subject: [PATCH 3011/3011] mt76: mt7915: wed: add mt7916 2 pcie support when
+Subject: [PATCH 3011/3012] mt76: mt7915: wed: add mt7916 2 pcie support when
wed on
It should use bit 23 in interrupt mask for wfdma band1 data
@@ -10,9 +10,9 @@
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
mt7915/dma.c | 8 ++++++--
- mt7915/mcu.c | 2 +-
+ mt7915/mcu.c | 3 ++-
mt7915/mmio.c | 10 +++++-----
- 3 files changed, 12 insertions(+), 8 deletions(-)
+ 3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/mt7915/dma.c b/mt7915/dma.c
index 1ae6c339..36260085 100644
@@ -34,20 +34,21 @@
MT7916_RXQ_MCU_WA_MAIN);
TXQ_CONFIG(0, WFDMA0, MT_INT_WED_TX_DONE_BAND0,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4acca9d9..1cdb9d45 100644
+index 3db8e436..2a689e92 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -2352,7 +2352,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+@@ -2351,7 +2351,8 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
return ret;
- if (mtk_wed_device_active(wed)) {
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
- if (is_mt7915(&dev->mt76))
-+ if (is_mt7915(&dev->mt76) || !mtk_wed_get_rx_capa(wed))
- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
- 0, 0, 0);
++ if (is_mt7915(&dev->mt76) ||
++ !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed))
+ ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
+ 0, 0, 0);
else
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6fb3419d..e30a8d4c 100644
+index ecc38e05..992beca3 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -964,13 +964,13 @@ irqreturn_t mt7915_irq_handler(int irq, void *dev_instance)
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch b/recipes-wifi/linux-mt76/files/patches-3.x/3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch
new file mode 100755
index 0000000..dc594ef
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch
@@ -0,0 +1,500 @@
+From c326d38bf0da40d6b0ccbd13de2bb267398598d0 Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Wed, 14 Dec 2022 17:19:00 +0800
+Subject: [PATCH 3012/3013] mt76: mt7915: wed: add rxwi for further in chip rro
+ development
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ dma.c | 98 +++++++++++++++++++++++++------------------------
+ mac80211.c | 2 +-
+ mt76.h | 24 +++++++-----
+ mt7915/dma.c | 2 -
+ mt7915/mmio.c | 21 ++++++-----
+ mt7915/mt7915.h | 1 +
+ tx.c | 16 ++++----
+ 7 files changed, 86 insertions(+), 78 deletions(-)
+
+diff --git a/dma.c b/dma.c
+index 0914266a..7ef272e2 100644
+--- a/dma.c
++++ b/dma.c
+@@ -59,17 +59,17 @@ mt76_alloc_txwi(struct mt76_dev *dev)
+ return t;
+ }
+
+-static struct mt76_txwi_cache *
++static struct mt76_rxwi_cache *
+ mt76_alloc_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+- t = kzalloc(L1_CACHE_ALIGN(sizeof(*t)), GFP_ATOMIC);
+- if (!t)
++ r = kzalloc(L1_CACHE_ALIGN(sizeof(*r)), GFP_ATOMIC);
++ if (!r)
+ return NULL;
+
+- t->ptr = NULL;
+- return t;
++ r->ptr = NULL;
++ return r;
+ }
+
+ static struct mt76_txwi_cache *
+@@ -88,20 +88,20 @@ __mt76_get_txwi(struct mt76_dev *dev)
+ return t;
+ }
+
+-static struct mt76_txwi_cache *
++static struct mt76_rxwi_cache *
+ __mt76_get_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t = NULL;
++ struct mt76_rxwi_cache *r = NULL;
+
+- spin_lock(&dev->wed_lock);
++ spin_lock(&dev->lock);
+ if (!list_empty(&dev->rxwi_cache)) {
+- t = list_first_entry(&dev->rxwi_cache, struct mt76_txwi_cache,
++ r = list_first_entry(&dev->rxwi_cache, struct mt76_rxwi_cache,
+ list);
+- list_del(&t->list);
++ list_del(&r->list);
+ }
+- spin_unlock(&dev->wed_lock);
++ spin_unlock(&dev->lock);
+
+- return t;
++ return r;
+ }
+
+ static struct mt76_txwi_cache *
+@@ -115,13 +115,13 @@ mt76_get_txwi(struct mt76_dev *dev)
+ return mt76_alloc_txwi(dev);
+ }
+
+-struct mt76_txwi_cache *
++struct mt76_rxwi_cache *
+ mt76_get_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t = __mt76_get_rxwi(dev);
++ struct mt76_rxwi_cache *r = __mt76_get_rxwi(dev);
+
+- if (t)
+- return t;
++ if (r)
++ return r;
+
+ return mt76_alloc_rxwi(dev);
+ }
+@@ -140,14 +140,14 @@ mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
+ EXPORT_SYMBOL_GPL(mt76_put_txwi);
+
+ void
+-mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
++mt76_put_rxwi(struct mt76_dev *dev, struct mt76_rxwi_cache *r)
+ {
+- if (!t)
++ if (!r)
+ return;
+
+- spin_lock(&dev->wed_lock);
+- list_add(&t->list, &dev->rxwi_cache);
+- spin_unlock(&dev->wed_lock);
++ spin_lock(&dev->lock);
++ list_add(&r->list, &dev->rxwi_cache);
++ spin_unlock(&dev->lock);
+ }
+ EXPORT_SYMBOL_GPL(mt76_put_rxwi);
+
+@@ -168,13 +168,13 @@ mt76_free_pending_txwi(struct mt76_dev *dev)
+ void
+ mt76_free_pending_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+ local_bh_disable();
+- while ((t = __mt76_get_rxwi(dev)) != NULL) {
+- if (t->ptr)
+- skb_free_frag(t->ptr);
+- kfree(t);
++ while ((r = __mt76_get_rxwi(dev)) != NULL) {
++ if (r->ptr)
++ skb_free_frag(r->ptr);
++ kfree(r);
+ }
+ local_bh_enable();
+ }
+@@ -209,7 +209,7 @@ mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q)
+ static int
+ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ struct mt76_queue_buf *buf, int nbufs, u32 info,
+- struct sk_buff *skb, void *txwi)
++ struct sk_buff *skb, void *txwi, void *rxwi)
+ {
+ struct mt76_queue_entry *entry;
+ struct mt76_desc *desc;
+@@ -227,13 +227,13 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+
+ if ((q->flags & MT_QFLAG_WED) &&
+ FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
+- struct mt76_txwi_cache *t = txwi;
++ struct mt76_rxwi_cache *r = rxwi;
+ int rx_token;
+
+- if (!t)
++ if (!r)
+ return -ENOMEM;
+
+- rx_token = mt76_rx_token_consume(dev, (void *)skb, t,
++ rx_token = mt76_rx_token_consume(dev, (void *)skb, r,
+ buf[0].addr);
+ if (rx_token < 0)
+ return -ENOMEM;
+@@ -280,6 +280,7 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ }
+
+ q->entry[idx].txwi = txwi;
++ q->entry[idx].rxwi = rxwi;
+ q->entry[idx].skb = skb;
+ q->entry[idx].wcid = 0xffff;
+
+@@ -379,13 +380,13 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ u32 id, find = 0;
+ u32 token = FIELD_GET(MT_DMA_CTL_TOKEN,
+ le32_to_cpu(desc->buf1));
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+ if (*more) {
+ spin_lock_bh(&dev->rx_token_lock);
+
+- idr_for_each_entry(&dev->rx_token, t, id) {
+- if (t->dma_addr == le32_to_cpu(desc->buf0)) {
++ idr_for_each_entry(&dev->rx_token, r, id) {
++ if (r->dma_addr == le32_to_cpu(desc->buf0)) {
+ find = 1;
+ desc->buf1 = FIELD_PREP(MT_DMA_CTL_TOKEN, id);
+ token = id;
+@@ -398,11 +399,11 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ return NULL;
+ }
+
+- t = mt76_rx_token_release(dev, token);
+- if (!t)
++ r = mt76_rx_token_release(dev, token);
++ if (!r)
+ return NULL;
+
+- dma_unmap_single(dev->dma_dev, t->dma_addr,
++ dma_unmap_single(dev->dma_dev, r->dma_addr,
+ SKB_WITH_OVERHEAD(q->buf_size),
+ DMA_FROM_DEVICE);
+
+@@ -410,10 +411,10 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ if (!buf)
+ return NULL;
+
+- memcpy(buf, t->ptr, SKB_WITH_OVERHEAD(q->buf_size));
+- t->dma_addr = 0;
++ memcpy(buf, r->ptr, SKB_WITH_OVERHEAD(q->buf_size));
++ r->dma_addr = 0;
+
+- mt76_put_rxwi(dev, t);
++ mt76_put_rxwi(dev, r);
+
+ if (drop) {
+ u32 ctrl = le32_to_cpu(READ_ONCE(desc->ctrl));
+@@ -481,7 +482,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
+ buf.len = skb->len;
+
+ spin_lock_bh(&q->lock);
+- mt76_dma_add_buf(dev, q, &buf, 1, tx_info, skb, NULL);
++ mt76_dma_add_buf(dev, q, &buf, 1, tx_info, skb, NULL, NULL);
+ mt76_dma_kick_queue(dev, q);
+ spin_unlock_bh(&q->lock);
+
+@@ -558,7 +559,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
+ goto unmap;
+
+ return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
+- tx_info.info, tx_info.skb, t);
++ tx_info.info, tx_info.skb, t, NULL);
+
+ unmap:
+ for (n--; n > 0; n--)
+@@ -598,20 +599,21 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+ spin_lock_bh(&q->lock);
+
+ while (q->queued < q->ndesc - 1) {
+- struct mt76_txwi_cache *t = NULL;
++ struct mt76_rxwi_cache *r = NULL;
+ struct mt76_queue_buf qbuf;
+ bool skip_alloc = false;
+ void *buf = NULL;
+
+ if ((q->flags & MT_QFLAG_WED) &&
+ FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
+- t = mt76_get_rxwi(dev);
+- if (!t)
++ r = mt76_get_rxwi(dev);
++ if (!r)
+ break;
+
+- if (t->ptr) {
++ /* reuse skb buf for wed rx copy*/
++ if (r->ptr) {
+ skip_alloc = true;
+- buf = t->ptr;
++ buf = r->ptr;
+ }
+ }
+
+@@ -630,7 +632,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+ qbuf.addr = addr + offset;
+ qbuf.len = len - offset;
+ qbuf.skip_unmap = false;
+- if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t) < 0) {
++ if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, NULL, r) < 0) {
+ dma_unmap_single(dev->dma_dev, addr, len,
+ DMA_FROM_DEVICE);
+ skb_free_frag(buf);
+diff --git a/mac80211.c b/mac80211.c
+index de9ef237..818f4f0c 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -597,7 +597,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);
+- spin_lock_init(&dev->wed_lock);
+ mutex_init(&dev->mutex);
+ init_waitqueue_head(&dev->tx_wait);
+
+@@ -628,6 +627,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;
++ dev->rx_token_size = dev->drv->rx_token_size;
+
+ 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 f1795778..42364b81 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -166,6 +166,7 @@ struct mt76_queue_entry {
+ };
+ union {
+ struct mt76_txwi_cache *txwi;
++ struct mt76_rxwi_cache *rxwi;
+ struct urb *urb;
+ int buf_sz;
+ };
+@@ -354,10 +355,15 @@ struct mt76_txwi_cache {
+ struct list_head list;
+ dma_addr_t dma_addr;
+
+- union {
+- struct sk_buff *skb;
+- void *ptr;
+- };
++ struct sk_buff *skb;
++};
++
++struct mt76_rxwi_cache {
++ struct list_head list;
++ dma_addr_t dma_addr;
++
++ void *ptr;
++ u32 token;
+ };
+
+ struct mt76_rx_tid {
+@@ -441,6 +447,7 @@ struct mt76_driver_ops {
+ u16 txwi_size;
+ u16 token_size;
+ u8 mcs_rates;
++ u16 rx_token_size;
+
+ void (*update_survey)(struct mt76_phy *phy);
+
+@@ -805,7 +812,6 @@ struct mt76_dev {
+
+ struct ieee80211_hw *hw;
+
+- spinlock_t wed_lock;
+ spinlock_t lock;
+ spinlock_t cc_lock;
+
+@@ -1394,8 +1400,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);
+-void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
+-struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
++void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_rxwi_cache *r);
++struct mt76_rxwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
+ 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);
+@@ -1541,9 +1547,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);
+-struct mt76_txwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
++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,
+- struct mt76_txwi_cache *r, dma_addr_t phys);
++ struct mt76_rxwi_cache *r, dma_addr_t phys);
+
+ static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
+ {
+diff --git a/mt7915/dma.c b/mt7915/dma.c
+index 36260085..9cbd3625 100644
+--- a/mt7915/dma.c
++++ b/mt7915/dma.c
+@@ -492,7 +492,6 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ mtk_wed_get_rx_capa(&mdev->mmio.wed)) {
+ dev->mt76.q_rx[MT_RXQ_MAIN].flags =
+ MT_WED_Q_RX(MT7915_RXQ_BAND0);
+- dev->mt76.rx_token_size += MT7915_RX_RING_SIZE;
+ }
+
+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
+@@ -529,7 +528,6 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ mtk_wed_get_rx_capa(&mdev->mmio.wed)) {
+ dev->mt76.q_rx[MT_RXQ_BAND1].flags =
+ MT_WED_Q_RX(MT7915_RXQ_BAND1);
+- dev->mt76.rx_token_size += MT7915_RX_RING_SIZE;
+ }
+
+ /* rx data queue for band1 */
+diff --git a/mt7915/mmio.c b/mt7915/mmio.c
+index 992beca3..ba728dd0 100644
+--- a/mt7915/mmio.c
++++ b/mt7915/mmio.c
+@@ -603,18 +603,18 @@ static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
+
+ dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
+ for (i = 0; i < dev->mt76.rx_token_size; i++) {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+- t = mt76_rx_token_release(&dev->mt76, i);
+- if (!t || !t->ptr)
++ r = mt76_rx_token_release(&dev->mt76, i);
++ if (!r || !r->ptr)
+ continue;
+
+- dma_unmap_single(dev->mt76.dma_dev, t->dma_addr,
++ dma_unmap_single(dev->mt76.dma_dev, r->dma_addr,
+ wed->wlan.rx_size, DMA_FROM_DEVICE);
+- skb_free_frag(t->ptr);
+- t->ptr = NULL;
++ skb_free_frag(r->ptr);
++ r->ptr = NULL;
+
+- mt76_put_rxwi(&dev->mt76, t);
++ mt76_put_rxwi(&dev->mt76, r);
+ }
+
+ mt76_free_pending_rxwi(&dev->mt76);
+@@ -639,7 +639,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+ sizeof(struct skb_shared_info));
+
+ for (i = 0; i < size; i++) {
+- struct mt76_txwi_cache *t = mt76_get_rxwi(&dev->mt76);
++ struct mt76_rxwi_cache *r = mt76_get_rxwi(&dev->mt76);
+ dma_addr_t phy_addr;
+ int token;
+ void *ptr;
+@@ -658,7 +658,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+ }
+
+ desc->buf0 = cpu_to_le32(phy_addr);
+- token = mt76_rx_token_consume(&dev->mt76, ptr, t, phy_addr);
++ token = mt76_rx_token_consume(&dev->mt76, ptr, r, phy_addr);
+ if (token < 0) {
+ dma_unmap_single(dev->mt76.dma_dev, phy_addr,
+ wed->wlan.rx_size, DMA_TO_DEVICE);
+@@ -786,7 +786,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+ wed->wlan.update_wo_rx_stats = mt7915_mmio_wed_update_rx_stats;
+ wed->wlan.ser_trigger = mt7915_wed_trigger_ser;
+
+- dev->mt76.rx_token_size = wed->wlan.rx_npkt;
++ dev->mt76.rx_token_size += wed->wlan.rx_npkt;
+
+ if (mtk_wed_device_attach(wed))
+ return 0;
+@@ -992,6 +992,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
+ SURVEY_INFO_TIME_RX |
+ SURVEY_INFO_TIME_BSS_RX,
+ .token_size = MT7915_TOKEN_SIZE,
++ .rx_token_size = MT7915_RX_TOKEN_SIZE,
+ .tx_prepare_skb = mt7915_tx_prepare_skb,
+ .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 ed293e70..6def0596 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -65,6 +65,7 @@
+
+ #define MT7915_EEPROM_BLOCK_SIZE 16
+ #define MT7915_TOKEN_SIZE 8192
++#define MT7915_RX_TOKEN_SIZE 4096
+
+ #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 6d55566f..a72b7779 100644
+--- a/tx.c
++++ b/tx.c
+@@ -756,16 +756,16 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi)
+ EXPORT_SYMBOL_GPL(mt76_token_consume);
+
+ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
+- struct mt76_txwi_cache *t, dma_addr_t phys)
++ struct mt76_rxwi_cache *r, dma_addr_t phys)
+ {
+ int token;
+
+ spin_lock_bh(&dev->rx_token_lock);
+- token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size,
++ token = idr_alloc(&dev->rx_token, r, 0, dev->rx_token_size,
+ GFP_ATOMIC);
+ if (token >= 0) {
+- t->ptr = ptr;
+- t->dma_addr = phys;
++ r->ptr = ptr;
++ r->dma_addr = phys;
+ }
+ spin_unlock_bh(&dev->rx_token_lock);
+
+@@ -802,15 +802,15 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
+ }
+ EXPORT_SYMBOL_GPL(mt76_token_release);
+
+-struct mt76_txwi_cache *
++struct mt76_rxwi_cache *
+ mt76_rx_token_release(struct mt76_dev *dev, int token)
+ {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+ spin_lock_bh(&dev->rx_token_lock);
+- t = idr_remove(&dev->rx_token, token);
++ r = idr_remove(&dev->rx_token, token);
+ spin_unlock_bh(&dev->rx_token_lock);
+
+- return t;
++ return r;
+ }
+ EXPORT_SYMBOL_GPL(mt76_rx_token_release);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/4000-mt76-revert-get_of_mac_addr.patch b/recipes-wifi/linux-mt76/files/patches-3.x/4000-mt76-revert-get_of_mac_addr.patch
index 6e61567..c284213 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/4000-mt76-revert-get_of_mac_addr.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/4000-mt76-revert-get_of_mac_addr.patch
@@ -1,4 +1,4 @@
-From e362fcbdcdf2e01840aaa03bf432535c5485463c Mon Sep 17 00:00:00 2001
+From 393196a25088287cd0e7d6b96ccaae65d44cd25e Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 13 Dec 2022 10:51:46 +0800
Subject: [PATCH 4000/4002] mt76: revert get_of_mac_addr
@@ -8,7 +8,7 @@
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/eeprom.c b/eeprom.c
-index 6290156f..306c6412 100644
+index 6290156..306c641 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -126,9 +126,15 @@ void
@@ -29,5 +29,5 @@
if (!is_valid_ether_addr(phy->macaddr)) {
eth_random_addr(phy->macaddr);
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/4001-mt76-include-header-files-for-module-param.patch b/recipes-wifi/linux-mt76/files/patches-3.x/4001-mt76-include-header-files-for-module-param.patch
index 941caaa..02d22be 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/4001-mt76-include-header-files-for-module-param.patch
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/4001-mt76-include-header-files-for-module-param.patch
@@ -1,4 +1,4 @@
-From ee4fac966742080be4cdcfa9fdb258752d90671a Mon Sep 17 00:00:00 2001
+From 651309c679bcab8d573a64c5504aeb6fbdb228fb Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 13 Dec 2022 10:38:13 +0800
Subject: [PATCH 4001/4002] mt76: include header files for module param
@@ -11,7 +11,7 @@
4 files changed, 4 insertions(+)
diff --git a/mcu.c b/mcu.c
-index a8cafa39..fa4b0544 100644
+index a8cafa3..fa4b054 100644
--- a/mcu.c
+++ b/mcu.c
@@ -4,6 +4,7 @@
@@ -23,7 +23,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 83f30305..e917d025 100644
+index 83f3030..e917d02 100644
--- a/mt7615/mcu.c
+++ b/mt7615/mcu.c
@@ -10,6 +10,7 @@
@@ -35,7 +35,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 291a7c12..56493774 100644
+index 291a7c1..5649377 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -4,6 +4,7 @@
@@ -47,7 +47,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 1cdb9d45..69f1a0d4 100644
+index 1cdb9d4..69f1a0d 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -6,6 +6,7 @@
@@ -59,5 +59,5 @@
#define fw_name(_dev, name, ...) ({ \
char *_fw; \
--
-2.25.1
+2.36.1
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 edd01f5..1c27c78 100644
--- a/recipes-wifi/linux-mt76/files/patches-3.x/patches.inc
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/patches.inc
@@ -1,5 +1,9 @@
#patch patches (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
+ file://0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch \
+ file://0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch \
+ file://0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch \
+ file://0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch \
file://1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch \
file://1002-mt76-mt7915-csi-implement-csi-support.patch \
file://1003-mt76-mt7915-air-monitor-support.patch \
@@ -28,8 +32,9 @@
file://1127-mt76-mt7915-add-E3-re-bonding-for-low-yield-rate-iss.patch \
file://1128-mt76-mt7915-support-on-off-SW-ACI-through-debugfs.patch \
file://1129-mt76-mt7915-add-bf-backoff-limit-table-support.patch \
+ file://1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch \
file://3001-mt76-mt7915-wed-add-wed-tx-support.patch \
- file://3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch \
+ file://3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch \
file://3003-mt76-connac-wed-add-wed-rx-copy-skb.patch \
file://3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch \
file://3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch \
@@ -39,6 +44,7 @@
file://3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch \
file://3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch \
file://3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch \
+ file://3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch \
file://4000-mt76-revert-get_of_mac_addr.patch \
file://4001-mt76-include-header-files-for-module-param.patch \
file://4002-mt76-revert-for-backports-5.15-wireless-stack.patch \
diff --git a/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch b/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch
new file mode 100644
index 0000000..c4c2b78
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch
@@ -0,0 +1,52 @@
+From 00cd9ac2311cf4b66ab7c3d6eb3593b52bea1bec Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 2 Dec 2022 10:16:49 +0800
+Subject: [PATCH 1/4] wifi: mt76: mt7915: call
+ mt7915_mcu_set_thermal_throttling() only after init_work
+
+Enable thermal management by default shall not be executed during mcu
+init. This causes thermal configuration being reset to the firmware
+default settings.
+
+Fixes: 0063b86c9120 ("mt76: mt7915e: Enable thermal management by default")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 3 +--
+ mt7915/main.c | 6 ++++++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index 6fd5c63e..a03d0b3b 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -201,8 +201,7 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ phy->throttle_temp[0] = 110;
+ phy->throttle_temp[1] = 120;
+
+- return mt7915_mcu_set_thermal_throttling(phy,
+- MT7915_THERMAL_THROTTLE_MAX);
++ return 0;
+ }
+
+ static void mt7915_led_set_config(struct led_classdev *led_cdev,
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 0511d6a5..98af032e 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -57,6 +57,12 @@ int mt7915_run(struct ieee80211_hw *hw)
+ mt7915_mac_enable_nf(dev, phy->mt76->band_idx);
+ }
+
++ ret = mt7915_mcu_set_thermal_throttling(phy,
++ MT7915_THERMAL_THROTTLE_MAX);
++
++ if (ret)
++ goto out;
++
+ ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b,
+ phy->mt76->band_idx);
+ if (ret)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch b/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch
new file mode 100644
index 0000000..618a14e
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch
@@ -0,0 +1,151 @@
+From 906bad79c7beb43c81a80fdb97898ebb977e527a Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 5 Dec 2022 14:09:18 +0800
+Subject: [PATCH 2/4] wifi: mt76: mt7915: rework
+ mt7915_mcu_set_thermal_throttling
+
+This patch includes 2 changes:
+1. Firmware expects to disable thermal protect first before
+reconfiguring.
+2. Separate setting thermal_protect and setting thermal_tx_duty into
+different functions. These two firmware commands do not need to send
+together.
+
+Fixes: 34b877d972be ("mt76: mt7915: add thermal cooling device support")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 3 ---
+ mt7915/main.c | 5 +++++
+ mt7915/mcu.c | 54 ++++++++++++++++++++++++++++---------------------
+ mt7915/mt7915.h | 1 +
+ 4 files changed, 37 insertions(+), 26 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index a03d0b3b..df3a35d5 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -134,9 +134,6 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev,
+ if (state > MT7915_CDEV_THROTTLE_MAX)
+ return -EINVAL;
+
+- if (phy->throttle_temp[0] > phy->throttle_temp[1])
+- return 0;
+-
+ if (state == phy->cdev_state)
+ return 0;
+
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 98af032e..7589af4b 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -60,6 +60,11 @@ int mt7915_run(struct ieee80211_hw *hw)
+ ret = mt7915_mcu_set_thermal_throttling(phy,
+ MT7915_THERMAL_THROTTLE_MAX);
+
++ if (ret)
++ goto out;
++
++ ret = mt7915_mcu_set_thermal_protect(phy);
++
+ if (ret)
+ goto out;
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 35441dcb..7c14a189 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -3077,6 +3077,29 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy)
+ }
+
+ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state)
++{
++ struct mt7915_dev *dev = phy->dev;
++ struct mt7915_mcu_thermal_ctrl req = {
++ .band_idx = phy->mt76->band_idx,
++ .ctrl_id = THERMAL_PROTECT_DUTY_CONFIG,
++ };
++ int level, ret;
++
++ /* set duty cycle and level */
++ for (level = 0; level < 4; level++) {
++ req.duty.duty_level = level;
++ req.duty.duty_cycle = state;
++ state /= 2;
++
++ ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
++ &req, sizeof(req), false);
++ if (ret)
++ return ret;
++ }
++ return 0;
++}
++
++int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy)
+ {
+ struct mt7915_dev *dev = phy->dev;
+ struct {
+@@ -3089,29 +3112,18 @@ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state)
+ } __packed req = {
+ .ctrl = {
+ .band_idx = phy->mt76->band_idx,
++ .type.protect_type = 1,
++ .type.trigger_type = 1,
+ },
+ };
+- int level;
+-
+- if (!state) {
+- req.ctrl.ctrl_id = THERMAL_PROTECT_DISABLE;
+- goto out;
+- }
+-
+- /* set duty cycle and level */
+- for (level = 0; level < 4; level++) {
+- int ret;
++ int ret;
+
+- req.ctrl.ctrl_id = THERMAL_PROTECT_DUTY_CONFIG;
+- req.ctrl.duty.duty_level = level;
+- req.ctrl.duty.duty_cycle = state;
+- state /= 2;
++ req.ctrl.ctrl_id = THERMAL_PROTECT_DISABLE;
++ ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
++ &req, sizeof(req.ctrl), false);
+
+- ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
+- &req, sizeof(req.ctrl), false);
+- if (ret)
+- return ret;
+- }
++ if (ret)
++ return ret;
+
+ /* set high-temperature trigger threshold */
+ req.ctrl.ctrl_id = THERMAL_PROTECT_ENABLE;
+@@ -3120,10 +3132,6 @@ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state)
+ req.trigger_temp = cpu_to_le32(phy->throttle_temp[1]);
+ req.sustain_time = cpu_to_le16(10);
+
+-out:
+- req.ctrl.type.protect_type = 1;
+- req.ctrl.type.trigger_type = 1;
+-
+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_PROT),
+ &req, sizeof(req), false);
+ }
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 6351feba..855779f8 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -543,6 +543,7 @@ int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy);
+ int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch);
+ int mt7915_mcu_get_temperature(struct mt7915_phy *phy);
+ int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state);
++int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy);
+ 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,
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch b/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch
new file mode 100644
index 0000000..f1c0093
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch
@@ -0,0 +1,73 @@
+From 2cd5969305cc6ba22a1a3ffc45f46758d09bbd1e Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 12 Dec 2022 11:30:37 +0800
+Subject: [PATCH 3/4] wifi: mt76: mt7915: rework mt7915_thermal_temp_store()
+
+Call mt7915_mcu_set_thermal_protect() through
+mt7915_thermal_temp_store() to update firmware trigger/restore temp
+directly.
+
+Fixes: 02ee68b95d81 ("mt76: mt7915: add control knobs for thermal throttling")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 18 ++++++++++++++++--
+ mt7915/mt7915.h | 3 +++
+ 2 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index df3a35d5..98655e4d 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -83,9 +83,23 @@ 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);
++
++ if ((i - 1 == MT7915_CRIT_TEMP_IDX &&
++ val > phy->throttle_temp[MT7915_MAX_TEMP_IDX]) ||
++ (i - 1 == MT7915_MAX_TEMP_IDX &&
++ val < phy->throttle_temp[MT7915_CRIT_TEMP_IDX])) {
++ dev_err(phy->dev->mt76.dev,
++ "temp1_max shall be greater than temp1_crit.");
++ return -EINVAL;
++ }
++
+ phy->throttle_temp[i - 1] = val;
+ mutex_unlock(&phy->dev->mt76.mutex);
+
++ ret = mt7915_mcu_set_thermal_protect(phy);
++ if (ret)
++ return ret;
++
+ return count;
+ }
+
+@@ -195,8 +209,8 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ return PTR_ERR(hwmon);
+
+ /* initialize critical/maximum high temperature */
+- phy->throttle_temp[0] = 110;
+- phy->throttle_temp[1] = 120;
++ phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = 110;
++ phy->throttle_temp[MT7915_MAX_TEMP_IDX] = 120;
+
+ return 0;
+ }
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 855779f8..e58650bb 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -70,6 +70,9 @@
+
+ #define MT7915_WED_RX_TOKEN_SIZE 12288
+
++#define MT7915_CRIT_TEMP_IDX 0
++#define MT7915_MAX_TEMP_IDX 1
++
+ struct mt7915_vif;
+ struct mt7915_sta;
+ struct mt7915_dfs_pulse;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch
new file mode 100644
index 0000000..8f9fa45
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch
@@ -0,0 +1,78 @@
+From 30bd3547690ec1463b34c726577ae821e92a4390 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Mon, 12 Dec 2022 13:18:49 +0800
+Subject: [PATCH 4/4] wifi: mt76: mt7915: add error message in
+ mt7915_thermal_set_cur_throttle_state()
+
+Add dev_err so that it is easier to see invalid setting while looking at
+dmesg.
+
+Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 12 +++++++-----
+ mt7915/mt7915.h | 2 ++
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index 98655e4d..b23a2fb8 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -145,8 +145,11 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev,
+ u8 throttling = MT7915_THERMAL_THROTTLE_MAX - state;
+ int ret;
+
+- if (state > MT7915_CDEV_THROTTLE_MAX)
++ if (state > MT7915_CDEV_THROTTLE_MAX) {
++ dev_err(phy->dev->mt76.dev,
++ "please specify a valid throttling state\n");
+ return -EINVAL;
++ }
+
+ if (state == phy->cdev_state)
+ return 0;
+@@ -175,7 +178,7 @@ static void mt7915_unregister_thermal(struct mt7915_phy *phy)
+ struct wiphy *wiphy = phy->mt76->hw->wiphy;
+
+ if (!phy->cdev)
+- return;
++ return;
+
+ sysfs_remove_link(&wiphy->dev.kobj, "cooling_device");
+ thermal_cooling_device_unregister(phy->cdev);
+@@ -209,8 +212,8 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ return PTR_ERR(hwmon);
+
+ /* initialize critical/maximum high temperature */
+- phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = 110;
+- phy->throttle_temp[MT7915_MAX_TEMP_IDX] = 120;
++ phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = MT7915_CRIT_TEMP;
++ phy->throttle_temp[MT7915_MAX_TEMP_IDX] = MT7915_MAX_TEMP;
+
+ return 0;
+ }
+@@ -1185,7 +1188,6 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev)
+ mt7986_wmac_disable(dev);
+ }
+
+-
+ int mt7915_register_device(struct mt7915_dev *dev)
+ {
+ struct mt7915_phy *phy2;
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index e58650bb..942d70c5 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -72,6 +72,8 @@
+
+ #define MT7915_CRIT_TEMP_IDX 0
+ #define MT7915_MAX_TEMP_IDX 1
++#define MT7915_CRIT_TEMP 110
++#define MT7915_MAX_TEMP 120
+
+ struct mt7915_vif;
+ struct mt7915_sta;
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch b/recipes-wifi/linux-mt76/files/patches/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch
index c9e83a4..18417be 100644
--- a/recipes-wifi/linux-mt76/files/patches/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch
@@ -1,7 +1,7 @@
-From 33d41ea84a29d895fc07019aa5c6f79811e59b14 Mon Sep 17 00:00:00 2001
+From 53904fff8723ca80699e95efeb4b3fe9ededafbd 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 1001/1009] mt76: mt7915: add mtk internal debug tools for mt76
+Subject: [PATCH 1001/1042] mt76: mt7915: add mtk internal debug tools for mt76
---
mt76_connac_mcu.h | 7 +
@@ -22,7 +22,7 @@
create mode 100644 mt7915/mtk_mcu.c
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index f1e942b9..9d0d6130 100644
+index f1e942b..9d0d613 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1146,6 +1146,7 @@ enum {
@@ -47,7 +47,7 @@
MCU_EXT_CMD_CAL_CACHE = 0x67,
MCU_EXT_CMD_SET_RADAR_TH = 0x7c,
diff --git a/mt7915/Makefile b/mt7915/Makefile
-index 797ae498..a42866e9 100644
+index 797ae49..a42866e 100644
--- a/mt7915/Makefile
+++ b/mt7915/Makefile
@@ -3,7 +3,7 @@
@@ -60,7 +60,7 @@
mt7915e-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7915e-$(CONFIG_MT7986_WMAC) += soc.o
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 5a46813a..f1f3f2f3 100644
+index 5a46813..f1f3f2f 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -8,6 +8,9 @@
@@ -204,7 +204,7 @@
if (dev->relay_fwlog)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index f0d5a360..149527df 100644
+index f0d5a36..149527d 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -300,6 +300,10 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb,
@@ -243,7 +243,7 @@
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index 0511d6a5..b44507f4 100644
+index 0511d6a..b44507f 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -62,7 +62,11 @@ int mt7915_run(struct ieee80211_hw *hw)
@@ -259,7 +259,7 @@
goto out;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 35441dcb..56e5ea55 100644
+index 35441dc..56e5ea5 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -199,6 +199,11 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
@@ -351,7 +351,7 @@
+}
+#endif
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 29b5434b..aa89106e 100644
+index 29b5434..aa89106 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -278,6 +278,10 @@ enum {
@@ -366,7 +366,7 @@
enum mcu_mmps_mode {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 6351feba..7c129f7f 100644
+index 6351feb..7c129f7 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -9,6 +9,7 @@
@@ -434,7 +434,7 @@
#endif
diff --git a/mt7915/mt7915_debug.h b/mt7915/mt7915_debug.h
new file mode 100644
-index 00000000..ecdc02ab
+index 0000000..ecdc02a
--- /dev/null
+++ b/mt7915/mt7915_debug.h
@@ -0,0 +1,1350 @@
@@ -1790,7 +1790,7 @@
+#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
new file mode 100644
-index 00000000..747a9014
+index 0000000..747a901
--- /dev/null
+++ b/mt7915/mtk_debugfs.c
@@ -0,0 +1,2925 @@
@@ -4721,7 +4721,7 @@
+#endif
diff --git a/mt7915/mtk_mcu.c b/mt7915/mtk_mcu.c
new file mode 100644
-index 00000000..143dae26
+index 0000000..143dae2
--- /dev/null
+++ b/mt7915/mtk_mcu.c
@@ -0,0 +1,51 @@
@@ -4777,7 +4777,7 @@
+ sizeof(req), true);
+}
diff --git a/tools/fwlog.c b/tools/fwlog.c
-index e5d4a105..3d51d9ec 100644
+index e5d4a10..3d51d9e 100644
--- a/tools/fwlog.c
+++ b/tools/fwlog.c
@@ -26,7 +26,7 @@ static const char *debugfs_path(const char *phyname, const char *file)
@@ -4891,5 +4891,5 @@
return ret;
}
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1002-mt76-mt7915-csi-implement-csi-support.patch b/recipes-wifi/linux-mt76/files/patches/1002-mt76-mt7915-csi-implement-csi-support.patch
index 7bc8f15..ed75241 100644
--- a/recipes-wifi/linux-mt76/files/patches/1002-mt76-mt7915-csi-implement-csi-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1002-mt76-mt7915-csi-implement-csi-support.patch
@@ -1,7 +1,7 @@
-From d5e0407913c33119fd697d626cb3fd87b44f9689 Mon Sep 17 00:00:00 2001
+From 06233088901511040fafaba99f8e6f85faf63557 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 1002/1009] mt76: mt7915: csi: implement csi support
+Subject: [PATCH 1002/1042] mt76: mt7915: csi: implement csi support
---
mt76_connac_mcu.h | 2 +
@@ -17,7 +17,7 @@
create mode 100644 mt7915/vendor.h
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 9d0d6130..26e7cf6f 100644
+index 9d0d613..26e7cf6 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -998,6 +998,7 @@ enum {
@@ -37,7 +37,7 @@
enum {
diff --git a/mt7915/Makefile b/mt7915/Makefile
-index a42866e9..14ce98a6 100644
+index a42866e..14ce98a 100644
--- a/mt7915/Makefile
+++ b/mt7915/Makefile
@@ -1,9 +1,9 @@
@@ -53,7 +53,7 @@
mt7915e-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7915e-$(CONFIG_MT7986_WMAC) += soc.o
diff --git a/mt7915/init.c b/mt7915/init.c
-index 6fd5c63e..79080aee 100644
+index 6fd5c63..79080ae 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -645,6 +645,12 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
@@ -131,7 +131,7 @@
ARRAY_SIZE(mt76_rates));
if (ret)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 56e5ea55..f483d443 100644
+index 56e5ea5..f483d44 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -36,6 +36,10 @@ static bool sr_scene_detect = true;
@@ -267,7 +267,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 aa89106e..f3dedd5b 100644
+index aa89106..f3dedd5 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -532,4 +532,80 @@ mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
@@ -352,7 +352,7 @@
+
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 7c129f7f..8bb6d091 100644
+index 7c129f7..8bb6d09 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -288,6 +288,20 @@ struct mt7915_phy {
@@ -391,7 +391,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 00000000..98fd9c2d
+index 0000000..98fd9c2
--- /dev/null
+++ b/mt7915/vendor.c
@@ -0,0 +1,452 @@
@@ -849,7 +849,7 @@
+}
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
new file mode 100644
-index 00000000..9d3db2a7
+index 0000000..9d3db2a
--- /dev/null
+++ b/mt7915/vendor.h
@@ -0,0 +1,60 @@
@@ -914,5 +914,5 @@
+
+#endif
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1003-mt76-mt7915-air-monitor-support.patch b/recipes-wifi/linux-mt76/files/patches/1003-mt76-mt7915-air-monitor-support.patch
index 1078874..95ba41a 100644
--- a/recipes-wifi/linux-mt76/files/patches/1003-mt76-mt7915-air-monitor-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1003-mt76-mt7915-air-monitor-support.patch
@@ -1,7 +1,7 @@
-From 0a7547997d9a2f44574b4562b9b77dfda62cc342 Mon Sep 17 00:00:00 2001
+From 348d91e6cd920a4728d71711e9279596837b4a85 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 1003/1009] mt76: mt7915: air monitor support
+Subject: [PATCH 1003/1042] mt76: mt7915: air monitor support
---
mt76_connac_mcu.h | 2 +
@@ -13,7 +13,7 @@
6 files changed, 440 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 26e7cf6f..841fcdec 100644
+index 26e7cf6..841fcde 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1192,6 +1192,8 @@ enum {
@@ -26,7 +26,7 @@
};
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 149527df..015f2705 100644
+index 149527d..015f270 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -548,6 +548,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 b44507f4..33db7202 100644
+index b44507f..33db720 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -691,6 +691,9 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -55,7 +55,7 @@
}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 8bb6d091..33ca8e8c 100644
+index 8bb6d09..33ca8e8 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -244,6 +244,35 @@ struct mt7915_hif {
@@ -114,7 +114,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 98fd9c2d..b94d787e 100644
+index 98fd9c2..b94d787 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -430,6 +430,353 @@ out:
@@ -491,7 +491,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 9d3db2a7..976817f3 100644
+index 9d3db2a..976817f 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -4,6 +4,7 @@
@@ -545,5 +545,5 @@
+
#endif
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch b/recipes-wifi/linux-mt76/files/patches/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch
index 242cfec..3c804e0 100644
--- a/recipes-wifi/linux-mt76/files/patches/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1004-mt76-mt7915-add-support-for-muru_onoff-via-debugfs.patch
@@ -1,7 +1,7 @@
-From 9252e4a6fbacaef7a3310d7d6773a6ad903e07c2 Mon Sep 17 00:00:00 2001
+From fb6b74ae5596a63325eaa024cf2ca4abdc9ba67e Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 22 Jun 2022 10:45:53 +0800
-Subject: [PATCH 1004/1009] mt76: mt7915: add support for muru_onoff via
+Subject: [PATCH 1004/1042] mt76: mt7915: add support for muru_onoff via
debugfs
---
@@ -12,7 +12,7 @@
4 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 79080aee..172bdcf2 100644
+index 79080ae..172bdcf 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -680,6 +680,7 @@ static void mt7915_init_work(struct work_struct *work)
@@ -24,7 +24,7 @@
void mt7915_wfsys_reset(struct mt7915_dev *dev)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index f483d443..e0e25a91 100644
+index f483d44..e0e25a9 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -876,13 +876,18 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
@@ -50,7 +50,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 f3dedd5b..b6840b22 100644
+index f3dedd5..b6840b2 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -608,4 +608,10 @@ struct csi_data {
@@ -65,7 +65,7 @@
+
#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 747a9014..176937ad 100644
+index 747a901..176937a 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2480,6 +2480,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data)
@@ -116,5 +116,5 @@
&fops_fw_debug_module);
debugfs_create_file("fw_debug_level", 0600, dir, dev,
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1005-mt76-mt7915-certification-patches.patch b/recipes-wifi/linux-mt76/files/patches/1005-mt76-mt7915-certification-patches.patch
index 823536c..636f0a6 100644
--- a/recipes-wifi/linux-mt76/files/patches/1005-mt76-mt7915-certification-patches.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1005-mt76-mt7915-certification-patches.patch
@@ -1,7 +1,7 @@
-From ce4f3cb268d50b49fbde125fc00b8bcac938f45d Mon Sep 17 00:00:00 2001
+From 0e5f3fbc65dd09924683c8c5e6ba62f60cbd2843 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 1005/1009] mt76: mt7915: certification patches
+Subject: [PATCH 1005/1042] mt76: mt7915: certification patches
---
mt76_connac_mcu.h | 1 +
@@ -16,7 +16,7 @@
9 files changed, 956 insertions(+), 5 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 841fcdec..18ae3acb 100644
+index 841fcde..18ae3ac 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1194,6 +1194,7 @@ enum {
@@ -28,7 +28,7 @@
};
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 015f2705..229e68c3 100644
+index 015f270..229e68c 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 33db7202..3d309bc0 100644
+index 33db720..3d309bc 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -667,6 +667,9 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
@@ -109,7 +109,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 e0e25a91..4e36910c 100644
+index e0e25a9..4e36910 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3881,6 +3881,472 @@ mt7915_mcu_report_csi(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -586,7 +586,7 @@
#ifdef MTK_DEBUG
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b6840b22..d7322fe8 100644
+index b6840b2..d7322fe 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -415,10 +415,14 @@ enum {
@@ -820,7 +820,7 @@
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 33ca8e8c..415fe82a 100644
+index 33ca8e8..415fe82 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -714,6 +714,19 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -844,7 +844,7 @@
int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
u8 cfg, u8 v1, u32 v2, u8 *mac_addr);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 176937ad..e24b4d78 100644
+index 176937a..e24b4d7 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2486,7 +2486,8 @@ static int mt7915_muru_onoff_get(void *data, u64 *val)
@@ -869,7 +869,7 @@
}
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index b94d787e..7456c577 100644
+index b94d787..7456c57 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -22,6 +22,29 @@ csi_ctrl_policy[NUM_MTK_VENDOR_ATTRS_CSI_CTRL] = {
@@ -1081,7 +1081,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 976817f3..1b08321c 100644
+index 976817f..1b08321 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -6,6 +6,48 @@
@@ -1134,5 +1134,5 @@
enum mtk_vendor_attr_csi_ctrl {
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch b/recipes-wifi/linux-mt76/files/patches/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch
index 407133d..23681ef 100644
--- a/recipes-wifi/linux-mt76/files/patches/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1006-mt76-mt7915-add-support-for-runtime-set-in-band-disc.patch
@@ -1,7 +1,7 @@
-From 3443cd5ba3c9678a1bb644cdcf40d3554abfbfb3 Mon Sep 17 00:00:00 2001
+From 9427ac3e09d513858340177b70927f17cacd709c Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Fri, 27 May 2022 15:51:48 +0800
-Subject: [PATCH 1006/1009] mt76: mt7915:add support for runtime set in-band
+Subject: [PATCH 1006/1042] mt76: mt7915:add support for runtime set in-band
discovery
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4e36910c..47dee76e 100644
+index 4e36910..47dee76 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1993,8 +1993,7 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
@@ -33,5 +33,5 @@
buf = (u8 *)tlv + sizeof(*discov);
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch b/recipes-wifi/linux-mt76/files/patches/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
index 2e6b0f5..0d0a199 100644
--- a/recipes-wifi/linux-mt76/files/patches/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1007-mt76-mt7915-add-mt76-vendor-muru-onoff-command.patch
@@ -1,7 +1,7 @@
-From 82128a5100d8760dcb5a0b66011345a279ca55fb Mon Sep 17 00:00:00 2001
+From 19680b3e37b2fbee253100ff02f6aabf9c8025f6 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 22 Jun 2022 10:53:43 +0800
-Subject: [PATCH 1007/1009] mt76: mt7915: add mt76 vendor muru onoff command
+Subject: [PATCH 1007/1042] mt76: mt7915: add mt76 vendor muru onoff command
---
mt7915/mcu.c | 7 +++++++
@@ -11,7 +11,7 @@
4 files changed, 63 insertions(+)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 47dee76e..ec306f01 100644
+index 47dee76..ec306f0 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3900,6 +3900,13 @@ void mt7915_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -29,7 +29,7 @@
}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index d7322fe8..eaadd331 100644
+index d7322fe..eaadd33 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -422,6 +422,7 @@ enum {
@@ -41,7 +41,7 @@
};
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7456c577..c7551848 100644
+index 7456c57..c755184 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -34,6 +34,11 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
@@ -109,7 +109,7 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 1b08321c..a8e4ebf9 100644
+index 1b08321..a8e4ebf 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -8,6 +8,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -139,5 +139,5 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1008-mt76-mt7915-drop-undefined-action-frame.patch b/recipes-wifi/linux-mt76/files/patches/1008-mt76-mt7915-drop-undefined-action-frame.patch
index 3538edb..0f987a7 100644
--- a/recipes-wifi/linux-mt76/files/patches/1008-mt76-mt7915-drop-undefined-action-frame.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1008-mt76-mt7915-drop-undefined-action-frame.patch
@@ -1,14 +1,14 @@
-From 0d3ed509726d42b595448135272a18e72d32ea85 Mon Sep 17 00:00:00 2001
+From fbc8ac0d6765825b5db2917b094c8327a547f1f6 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 1008/1009] mt76: mt7915: drop undefined action frame
+Subject: [PATCH 1008/1042] 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 229e68c3..fc7b7903 100644
+index 229e68c..fc7b790 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -761,6 +761,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -32,5 +32,5 @@
if (id < 0)
return id;
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1009-mt76-mt7915-add-fw_version-dump.patch b/recipes-wifi/linux-mt76/files/patches/1009-mt76-mt7915-add-fw_version-dump.patch
index c0a81f3..d17456e 100644
--- a/recipes-wifi/linux-mt76/files/patches/1009-mt76-mt7915-add-fw_version-dump.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1009-mt76-mt7915-add-fw_version-dump.patch
@@ -1,7 +1,7 @@
-From 2c612e7daf9f26ee8f1a77bb5d52858ae033923e Mon Sep 17 00:00:00 2001
+From 52bdf313f5aa51dc7617fd32ca35267fd6b1a8f6 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 17 Aug 2022 13:40:24 +0800
-Subject: [PATCH 1009/1009] mt76: mt7915: add fw_version dump
+Subject: [PATCH 1009/1042] mt76: mt7915: add fw_version dump
---
mt76.h | 4 ++++
@@ -10,7 +10,7 @@
3 files changed, 32 insertions(+)
diff --git a/mt76.h b/mt76.h
-index 1037d23b..beea57d5 100644
+index 1037d23..beea57d 100644
--- a/mt76.h
+++ b/mt76.h
@@ -837,6 +837,10 @@ struct mt76_dev {
@@ -25,7 +25,7 @@
struct mt76_power_limits {
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 5a047e63..cf6ec55f 100644
+index 5a047e6..cf6ec55 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -2968,6 +2968,9 @@ int mt76_connac2_load_ram(struct mt76_dev *dev, const char *fw_wm,
@@ -59,7 +59,7 @@
struct mt76_connac2_patch_sec *sec;
u32 len, addr, mode;
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index e24b4d78..d96f222a 100644
+index e24b4d7..766b278 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2721,6 +2721,22 @@ static int mt7915_agginfo_read_band1(struct seq_file *s, void *data)
@@ -70,7 +70,7 @@
+{
+ struct mt7915_dev *dev = dev_get_drvdata(s->private);
+ struct mt76_dev *mdev = NULL;
-+ seq_printf(s, "Version: 2.2.7.0\n");
++ seq_printf(s, "Version: 2.2.8.0\n");
+
+ if (!test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
+ return 0;
@@ -96,5 +96,5 @@
}
#endif
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch b/recipes-wifi/linux-mt76/files/patches/1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch
new file mode 100644
index 0000000..a10e878
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch
@@ -0,0 +1,143 @@
+From 0656e6d8dbeec9f83a1f20a0013112b814a0c4f0 Mon Sep 17 00:00:00 2001
+From: TomLiu <tomml.liu@mediatek.com>
+Date: Wed, 14 Dec 2022 00:44:07 -0800
+Subject: [PATCH] [mt76]amsdu set and get control
+
+---
+ mt7915/mac.c | 10 ++++++++++
+ mt7915/mt7915.h | 1 +
+ mt7915/vendor.c | 31 +++++++++++++++++++++++++++++++
+ mt7915/vendor.h | 12 ++++++++++++
+ 4 files changed, 54 insertions(+)
+
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index 3bbe757..0ef0fab 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -2072,6 +2072,16 @@ static void mt7915_mac_severe_check(struct mt7915_phy *phy)
+ phy->trb_ts = trb;
+ }
+
++void mt7915_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en) {
++ struct mt76_phy *mphy = hw->priv;
++ struct mt76_dev *mdev = mphy->dev;
++
++ if (en)
++ ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
++ else
++ ieee80211_hw_clear(hw, SUPPORTS_AMSDU_IN_AMPDU);
++}
++
+ #ifdef CONFIG_MTK_VENDOR
+ void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta)
+ {
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 0fb1de3..8ee553a 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -820,6 +820,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+ bool pci, int *irq);
+
+ #ifdef CONFIG_MTK_VENDOR
++void mt7915_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en);
+ void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta);
+ 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 22af66d..a1f526c 100644
+--- a/mt7915/vendor.c
++++ b/mt7915/vendor.c
+@@ -30,10 +30,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 },
++ [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 },
+ };
+
++static const struct nla_policy
++wireless_dump_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP] = {
++ [MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU] = { .type = NLA_U8 },
++};
++
+ static const struct nla_policy
+ hemu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_HEMU_CTRL] = {
+ [MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF] = {.type = NLA_U8 },
+@@ -983,11 +989,35 @@ 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 */
++ } 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);
+ }
+
+ return 0;
+ }
+
++static int
++mt7915_vendor_wireless_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
++ struct sk_buff *skb, const void *data, int data_len,
++ unsigned long *storage)
++{
++ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++ struct mt7915_phy *phy = mt7915_hw_phy(hw);
++ struct mt7915_dev *dev = phy->dev;
++ int len = 0;
++ if (*storage == 1)
++ return -ENOENT;
++ *storage = 1;
++
++ if (nla_put_u8(skb,
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, ieee80211_hw_check(hw, SUPPORTS_AMSDU_IN_AMPDU)))
++ return -ENOMEM;
++ len += 2;
++
++ return len;
++}
++
+ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data,
+@@ -1287,6 +1317,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,
++ .dumpit = mt7915_vendor_wireless_ctrl_dump,
+ .policy = wireless_ctrl_policy,
+ .maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX,
+ },
+diff --git a/mt7915/vendor.h b/mt7915/vendor.h
+index 949c885..cbff910 100644
+--- a/mt7915/vendor.h
++++ b/mt7915/vendor.h
+@@ -74,6 +74,7 @@ enum mtk_vendor_attr_wireless_ctrl {
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO,
++ MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT = 9,
+
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA, /* reserve */
+@@ -83,6 +84,17 @@ enum mtk_vendor_attr_wireless_ctrl {
+ NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1
+ };
+
++enum mtk_vendor_attr_wireless_dump {
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_UNSPEC,
++
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP,
++ MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX =
++ NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP - 1
++};
++
+ enum mtk_vendor_attr_hemu_ctrl {
+ MTK_VENDOR_ATTR_HEMU_CTRL_UNSPEC,
+
+--
+2.32.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/3001-mt76-mt7915-wed-add-wed-tx-support.patch b/recipes-wifi/linux-mt76/files/patches/3001-mt76-mt7915-wed-add-wed-tx-support.patch
old mode 100644
new mode 100755
index 3086d77..74bc9e6
--- a/recipes-wifi/linux-mt76/files/patches/3001-mt76-mt7915-wed-add-wed-tx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3001-mt76-mt7915-wed-add-wed-tx-support.patch
@@ -1,7 +1,7 @@
From aa48497ccb0236e8724d8434be06055e31297e93 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 3001/3011] mt76: mt7915: wed: add wed tx support
+Subject: [PATCH 3001/3012] mt76: mt7915: wed: add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
diff --git a/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch b/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch
new file mode 100755
index 0000000..b3442f4
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch
@@ -0,0 +1,207 @@
+From 2d158600e7c9b18069111d5935e9dbaf8c9277f3 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 3002/3012] mt76: mt7915: wed: add wds support when wed is
+ enabled
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ mt76.h | 6 ++++++
+ mt7915/main.c | 22 ++++++++++++++++++++--
+ mt7915/mcu.c | 13 +++++++++++--
+ mt7915/mcu.h | 1 +
+ util.c | 40 +++++++++++++++++++++++++++++++++++++---
+ util.h | 7 ++++++-
+ 6 files changed, 81 insertions(+), 8 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index 01baceaf..7b222e73 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -60,6 +60,12 @@ enum mt76_wed_type {
+ MT76_WED_Q_RX,
+ };
+
++enum mt76_wed_state {
++ MT76_WED_DEFAULT,
++ MT76_WED_ACTIVE,
++ MT76_WED_WDS_ACTIVE,
++};
++
+ struct mt76_bus_ops {
+ 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 370bfad7..75c78b8e 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -675,8 +675,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ #endif
+ int ret, idx;
+ u32 addr;
++ u8 flags = MT76_WED_DEFAULT;
+
+- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ !is_mt7915(&dev->mt76)) {
++ flags = test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ?
++ MT76_WED_WDS_ACTIVE : MT76_WED_ACTIVE;
++ }
++
++ idx = __mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA, flags);
+ if (idx < 0)
+ return -ENOSPC;
+
+@@ -1148,6 +1155,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
+ else
+ clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
+
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ !is_mt7915(&dev->mt76)) {
++ mt7915_sta_remove(hw, vif, sta);
++ mt76_sta_pre_rcu_remove(hw, vif, sta);
++ mt7915_sta_add(hw, vif, sta);
++ }
++
+ mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
+ }
+
+@@ -1519,8 +1533,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;
+- path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
+ path->mtk_wdma.queue = phy != &dev->phy;
++ if (test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ||
++ is_mt7915(&dev->mt76))
++ path->mtk_wdma.wcid = msta->wcid.idx;
++ else
++ path->mtk_wdma.wcid = 0x3ff;
+
+ ctx->dev = NULL;
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 4b7ad450..bdfb71e2 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -2350,8 +2350,17 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+ if (ret)
+ return ret;
+
+- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
+- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ if (is_mt7915(&dev->mt76))
++ ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
++ 0, 0, 0);
++ else
++ ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
++ MCU_WA_PARAM_WED_VERSION,
++ dev->mt76.mmio.wed.rev_id, 0);
++ if (ret)
++ return ret;
++ }
+
+ ret = mt7915_mcu_set_mwds(dev, 1);
+ if (ret)
+diff --git a/mt7915/mcu.h b/mt7915/mcu.h
+index d110e210..edb8b510 100644
+--- a/mt7915/mcu.h
++++ b/mt7915/mcu.h
+@@ -284,6 +284,7 @@ enum {
+ MCU_WA_PARAM_PDMA_RX = 0x04,
+ MCU_WA_PARAM_CPU_UTIL = 0x0b,
+ MCU_WA_PARAM_RED = 0x0e,
++ MCU_WA_PARAM_WED_VERSION = 0x32,
+ #ifdef MTK_DEBUG
+ MCU_WA_PARAM_RED_SHOW_STA = 0xf,
+ MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
+diff --git a/util.c b/util.c
+index 58196442..5cd5ede0 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,
+ }
+ EXPORT_SYMBOL_GPL(__mt76_poll_msec);
+
+-int mt76_wcid_alloc(u32 *mask, int size)
++int __mt76_wcid_alloc(u32 *mask, int size, u8 flag)
+ {
++#define MT76_WED_WDS_MIN 256
++#define MT76_WED_WDS_CNT 16
++
+ int i, idx = 0, cur;
++ int min = MT76_WED_WDS_MIN;
++ int max = min + MT76_WED_WDS_CNT;
+
+ for (i = 0; i < DIV_ROUND_UP(size, 32); i++) {
+ idx = ffs(~mask[i]);
+@@ -53,16 +58,45 @@ int mt76_wcid_alloc(u32 *mask, int size)
+
+ idx--;
+ cur = i * 32 + idx;
+- if (cur >= size)
++
++ switch (flag) {
++ case MT76_WED_ACTIVE:
++ if (cur >= min && cur < max)
++ continue;
++
++ if (cur >= size) {
++ u32 end = MT76_WED_WDS_CNT - 1;
++
++ i = min / 32;
++ idx = ffs(~mask[i] & GENMASK(end, 0));
++ if (!idx)
++ goto error;
++ idx--;
++ cur = min + idx;
++ }
++
+ break;
++ case MT76_WED_WDS_ACTIVE:
++ if (cur < min)
++ continue;
++ if (cur >= max)
++ goto error;
++
++ break;
++ default:
++ if (cur >= size)
++ goto error;
++ break;
++ }
+
+ mask[i] |= BIT(idx);
+ return cur;
+ }
+
++error:
+ return -1;
+ }
+-EXPORT_SYMBOL_GPL(mt76_wcid_alloc);
++EXPORT_SYMBOL_GPL(__mt76_wcid_alloc);
+
+ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy)
+ {
+diff --git a/util.h b/util.h
+index 260965dd..99b7263c 100644
+--- a/util.h
++++ b/util.h
+@@ -27,7 +27,12 @@ enum {
+ #define MT76_INCR(_var, _size) \
+ (_var = (((_var) + 1) % (_size)))
+
+-int mt76_wcid_alloc(u32 *mask, int size);
++int __mt76_wcid_alloc(u32 *mask, int size, u8 flags);
++
++static inline int mt76_wcid_alloc(u32 *mask, int size)
++{
++ return __mt76_wcid_alloc(mask, size, 0);
++}
+
+ static inline void
+ mt76_wcid_mask_set(u32 *mask, int idx)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch b/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch
deleted file mode 100644
index 829a48a..0000000
--- a/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch
+++ /dev/null
@@ -1,230 +0,0 @@
-From 8c5f91270dc8d3a1b8d36a00130bbe0450dbfe61 Mon Sep 17 00:00:00 2001
-From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Sat, 10 Sep 2022 17:09:21 +0800
-Subject: [PATCH 3002/3011] mt76: mt7915: wed: add-wed-tx-wds-support-on-mt7986
-
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
----
- mac80211.c | 5 ++++-
- mt76.h | 2 ++
- mt7915/init.c | 9 +++++++++
- mt7915/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
- mt7915/mcu.c | 12 ++++++++++--
- mt7915/mcu.h | 1 +
- mt7915/mmio.c | 1 +
- mt7915/mt7915.h | 4 ++++
- 8 files changed, 74 insertions(+), 5 deletions(-)
-
-diff --git a/mac80211.c b/mac80211.c
-index de9ef237..15d300a9 100644
---- a/mac80211.c
-+++ b/mac80211.c
-@@ -1385,7 +1385,10 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif,
-
- mt76_packet_id_flush(dev, wcid);
-
-- mt76_wcid_mask_clear(dev->wcid_mask, idx);
-+ if (dev->drv->wed_wds_check && dev->drv->wed_wds_check(dev, sta))
-+ mt76_wcid_mask_clear(dev->wcid_wds_mask, idx);
-+ else
-+ mt76_wcid_mask_clear(dev->wcid_mask, idx);
- mt76_wcid_mask_clear(dev->wcid_phy_mask, idx);
- }
- EXPORT_SYMBOL_GPL(__mt76_sta_remove);
-diff --git a/mt76.h b/mt76.h
-index 01baceaf..fb8c15eb 100644
---- a/mt76.h
-+++ b/mt76.h
-@@ -465,6 +465,7 @@ struct mt76_driver_ops {
-
- void (*sta_remove)(struct mt76_dev *dev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
-+ bool (*wed_wds_check)(struct mt76_dev *dev, struct ieee80211_sta *sta);
- };
-
- struct mt76_channel_state {
-@@ -849,6 +850,7 @@ struct mt76_dev {
- spinlock_t status_lock;
-
- u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
-+ u32 wcid_wds_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
- u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
-
- u64 vif_mask;
-diff --git a/mt7915/init.c b/mt7915/init.c
-index 3f0a9d93..1ed519be 100644
---- a/mt7915/init.c
-+++ b/mt7915/init.c
-@@ -793,6 +793,15 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
- return ret;
- }
-
-+ /* wds workaround for mt7986 */
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7986(&dev->mt76)) {
-+ for(idx = MT7915_WTBL_WDS_START; idx < MT7915_WTBL_WDS_END; idx++)
-+ mt76_wcid_mask_set(dev->mt76.wcid_mask, idx);
-+
-+ for (idx = 0; idx < DIV_ROUND_UP(MT7915_WTBL_STA, 32); idx++)
-+ dev->mt76.wcid_wds_mask[idx] = ~dev->mt76.wcid_mask[idx];
-+ }
-+
- /* Beacon and mgmt frames should occupy wcid 0 */
- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
- if (idx)
-diff --git a/mt7915/main.c b/mt7915/main.c
-index 370bfad7..0e08bde6 100644
---- a/mt7915/main.c
-+++ b/mt7915/main.c
-@@ -663,6 +663,24 @@ mt7915_channel_switch_beacon(struct ieee80211_hw *hw,
- mutex_unlock(&dev->mt76.mutex);
- }
-
-+bool
-+mt7915_wed_wds_check(struct mt76_dev *mdev, struct ieee80211_sta *sta)
-+{
-+ struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
-+
-+ if (!mtk_wed_device_active(&mdev->mmio.wed))
-+ return false;
-+
-+ if(!is_mt7986(mdev))
-+ return false;
-+
-+ if((msta->wcid.idx < MT7915_WTBL_WDS_START ||
-+ msta->wcid.idx > MT7915_WTBL_WDS_END))
-+ return false;
-+
-+ return true;
-+}
-+
- int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
- {
-@@ -675,8 +693,18 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- #endif
- int ret, idx;
- u32 addr;
-+ bool wed_wds = false;
-+
-+ if (mtk_wed_device_active(&mdev->mmio.wed) && is_mt7986(mdev))
-+ wed_wds = !!test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
-
-- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
-+ if (wed_wds)
-+ idx = mt76_wcid_alloc(mdev->wcid_wds_mask, MT7915_WTBL_STA);
-+ else {
-+ idx = mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA);
-+ if (idx < 0)
-+ idx = mt76_wcid_alloc(mdev->wcid_wds_mask, MT7915_WTBL_STA);
-+ }
- if (idx < 0)
- return -ENOSPC;
-
-@@ -1148,6 +1176,15 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
- else
- clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
-
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
-+ is_mt7986(&dev->mt76) &&
-+ (msta->wcid.idx < MT7915_WTBL_WDS_START ||
-+ msta->wcid.idx > MT7915_WTBL_WDS_END)) {
-+ mt7915_sta_remove(hw, vif, sta);
-+ mt76_sta_pre_rcu_remove(hw, vif, sta);
-+ mt7915_sta_add(hw, vif, sta);
-+ }
-+
- mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
- }
-
-@@ -1519,7 +1556,11 @@ 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;
-- path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
-+
-+ if (test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags))
-+ path->mtk_wdma.wcid = msta->wcid.idx;
-+ else
-+ path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
- path->mtk_wdma.queue = phy != &dev->phy;
-
- ctx->dev = NULL;
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4b7ad450..3b16a7fb 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -2321,6 +2321,7 @@ mt7915_mcu_init_rx_airtime(struct mt7915_dev *dev)
- int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
- {
- int ret;
-+ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
-
- /* force firmware operation mode into normal state,
- * which should be set before firmware download stage.
-@@ -2350,8 +2351,15 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
- if (ret)
- return ret;
-
-- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
-- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
-+ if (mtk_wed_device_active(wed)) {
-+ if (is_mt7915(&dev->mt76))
-+ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
-+ 0, 0, 0);
-+ else
-+ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
-+ MCU_WA_PARAM_WED_VERSION,
-+ wed->rev_id, 0);
-+ }
-
- ret = mt7915_mcu_set_mwds(dev, 1);
- if (ret)
-diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index d110e210..b30cc820 100644
---- a/mt7915/mcu.h
-+++ b/mt7915/mcu.h
-@@ -288,6 +288,7 @@ enum {
- MCU_WA_PARAM_RED_SHOW_STA = 0xf,
- MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
- #endif
-+ MCU_WA_PARAM_WED_VERSION = 0x32,
- };
-
- enum mcu_mmps_mode {
-diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index ac574722..ffe23406 100644
---- a/mt7915/mmio.c
-+++ b/mt7915/mmio.c
-@@ -998,6 +998,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
- .sta_add = mt7915_mac_sta_add,
- .sta_remove = mt7915_mac_sta_remove,
- .update_survey = mt7915_update_channel,
-+ .wed_wds_check = mt7915_wed_wds_check,
- };
- struct mt7915_dev *dev;
- struct mt76_dev *mdev;
-diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 2e6519e7..836d485f 100644
---- a/mt7915/mt7915.h
-+++ b/mt7915/mt7915.h
-@@ -18,6 +18,9 @@
- #define MT7915_WTBL_STA (MT7915_WTBL_RESERVED - \
- MT7915_MAX_INTERFACES)
-
-+#define MT7915_WTBL_WDS_START 256
-+#define MT7915_WTBL_WDS_END 271
-+
- #define MT7915_WATCHDOG_TIME (HZ / 10)
- #define MT7915_RESET_TIMEOUT (30 * HZ)
-
-@@ -726,6 +729,7 @@ void mt7915_tx_token_put(struct mt7915_dev *dev);
- void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- struct sk_buff *skb, u32 *info);
- bool mt7915_rx_check(struct mt76_dev *mdev, void *data, int len);
-+bool mt7915_wed_wds_check(struct mt76_dev *mdev, struct ieee80211_sta *sta);
- void mt7915_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
- void mt7915_stats_work(struct work_struct *work);
- int mt76_dfs_start_rdd(struct mt7915_dev *dev, bool force);
---
-2.25.1
-
diff --git a/recipes-wifi/linux-mt76/files/patches/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch b/recipes-wifi/linux-mt76/files/patches/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch
old mode 100644
new mode 100755
index ee14206..0185209
--- a/recipes-wifi/linux-mt76/files/patches/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3003-mt76-connac-wed-add-wed-rx-copy-skb.patch
@@ -1,7 +1,7 @@
From ca14459b70818a138fa83ec38bfc91bce44b645c Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 12:05:06 +0800
-Subject: [PATCH 3003/3011] mt76: connac: wed: add wed rx copy skb
+Subject: [PATCH 3003/3012] mt76: connac: wed: add wed rx copy skb
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
diff --git a/recipes-wifi/linux-mt76/files/patches/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch b/recipes-wifi/linux-mt76/files/patches/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch
old mode 100644
new mode 100755
index 0835b2c..0dc64bc
--- a/recipes-wifi/linux-mt76/files/patches/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch
@@ -1,7 +1,7 @@
From 9c13748447e65404ad43c95b11479b71557851d8 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Thu, 19 May 2022 13:44:42 +0800
-Subject: [PATCH 3004/3011] mt76: mt7915: wed: add fill receive path to report
+Subject: [PATCH 3004/3012] mt76: mt7915: wed: add fill receive path to report
wed idx
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
@@ -13,7 +13,7 @@
index 0e08bde6..d8571642 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1567,6 +1567,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1544,6 +1544,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
return 0;
}
@@ -38,7 +38,7 @@
#endif
const struct ieee80211_ops mt7915_ops = {
-@@ -1619,5 +1637,6 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1596,5 +1614,6 @@ 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/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch b/recipes-wifi/linux-mt76/files/patches/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch
old mode 100644
new mode 100755
index 895588a..3222bb1
--- a/recipes-wifi/linux-mt76/files/patches/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch
@@ -1,7 +1,7 @@
-From e199b3a9a4dcf01c00fd367e7dea297b0c0e308b Mon Sep 17 00:00:00 2001
+From 5a4e0813aaaf66a658c9907b7834cb61e10ae682 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 14:07:46 +0800
-Subject: [PATCH 3005/3011] mt76: mt7915: wed: add ser support when wed on
+Subject: [PATCH 3005/3012] mt76: mt7915: wed: add ser support when wed on
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
@@ -120,10 +120,10 @@
#endif
diff --git a/mt76.h b/mt76.h
-index fb8c15eb..b107516d 100644
+index 7b222e73..75975cb5 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -1391,6 +1391,7 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+@@ -1395,6 +1395,7 @@ 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);
void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
@@ -247,7 +247,7 @@
if (ext_phy)
ieee80211_stop_queues(ext_phy->hw);
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index ffe23406..6fb3419d 100644
+index ac574722..ecc38e05 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -617,6 +617,8 @@ static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
@@ -268,10 +268,10 @@
dev->mt76.rx_token_size = wed->wlan.rx_npkt;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 836d485f..8ea75fb9 100644
+index 2e6519e7..f9c02912 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -562,6 +562,7 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
+@@ -559,6 +559,7 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
diff --git a/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch b/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch
old mode 100644
new mode 100755
index ed5376a..58d589d
--- a/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-wed-enable-red-per-band-token-drop-for-H.patch
@@ -1,7 +1,7 @@
-From 07b444485d3b25b459d5e2a9a9b84ccb0613a1db Mon Sep 17 00:00:00 2001
+From 2c9f6ad4b961b736f60003d50b3e145c7b33a79d Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 2 Sep 2022 14:40:40 +0800
-Subject: [PATCH 3006/3011] mt76: mt7915: wed: enable red per-band token drop
+Subject: [PATCH 3006/3012] mt76: mt7915: wed: enable red per-band token drop
for HW Path
Limit the number of token used by each band. If a band uses too many token,
@@ -10,30 +10,34 @@
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
- mt7915/mcu.c | 53 +++++++++++++++++++++++++++++++++++++++----------
+ mt7915/mcu.c | 57 ++++++++++++++++++++++++++++++++++++++++---------
mt7915/mcu.h | 1 +
mt7915/mt7915.h | 3 ++-
- 3 files changed, 46 insertions(+), 11 deletions(-)
+ 3 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 3b16a7fb..2cfd5f4a 100644
+index bdfb71e2..daa0006b 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -2359,8 +2359,13 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
- MCU_WA_PARAM_WED_VERSION,
- wed->rev_id, 0);
+@@ -2360,8 +2360,17 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+ dev->mt76.mmio.wed.rev_id, 0);
+ if (ret)
+ return ret;
+
-+ mt7915_mcu_set_red(dev, true);
++ ret = mt7915_mcu_set_red(dev, true);
++ if (ret)
++ return ret;
+ } else {
+ mt7915_mcu_set_red(dev, false);
++ if (ret)
++ return ret;
}
+
ret = mt7915_mcu_set_mwds(dev, 1);
if (ret)
return ret;
-@@ -2370,12 +2375,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+@@ -2371,12 +2380,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
if (ret)
return ret;
@@ -47,7 +51,7 @@
}
int mt7915_mcu_init(struct mt7915_dev *dev)
-@@ -4507,6 +4507,35 @@ int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a
+@@ -4508,6 +4512,35 @@ int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a
return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), wait_resp);
}
@@ -83,7 +87,7 @@
int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled)
{
-@@ -4517,17 +4546,21 @@ int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled)
+@@ -4518,17 +4551,21 @@ int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled)
u32 red_type = enabled > 0 ? RED_BY_WA_ENABLE : RED_DISABLE;
__le32 req = cpu_to_le32(red_type);
@@ -110,22 +114,22 @@
int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b30cc820..9f882042 100644
+index edb8b510..7963a700 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
-@@ -289,6 +289,7 @@ enum {
- MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
- #endif
+@@ -285,6 +285,7 @@ enum {
+ MCU_WA_PARAM_CPU_UTIL = 0x0b,
+ MCU_WA_PARAM_RED = 0x0e,
MCU_WA_PARAM_WED_VERSION = 0x32,
+ MCU_WA_PARAM_RED_SETTING = 0x40,
- };
-
- enum mcu_mmps_mode {
+ #ifdef MTK_DEBUG
+ MCU_WA_PARAM_RED_SHOW_STA = 0xf,
+ MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 8ea75fb9..def78c67 100644
+index f9c02912..819cec99 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -775,13 +775,14 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
+@@ -771,13 +771,14 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
#endif
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/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch b/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch
old mode 100644
new mode 100755
index c4af9df..52127c6
--- a/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-wed-update-mt7916-trinfo-when-hw-path-en.patch
@@ -1,7 +1,7 @@
From f30bc7032eeb4a32393bdec69e719e3a1c9ceeae Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 22 Sep 2022 09:54:53 +0800
-Subject: [PATCH 3007/3011] mt76: mt7915: wed: update mt7916 trinfo when hw
+Subject: [PATCH 3007/3012] mt76: mt7915: wed: update mt7916 trinfo when hw
path enable
---
diff --git a/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch b/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch
old mode 100644
new mode 100755
index afafd01..0309f74
--- a/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-wed-find-rx-token-by-physical-address.patch
@@ -1,13 +1,13 @@
From 82ba992b09e55d1291387351cc9dc0da0c6cb66b 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 3008/3011] mt76: mt7915: wed: find rx token by physical
+Subject: [PATCH 3008/3012] mt76: mt7915: wed: 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.
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
dma.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch b/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch
old mode 100644
new mode 100755
index dc1c019..8d47adc
--- a/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch
@@ -1,12 +1,12 @@
From 7b8d03a4a4996e29c178a870c29b8ba7bd45c6d6 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 25 Nov 2022 14:37:58 +0800
-Subject: [PATCH 3009/3011] mt76: mt7915: wed: drop scatter and gather frame
+Subject: [PATCH 3009/3012] mt76: mt7915: wed: drop scatter and gather frame
The scatter and gather frame may be incorrect because WED and WO may
send frames to host driver interleaved.
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
dma.c | 9 +++++++++
dma.h | 1 +
diff --git a/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch b/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
old mode 100644
new mode 100755
index e4ed9eb..56903c1
--- a/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
@@ -1,7 +1,7 @@
-From 1312c8e16c778c9c42f993466caf6fee4b7d2f3f Mon Sep 17 00:00:00 2001
+From 40d816ec96c946c37635205f6f4a28795be5ffc0 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 3010/3011] mt76: mt7915: wed: HW ATF support for mt7986
+Subject: [PATCH 3010/3012] mt76: mt7915: wed: HW ATF support for mt7986
Signed-off-by: Lian Chen <lian.chen@mediatek.com>
---
@@ -468,7 +468,7 @@
diff --git a/mt7915/init.c b/mt7915/init.c
old mode 100644
new mode 100755
-index 1ed519be..c347509b
+index 3f0a9d93..b9216233
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -550,10 +550,46 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
@@ -529,7 +529,7 @@
int mt7915_txbf_init(struct mt7915_dev *dev)
diff --git a/mt7915/main.c b/mt7915/main.c
-index d8571642..dcf1583d 100644
+index 31cac5e1..a8e722f1 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -199,6 +199,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
@@ -551,7 +551,7 @@
out:
mutex_unlock(&dev->mt76.mutex);
-@@ -688,6 +693,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -670,6 +675,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;
@@ -559,7 +559,7 @@
#ifdef CONFIG_MTK_VENDOR
struct mt7915_phy *phy;
#endif
-@@ -742,6 +748,16 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -721,6 +727,16 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7915_mcu_set_mimo(phy, 0);
}
#endif
@@ -577,10 +577,10 @@
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 2cfd5f4a..4acca9d9 100644
+index daa0006b..3db8e436 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -3506,6 +3506,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
+@@ -3511,6 +3511,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
&req, sizeof(req), false);
}
@@ -753,10 +753,10 @@
{
struct {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index def78c67..0fb1de3e 100644
+index 819cec99..ed293e70 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -133,6 +133,58 @@ struct mt7915_twt_flow {
+@@ -130,6 +130,58 @@ struct mt7915_twt_flow {
DECLARE_EWMA(avg_signal, 10, 8)
@@ -815,7 +815,7 @@
struct mt7915_sta {
struct mt76_wcid wcid; /* must be first */
-@@ -154,6 +206,7 @@ struct mt7915_sta {
+@@ -151,6 +203,7 @@ struct mt7915_sta {
u8 flowid_mask;
struct mt7915_twt_flow flow[MT7915_MAX_STA_TWT_AGRT];
} twt;
@@ -823,7 +823,7 @@
};
struct mt7915_vif_cap {
-@@ -468,6 +521,8 @@ struct mt7915_dev {
+@@ -465,6 +518,8 @@ struct mt7915_dev {
} dbg;
const struct mt7915_dbg_reg_desc *dbg_reg;
#endif
@@ -832,7 +832,7 @@
};
enum {
-@@ -500,6 +555,15 @@ enum mt7915_rdd_cmd {
+@@ -497,6 +552,15 @@ enum mt7915_rdd_cmd {
RDD_IRQ_OFF,
};
@@ -848,7 +848,7 @@
static inline struct mt7915_phy *
mt7915_hw_phy(struct ieee80211_hw *hw)
{
-@@ -627,6 +691,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
+@@ -624,6 +688,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/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch b/recipes-wifi/linux-mt76/files/patches/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch
old mode 100644
new mode 100755
index 0a00aef..fd0f0b6
--- a/recipes-wifi/linux-mt76/files/patches/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch
@@ -1,7 +1,7 @@
-From b9cfe422dcdce6badd19d45b23affb51e6820300 Mon Sep 17 00:00:00 2001
+From 6a67d8e3c682c1f4332c2a45e0e4214c54605e67 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 2 Dec 2022 17:17:06 +0800
-Subject: [PATCH 3011/3011] mt76: mt7915: wed: add mt7916 2 pcie support when
+Subject: [PATCH 3011/3012] mt76: mt7915: wed: add mt7916 2 pcie support when
wed on
It should use bit 23 in interrupt mask for wfdma band1 data
@@ -10,9 +10,9 @@
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
mt7915/dma.c | 8 ++++++--
- mt7915/mcu.c | 2 +-
+ mt7915/mcu.c | 3 ++-
mt7915/mmio.c | 10 +++++-----
- 3 files changed, 12 insertions(+), 8 deletions(-)
+ 3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/mt7915/dma.c b/mt7915/dma.c
index 1ae6c339..36260085 100644
@@ -34,20 +34,21 @@
MT7916_RXQ_MCU_WA_MAIN);
TXQ_CONFIG(0, WFDMA0, MT_INT_WED_TX_DONE_BAND0,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4acca9d9..1cdb9d45 100644
+index 3db8e436..2a689e92 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -2352,7 +2352,7 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
+@@ -2351,7 +2351,8 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
return ret;
- if (mtk_wed_device_active(wed)) {
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
- if (is_mt7915(&dev->mt76))
-+ if (is_mt7915(&dev->mt76) || !mtk_wed_get_rx_capa(wed))
- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
- 0, 0, 0);
++ if (is_mt7915(&dev->mt76) ||
++ !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed))
+ ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
+ 0, 0, 0);
else
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6fb3419d..e30a8d4c 100644
+index ecc38e05..992beca3 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -964,13 +964,13 @@ irqreturn_t mt7915_irq_handler(int irq, void *dev_instance)
diff --git a/recipes-wifi/linux-mt76/files/patches/3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch b/recipes-wifi/linux-mt76/files/patches/3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch
new file mode 100755
index 0000000..dc594ef
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch
@@ -0,0 +1,500 @@
+From c326d38bf0da40d6b0ccbd13de2bb267398598d0 Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Wed, 14 Dec 2022 17:19:00 +0800
+Subject: [PATCH 3012/3013] mt76: mt7915: wed: add rxwi for further in chip rro
+ development
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ dma.c | 98 +++++++++++++++++++++++++------------------------
+ mac80211.c | 2 +-
+ mt76.h | 24 +++++++-----
+ mt7915/dma.c | 2 -
+ mt7915/mmio.c | 21 ++++++-----
+ mt7915/mt7915.h | 1 +
+ tx.c | 16 ++++----
+ 7 files changed, 86 insertions(+), 78 deletions(-)
+
+diff --git a/dma.c b/dma.c
+index 0914266a..7ef272e2 100644
+--- a/dma.c
++++ b/dma.c
+@@ -59,17 +59,17 @@ mt76_alloc_txwi(struct mt76_dev *dev)
+ return t;
+ }
+
+-static struct mt76_txwi_cache *
++static struct mt76_rxwi_cache *
+ mt76_alloc_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+- t = kzalloc(L1_CACHE_ALIGN(sizeof(*t)), GFP_ATOMIC);
+- if (!t)
++ r = kzalloc(L1_CACHE_ALIGN(sizeof(*r)), GFP_ATOMIC);
++ if (!r)
+ return NULL;
+
+- t->ptr = NULL;
+- return t;
++ r->ptr = NULL;
++ return r;
+ }
+
+ static struct mt76_txwi_cache *
+@@ -88,20 +88,20 @@ __mt76_get_txwi(struct mt76_dev *dev)
+ return t;
+ }
+
+-static struct mt76_txwi_cache *
++static struct mt76_rxwi_cache *
+ __mt76_get_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t = NULL;
++ struct mt76_rxwi_cache *r = NULL;
+
+- spin_lock(&dev->wed_lock);
++ spin_lock(&dev->lock);
+ if (!list_empty(&dev->rxwi_cache)) {
+- t = list_first_entry(&dev->rxwi_cache, struct mt76_txwi_cache,
++ r = list_first_entry(&dev->rxwi_cache, struct mt76_rxwi_cache,
+ list);
+- list_del(&t->list);
++ list_del(&r->list);
+ }
+- spin_unlock(&dev->wed_lock);
++ spin_unlock(&dev->lock);
+
+- return t;
++ return r;
+ }
+
+ static struct mt76_txwi_cache *
+@@ -115,13 +115,13 @@ mt76_get_txwi(struct mt76_dev *dev)
+ return mt76_alloc_txwi(dev);
+ }
+
+-struct mt76_txwi_cache *
++struct mt76_rxwi_cache *
+ mt76_get_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t = __mt76_get_rxwi(dev);
++ struct mt76_rxwi_cache *r = __mt76_get_rxwi(dev);
+
+- if (t)
+- return t;
++ if (r)
++ return r;
+
+ return mt76_alloc_rxwi(dev);
+ }
+@@ -140,14 +140,14 @@ mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
+ EXPORT_SYMBOL_GPL(mt76_put_txwi);
+
+ void
+-mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
++mt76_put_rxwi(struct mt76_dev *dev, struct mt76_rxwi_cache *r)
+ {
+- if (!t)
++ if (!r)
+ return;
+
+- spin_lock(&dev->wed_lock);
+- list_add(&t->list, &dev->rxwi_cache);
+- spin_unlock(&dev->wed_lock);
++ spin_lock(&dev->lock);
++ list_add(&r->list, &dev->rxwi_cache);
++ spin_unlock(&dev->lock);
+ }
+ EXPORT_SYMBOL_GPL(mt76_put_rxwi);
+
+@@ -168,13 +168,13 @@ mt76_free_pending_txwi(struct mt76_dev *dev)
+ void
+ mt76_free_pending_rxwi(struct mt76_dev *dev)
+ {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+ local_bh_disable();
+- while ((t = __mt76_get_rxwi(dev)) != NULL) {
+- if (t->ptr)
+- skb_free_frag(t->ptr);
+- kfree(t);
++ while ((r = __mt76_get_rxwi(dev)) != NULL) {
++ if (r->ptr)
++ skb_free_frag(r->ptr);
++ kfree(r);
+ }
+ local_bh_enable();
+ }
+@@ -209,7 +209,7 @@ mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q)
+ static int
+ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ struct mt76_queue_buf *buf, int nbufs, u32 info,
+- struct sk_buff *skb, void *txwi)
++ struct sk_buff *skb, void *txwi, void *rxwi)
+ {
+ struct mt76_queue_entry *entry;
+ struct mt76_desc *desc;
+@@ -227,13 +227,13 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+
+ if ((q->flags & MT_QFLAG_WED) &&
+ FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
+- struct mt76_txwi_cache *t = txwi;
++ struct mt76_rxwi_cache *r = rxwi;
+ int rx_token;
+
+- if (!t)
++ if (!r)
+ return -ENOMEM;
+
+- rx_token = mt76_rx_token_consume(dev, (void *)skb, t,
++ rx_token = mt76_rx_token_consume(dev, (void *)skb, r,
+ buf[0].addr);
+ if (rx_token < 0)
+ return -ENOMEM;
+@@ -280,6 +280,7 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+ }
+
+ q->entry[idx].txwi = txwi;
++ q->entry[idx].rxwi = rxwi;
+ q->entry[idx].skb = skb;
+ q->entry[idx].wcid = 0xffff;
+
+@@ -379,13 +380,13 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ u32 id, find = 0;
+ u32 token = FIELD_GET(MT_DMA_CTL_TOKEN,
+ le32_to_cpu(desc->buf1));
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+ if (*more) {
+ spin_lock_bh(&dev->rx_token_lock);
+
+- idr_for_each_entry(&dev->rx_token, t, id) {
+- if (t->dma_addr == le32_to_cpu(desc->buf0)) {
++ idr_for_each_entry(&dev->rx_token, r, id) {
++ if (r->dma_addr == le32_to_cpu(desc->buf0)) {
+ find = 1;
+ desc->buf1 = FIELD_PREP(MT_DMA_CTL_TOKEN, id);
+ token = id;
+@@ -398,11 +399,11 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ return NULL;
+ }
+
+- t = mt76_rx_token_release(dev, token);
+- if (!t)
++ r = mt76_rx_token_release(dev, token);
++ if (!r)
+ return NULL;
+
+- dma_unmap_single(dev->dma_dev, t->dma_addr,
++ dma_unmap_single(dev->dma_dev, r->dma_addr,
+ SKB_WITH_OVERHEAD(q->buf_size),
+ DMA_FROM_DEVICE);
+
+@@ -410,10 +411,10 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
+ if (!buf)
+ return NULL;
+
+- memcpy(buf, t->ptr, SKB_WITH_OVERHEAD(q->buf_size));
+- t->dma_addr = 0;
++ memcpy(buf, r->ptr, SKB_WITH_OVERHEAD(q->buf_size));
++ r->dma_addr = 0;
+
+- mt76_put_rxwi(dev, t);
++ mt76_put_rxwi(dev, r);
+
+ if (drop) {
+ u32 ctrl = le32_to_cpu(READ_ONCE(desc->ctrl));
+@@ -481,7 +482,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
+ buf.len = skb->len;
+
+ spin_lock_bh(&q->lock);
+- mt76_dma_add_buf(dev, q, &buf, 1, tx_info, skb, NULL);
++ mt76_dma_add_buf(dev, q, &buf, 1, tx_info, skb, NULL, NULL);
+ mt76_dma_kick_queue(dev, q);
+ spin_unlock_bh(&q->lock);
+
+@@ -558,7 +559,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
+ goto unmap;
+
+ return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
+- tx_info.info, tx_info.skb, t);
++ tx_info.info, tx_info.skb, t, NULL);
+
+ unmap:
+ for (n--; n > 0; n--)
+@@ -598,20 +599,21 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+ spin_lock_bh(&q->lock);
+
+ while (q->queued < q->ndesc - 1) {
+- struct mt76_txwi_cache *t = NULL;
++ struct mt76_rxwi_cache *r = NULL;
+ struct mt76_queue_buf qbuf;
+ bool skip_alloc = false;
+ void *buf = NULL;
+
+ if ((q->flags & MT_QFLAG_WED) &&
+ FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
+- t = mt76_get_rxwi(dev);
+- if (!t)
++ r = mt76_get_rxwi(dev);
++ if (!r)
+ break;
+
+- if (t->ptr) {
++ /* reuse skb buf for wed rx copy*/
++ if (r->ptr) {
+ skip_alloc = true;
+- buf = t->ptr;
++ buf = r->ptr;
+ }
+ }
+
+@@ -630,7 +632,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+ qbuf.addr = addr + offset;
+ qbuf.len = len - offset;
+ qbuf.skip_unmap = false;
+- if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t) < 0) {
++ if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, NULL, r) < 0) {
+ dma_unmap_single(dev->dma_dev, addr, len,
+ DMA_FROM_DEVICE);
+ skb_free_frag(buf);
+diff --git a/mac80211.c b/mac80211.c
+index de9ef237..818f4f0c 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -597,7 +597,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);
+- spin_lock_init(&dev->wed_lock);
+ mutex_init(&dev->mutex);
+ init_waitqueue_head(&dev->tx_wait);
+
+@@ -628,6 +627,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;
++ dev->rx_token_size = dev->drv->rx_token_size;
+
+ 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 f1795778..42364b81 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -166,6 +166,7 @@ struct mt76_queue_entry {
+ };
+ union {
+ struct mt76_txwi_cache *txwi;
++ struct mt76_rxwi_cache *rxwi;
+ struct urb *urb;
+ int buf_sz;
+ };
+@@ -354,10 +355,15 @@ struct mt76_txwi_cache {
+ struct list_head list;
+ dma_addr_t dma_addr;
+
+- union {
+- struct sk_buff *skb;
+- void *ptr;
+- };
++ struct sk_buff *skb;
++};
++
++struct mt76_rxwi_cache {
++ struct list_head list;
++ dma_addr_t dma_addr;
++
++ void *ptr;
++ u32 token;
+ };
+
+ struct mt76_rx_tid {
+@@ -441,6 +447,7 @@ struct mt76_driver_ops {
+ u16 txwi_size;
+ u16 token_size;
+ u8 mcs_rates;
++ u16 rx_token_size;
+
+ void (*update_survey)(struct mt76_phy *phy);
+
+@@ -805,7 +812,6 @@ struct mt76_dev {
+
+ struct ieee80211_hw *hw;
+
+- spinlock_t wed_lock;
+ spinlock_t lock;
+ spinlock_t cc_lock;
+
+@@ -1394,8 +1400,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);
+-void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
+-struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
++void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_rxwi_cache *r);
++struct mt76_rxwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
+ 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);
+@@ -1541,9 +1547,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);
+-struct mt76_txwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
++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,
+- struct mt76_txwi_cache *r, dma_addr_t phys);
++ struct mt76_rxwi_cache *r, dma_addr_t phys);
+
+ static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
+ {
+diff --git a/mt7915/dma.c b/mt7915/dma.c
+index 36260085..9cbd3625 100644
+--- a/mt7915/dma.c
++++ b/mt7915/dma.c
+@@ -492,7 +492,6 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ mtk_wed_get_rx_capa(&mdev->mmio.wed)) {
+ dev->mt76.q_rx[MT_RXQ_MAIN].flags =
+ MT_WED_Q_RX(MT7915_RXQ_BAND0);
+- dev->mt76.rx_token_size += MT7915_RX_RING_SIZE;
+ }
+
+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
+@@ -529,7 +528,6 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ mtk_wed_get_rx_capa(&mdev->mmio.wed)) {
+ dev->mt76.q_rx[MT_RXQ_BAND1].flags =
+ MT_WED_Q_RX(MT7915_RXQ_BAND1);
+- dev->mt76.rx_token_size += MT7915_RX_RING_SIZE;
+ }
+
+ /* rx data queue for band1 */
+diff --git a/mt7915/mmio.c b/mt7915/mmio.c
+index 992beca3..ba728dd0 100644
+--- a/mt7915/mmio.c
++++ b/mt7915/mmio.c
+@@ -603,18 +603,18 @@ static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
+
+ dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
+ for (i = 0; i < dev->mt76.rx_token_size; i++) {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+- t = mt76_rx_token_release(&dev->mt76, i);
+- if (!t || !t->ptr)
++ r = mt76_rx_token_release(&dev->mt76, i);
++ if (!r || !r->ptr)
+ continue;
+
+- dma_unmap_single(dev->mt76.dma_dev, t->dma_addr,
++ dma_unmap_single(dev->mt76.dma_dev, r->dma_addr,
+ wed->wlan.rx_size, DMA_FROM_DEVICE);
+- skb_free_frag(t->ptr);
+- t->ptr = NULL;
++ skb_free_frag(r->ptr);
++ r->ptr = NULL;
+
+- mt76_put_rxwi(&dev->mt76, t);
++ mt76_put_rxwi(&dev->mt76, r);
+ }
+
+ mt76_free_pending_rxwi(&dev->mt76);
+@@ -639,7 +639,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+ sizeof(struct skb_shared_info));
+
+ for (i = 0; i < size; i++) {
+- struct mt76_txwi_cache *t = mt76_get_rxwi(&dev->mt76);
++ struct mt76_rxwi_cache *r = mt76_get_rxwi(&dev->mt76);
+ dma_addr_t phy_addr;
+ int token;
+ void *ptr;
+@@ -658,7 +658,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+ }
+
+ desc->buf0 = cpu_to_le32(phy_addr);
+- token = mt76_rx_token_consume(&dev->mt76, ptr, t, phy_addr);
++ token = mt76_rx_token_consume(&dev->mt76, ptr, r, phy_addr);
+ if (token < 0) {
+ dma_unmap_single(dev->mt76.dma_dev, phy_addr,
+ wed->wlan.rx_size, DMA_TO_DEVICE);
+@@ -786,7 +786,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+ wed->wlan.update_wo_rx_stats = mt7915_mmio_wed_update_rx_stats;
+ wed->wlan.ser_trigger = mt7915_wed_trigger_ser;
+
+- dev->mt76.rx_token_size = wed->wlan.rx_npkt;
++ dev->mt76.rx_token_size += wed->wlan.rx_npkt;
+
+ if (mtk_wed_device_attach(wed))
+ return 0;
+@@ -992,6 +992,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
+ SURVEY_INFO_TIME_RX |
+ SURVEY_INFO_TIME_BSS_RX,
+ .token_size = MT7915_TOKEN_SIZE,
++ .rx_token_size = MT7915_RX_TOKEN_SIZE,
+ .tx_prepare_skb = mt7915_tx_prepare_skb,
+ .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 ed293e70..6def0596 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -65,6 +65,7 @@
+
+ #define MT7915_EEPROM_BLOCK_SIZE 16
+ #define MT7915_TOKEN_SIZE 8192
++#define MT7915_RX_TOKEN_SIZE 4096
+
+ #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 6d55566f..a72b7779 100644
+--- a/tx.c
++++ b/tx.c
+@@ -756,16 +756,16 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi)
+ EXPORT_SYMBOL_GPL(mt76_token_consume);
+
+ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
+- struct mt76_txwi_cache *t, dma_addr_t phys)
++ struct mt76_rxwi_cache *r, dma_addr_t phys)
+ {
+ int token;
+
+ spin_lock_bh(&dev->rx_token_lock);
+- token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size,
++ token = idr_alloc(&dev->rx_token, r, 0, dev->rx_token_size,
+ GFP_ATOMIC);
+ if (token >= 0) {
+- t->ptr = ptr;
+- t->dma_addr = phys;
++ r->ptr = ptr;
++ r->dma_addr = phys;
+ }
+ spin_unlock_bh(&dev->rx_token_lock);
+
+@@ -802,15 +802,15 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
+ }
+ EXPORT_SYMBOL_GPL(mt76_token_release);
+
+-struct mt76_txwi_cache *
++struct mt76_rxwi_cache *
+ mt76_rx_token_release(struct mt76_dev *dev, int token)
+ {
+- struct mt76_txwi_cache *t;
++ struct mt76_rxwi_cache *r;
+
+ spin_lock_bh(&dev->rx_token_lock);
+- t = idr_remove(&dev->rx_token, token);
++ r = idr_remove(&dev->rx_token, token);
+ spin_unlock_bh(&dev->rx_token_lock);
+
+- return t;
++ return r;
+ }
+ EXPORT_SYMBOL_GPL(mt76_rx_token_release);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/4000-mt76-revert-get_of_mac_addr.patch b/recipes-wifi/linux-mt76/files/patches/4000-mt76-revert-get_of_mac_addr.patch
index 6e61567..c284213 100644
--- a/recipes-wifi/linux-mt76/files/patches/4000-mt76-revert-get_of_mac_addr.patch
+++ b/recipes-wifi/linux-mt76/files/patches/4000-mt76-revert-get_of_mac_addr.patch
@@ -1,4 +1,4 @@
-From e362fcbdcdf2e01840aaa03bf432535c5485463c Mon Sep 17 00:00:00 2001
+From 393196a25088287cd0e7d6b96ccaae65d44cd25e Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 13 Dec 2022 10:51:46 +0800
Subject: [PATCH 4000/4002] mt76: revert get_of_mac_addr
@@ -8,7 +8,7 @@
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/eeprom.c b/eeprom.c
-index 6290156f..306c6412 100644
+index 6290156..306c641 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -126,9 +126,15 @@ void
@@ -29,5 +29,5 @@
if (!is_valid_ether_addr(phy->macaddr)) {
eth_random_addr(phy->macaddr);
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/4001-mt76-include-header-files-for-module-param.patch b/recipes-wifi/linux-mt76/files/patches/4001-mt76-include-header-files-for-module-param.patch
index 941caaa..02d22be 100644
--- a/recipes-wifi/linux-mt76/files/patches/4001-mt76-include-header-files-for-module-param.patch
+++ b/recipes-wifi/linux-mt76/files/patches/4001-mt76-include-header-files-for-module-param.patch
@@ -1,4 +1,4 @@
-From ee4fac966742080be4cdcfa9fdb258752d90671a Mon Sep 17 00:00:00 2001
+From 651309c679bcab8d573a64c5504aeb6fbdb228fb Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 13 Dec 2022 10:38:13 +0800
Subject: [PATCH 4001/4002] mt76: include header files for module param
@@ -11,7 +11,7 @@
4 files changed, 4 insertions(+)
diff --git a/mcu.c b/mcu.c
-index a8cafa39..fa4b0544 100644
+index a8cafa3..fa4b054 100644
--- a/mcu.c
+++ b/mcu.c
@@ -4,6 +4,7 @@
@@ -23,7 +23,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 83f30305..e917d025 100644
+index 83f3030..e917d02 100644
--- a/mt7615/mcu.c
+++ b/mt7615/mcu.c
@@ -10,6 +10,7 @@
@@ -35,7 +35,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 291a7c12..56493774 100644
+index 291a7c1..5649377 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -4,6 +4,7 @@
@@ -47,7 +47,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 1cdb9d45..69f1a0d4 100644
+index 1cdb9d4..69f1a0d 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -6,6 +6,7 @@
@@ -59,5 +59,5 @@
#define fw_name(_dev, name, ...) ({ \
char *_fw; \
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/4002-mt76-revert-for-backports-5.15-wireless-stack.patch b/recipes-wifi/linux-mt76/files/patches/4002-mt76-revert-for-backports-5.15-wireless-stack.patch
index 7a09927..d8b267e 100644
--- a/recipes-wifi/linux-mt76/files/patches/4002-mt76-revert-for-backports-5.15-wireless-stack.patch
+++ b/recipes-wifi/linux-mt76/files/patches/4002-mt76-revert-for-backports-5.15-wireless-stack.patch
@@ -1,13 +1,14 @@
-From a1465a9ff44b461a0aa335ad657067e04066204c Mon Sep 17 00:00:00 2001
+From 696f1e5e4f64e1426b74fe3d881390cb6cd47ebe Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 12 Dec 2022 18:17:12 +0800
-Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
+Subject: [PATCH 4002/4002] mt76: revert for backports-5.15 wireless stack
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
debugfs.c | 2 +
dma.c | 2 +-
mac80211.c | 4 +-
+ mt7615/dma.c | 4 +-
mt7615/main.c | 6 +-
mt7615/mcu.c | 8 +--
mt76_connac_mcu.c | 108 +++++++++++++++---------------
@@ -20,10 +21,10 @@
mt7915/mcu.c | 166 +++++++++++++++++++++++-----------------------
mt7915/testmode.c | 8 +--
tx.c | 11 +--
- 15 files changed, 168 insertions(+), 176 deletions(-)
+ 16 files changed, 170 insertions(+), 178 deletions(-)
diff --git a/debugfs.c b/debugfs.c
-index 79064a4d..4a8e1864 100644
+index 79064a4..4a8e186 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -33,8 +33,10 @@ mt76_napi_threaded_set(void *data, u64 val)
@@ -38,7 +39,7 @@
return 0;
}
diff --git a/dma.c b/dma.c
-index 0914266a..21e88a2d 100644
+index 0914266..21e88a2 100644
--- a/dma.c
+++ b/dma.c
@@ -939,7 +939,7 @@ mt76_dma_init(struct mt76_dev *dev,
@@ -51,7 +52,7 @@
napi_enable(&dev->napi[i]);
}
diff --git a/mac80211.c b/mac80211.c
-index 15d300a9..be4a1408 100644
+index 15d300a..be4a140 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -1511,7 +1511,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
@@ -72,8 +73,23 @@
return;
dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
+diff --git a/mt7615/dma.c b/mt7615/dma.c
+index f191443..ec729db 100644
+--- a/mt7615/dma.c
++++ b/mt7615/dma.c
+@@ -281,8 +281,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
+ if (ret < 0)
+ return ret;
+
+- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
+- mt7615_poll_tx);
++ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
++ mt7615_poll_tx, NAPI_POLL_WEIGHT);
+ napi_enable(&dev->mt76.tx_napi);
+
+ mt76_poll(dev, MT_WPDMA_GLO_CFG,
diff --git a/mt7615/main.c b/mt7615/main.c
-index ab4c1b44..8fb5b256 100644
+index ab4c1b4..8fb5b25 100644
--- a/mt7615/main.c
+++ b/mt7615/main.c
@@ -474,7 +474,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
@@ -104,7 +120,7 @@
mt7615_mutex_release(dev);
}
diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index e917d025..b2e1f388 100644
+index e917d02..b2e1f38 100644
--- a/mt7615/mcu.c
+++ b/mt7615/mcu.c
@@ -353,7 +353,7 @@ out:
@@ -144,7 +160,7 @@
.bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
};
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 56493774..99851dc0 100644
+index 5649377..99851dc 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
@@ -485,7 +501,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 d3f74473..87ea3db1 100644
+index d3f7447..87ea3db 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,
@@ -510,7 +526,7 @@
if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
ba_size = 0;
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index b178036c..cecc3ef5 100644
+index b178036..cecc3ef 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -1905,8 +1905,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
@@ -525,7 +541,7 @@
field = RATE_PARAM_FIXED;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 36260085..e3d4ebc4 100644
+index 3626008..e3d4ebc 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -555,8 +555,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -540,7 +556,7 @@
mt7915_dma_enable(dev);
diff --git a/mt7915/init.c b/mt7915/init.c
-index c347509b..e643c0e4 100755
+index c347509..e643c0e 100755
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -1148,8 +1148,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
@@ -554,7 +570,7 @@
if (band == NL80211_BAND_6GHZ) {
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index d5df73db..3bbe757c 100644
+index d5df73d..3bbe757 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -913,7 +913,7 @@ mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
@@ -567,7 +583,7 @@
tid = le32_get_bits(txwi[1], MT_TXD1_TID);
diff --git a/mt7915/main.c b/mt7915/main.c
-index dcf1583d..5d678df8 100644
+index dcf1583..5d678df 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -503,7 +503,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
@@ -611,7 +627,7 @@
mutex_lock(&dev->mt76.mutex);
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 69f1a0d4..87c28224 100644
+index 69f1a0d..87c2822 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -64,7 +64,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
@@ -1131,7 +1147,7 @@
len = sku_len[SKU_HE_RU242] * 4;
}
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 2ae6c07f..75be1ed9 100644
+index 2ae6c07..75be1ed 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -360,12 +360,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
@@ -1152,7 +1168,7 @@
sta->wme = 1;
diff --git a/tx.c b/tx.c
-index 6d55566f..91c8dd8d 100644
+index 6d55566..91c8dd8 100644
--- a/tx.c
+++ b/tx.c
@@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
@@ -1180,5 +1196,5 @@
hw = mt76_tx_status_get_hw(dev, skb);
--
-2.25.1
+2.36.1
diff --git a/recipes-wifi/linux-mt76/files/patches/patches.inc b/recipes-wifi/linux-mt76/files/patches/patches.inc
index edd01f5..1c27c78 100644
--- a/recipes-wifi/linux-mt76/files/patches/patches.inc
+++ b/recipes-wifi/linux-mt76/files/patches/patches.inc
@@ -1,5 +1,9 @@
#patch patches (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
+ file://0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch \
+ file://0002-wifi-mt76-mt7915-rework-mt7915_mcu_set_thermal_throt.patch \
+ file://0003-wifi-mt76-mt7915-rework-mt7915_thermal_temp_store.patch \
+ file://0004-wifi-mt76-mt7915-add-error-message-in-mt7915_thermal.patch \
file://1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch \
file://1002-mt76-mt7915-csi-implement-csi-support.patch \
file://1003-mt76-mt7915-air-monitor-support.patch \
@@ -28,8 +32,9 @@
file://1127-mt76-mt7915-add-E3-re-bonding-for-low-yield-rate-iss.patch \
file://1128-mt76-mt7915-support-on-off-SW-ACI-through-debugfs.patch \
file://1129-mt76-mt7915-add-bf-backoff-limit-table-support.patch \
+ file://1130-mt76-mt7915-add-amsdu-set-get-ctrl.patch \
file://3001-mt76-mt7915-wed-add-wed-tx-support.patch \
- file://3002-mt76-mt7915-wed-add-wed-tx-wds-support-on-mt7986.patch \
+ file://3002-mt76-mt7915-wed-add-wds-support-when-wed-is-enabled.patch \
file://3003-mt76-connac-wed-add-wed-rx-copy-skb.patch \
file://3004-mt76-mt7915-wed-add-fill-receive-path-to-report-wed-.patch \
file://3005-mt76-mt7915-wed-add-ser-support-when-wed-on.patch \
@@ -39,6 +44,7 @@
file://3009-mt76-mt7915-wed-drop-scatter-and-gather-frame.patch \
file://3010-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch \
file://3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch \
+ file://3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch \
file://4000-mt76-revert-get_of_mac_addr.patch \
file://4001-mt76-include-header-files-for-module-param.patch \
file://4002-mt76-revert-for-backports-5.15-wireless-stack.patch \