forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mt76 patches, add patch to fix memory corruption for mtk_eth_s…
…oc.c
- Loading branch information
Lukasz M
committed
Oct 15, 2024
1 parent
0c61189
commit 1ef4d4f
Showing
8 changed files
with
311 additions
and
0 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
package/kernel/mt76/patches/027-backport-mt7915-improve-hw-reset.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
diff --git a/mt7915/mac.c b/mt7915/mac.c | ||
index e9ed94bf..54974ff7 100644 | ||
--- a/mt7915/mac.c | ||
+++ b/mt7915/mac.c | ||
@@ -1463,7 +1463,6 @@ mt7915_mac_full_reset(struct mt7915_dev *dev) | ||
if (!mt7915_mac_restart(dev)) | ||
break; | ||
} | ||
- mutex_unlock(&dev->mt76.mutex); | ||
|
||
if (i == 10) | ||
dev_err(dev->mt76.dev, "chip full reset failed\n"); | ||
@@ -1473,21 +1472,18 @@ mt7915_mac_full_reset(struct mt7915_dev *dev) | ||
list_del_init(dev->mt76.sta_poll_list.next); | ||
spin_unlock_bh(&dev->mt76.sta_poll_lock); | ||
|
||
- ieee80211_restart_hw(mt76_hw(dev)); | ||
- if (ext_phy) | ||
- ieee80211_restart_hw(ext_phy->hw); | ||
- | ||
- ieee80211_wake_queues(mt76_hw(dev)); | ||
- if (ext_phy) | ||
- ieee80211_wake_queues(ext_phy->hw); | ||
+ memset(dev->mt76.wcid_mask, 0, sizeof(dev->mt76.wcid_mask)); | ||
+ dev->mt76.vif_mask = 0; | ||
|
||
+ i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA); | ||
+ dev->mt76.global_wcid.idx = i; | ||
dev->recovery.hw_full_reset = false; | ||
- ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work, | ||
- MT7915_WATCHDOG_TIME); | ||
+ | ||
+ mutex_unlock(&dev->mt76.mutex); | ||
+ | ||
+ ieee80211_restart_hw(mt76_hw(dev)); | ||
if (ext_phy) | ||
- ieee80211_queue_delayed_work(ext_phy->hw, | ||
- &ext_phy->mac_work, | ||
- MT7915_WATCHDOG_TIME); | ||
+ ieee80211_restart_hw(ext_phy->hw); | ||
} | ||
|
||
/* system error recovery */ | ||
diff --git a/mt7915/main.c b/mt7915/main.c | ||
index 834b7ced..9b4672b6 100644 | ||
--- a/mt7915/main.c | ||
+++ b/mt7915/main.c | ||
@@ -1680,6 +1680,17 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, | ||
} | ||
#endif | ||
|
||
+static void | ||
+mt7915_reconfig_complete(struct ieee80211_hw *hw, | ||
+ enum ieee80211_reconfig_type reconfig_type) | ||
+{ | ||
+ struct mt7915_phy *phy = mt7915_hw_phy(hw); | ||
+ | ||
+ ieee80211_wake_queues(hw); | ||
+ ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, | ||
+ MT7915_WATCHDOG_TIME); | ||
+} | ||
+ | ||
const struct ieee80211_ops mt7915_ops = { | ||
.add_chanctx = ieee80211_emulate_add_chanctx, | ||
.remove_chanctx = ieee80211_emulate_remove_chanctx, | ||
@@ -1738,4 +1749,5 @@ const struct ieee80211_ops mt7915_ops = { | ||
.net_fill_forward_path = mt7915_net_fill_forward_path, | ||
.net_setup_tc = mt76_wed_net_setup_tc, | ||
#endif | ||
+ .reconfig_complete = mt7915_reconfig_complete, | ||
}; | ||
diff --git a/mt7915/mcu.c b/mt7915/mcu.c | ||
index 99ee62d3..76a3497a 100644 | ||
--- a/mt7915/mcu.c | ||
+++ b/mt7915/mcu.c | ||
@@ -2360,6 +2360,8 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev) | ||
if (ret) | ||
return ret; | ||
|
||
+ mt76_connac_mcu_del_wtbl_all(&dev->mt76); | ||
+ | ||
if ((mtk_wed_device_active(&dev->mt76.mmio.wed) && | ||
is_mt7915(&dev->mt76)) || | ||
!mtk_wed_get_rx_capa(&dev->mt76.mmio.wed)) |
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions
51
package/kernel/mt76/patches/031-backport-mt7915-fix-firmware-restart-2nd-pcie.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
commit 703c6b78c133643a0e53dbd3a76d9e19f5dc3e30 | ||
Author: Felix Fietkau <[email protected]> | ||
Date: Fri Oct 11 18:46:29 2024 +0200 | ||
|
||
wifi: mt76: mt7915: firmware restart on devices with a second pcie link | ||
|
||
It seems that the firmware checks the register used for detecting matching | ||
PCIe links in order to figure out if a secondary PCIe link is enabled. | ||
Write the register again just before starting the firmware on hw reset, | ||
in order to fix an issue that left the second band unusable after restart. | ||
|
||
Fixes: 9093cfff72e3 ("mt76: mt7915: add support for using a secondary PCIe link for gen1") | ||
Signed-off-by: Felix Fietkau <[email protected]> | ||
|
||
diff --git a/mt7915/mac.c b/mt7915/mac.c | ||
index cf77ce0c..b890a58d 100644 | ||
--- a/mt7915/mac.c | ||
+++ b/mt7915/mac.c | ||
@@ -1388,6 +1388,8 @@ mt7915_mac_restart(struct mt7915_dev *dev) | ||
if (dev_is_pci(mdev->dev)) { | ||
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff); | ||
if (dev->hif2) { | ||
+ mt76_wr(dev, MT_PCIE_RECOG_ID, | ||
+ dev->hif2->index | MT_PCIE_RECOG_ID_SEM); | ||
if (is_mt7915(mdev)) | ||
mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE, 0xff); | ||
else | ||
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h | ||
index ac0b1f0e..5fe872ef 100644 | ||
--- a/mt7915/mt7915.h | ||
+++ b/mt7915/mt7915.h | ||
@@ -191,6 +191,7 @@ struct mt7915_hif { | ||
struct device *dev; | ||
void __iomem *regs; | ||
int irq; | ||
+ u32 index; | ||
}; | ||
|
||
struct mt7915_phy { | ||
diff --git a/mt7915/pci.c b/mt7915/pci.c | ||
index 39132894..07b0a576 100644 | ||
--- a/mt7915/pci.c | ||
+++ b/mt7915/pci.c | ||
@@ -42,6 +42,7 @@ static struct mt7915_hif *mt7915_pci_get_hif2(u32 idx) | ||
continue; | ||
|
||
get_device(hif->dev); | ||
+ hif->index = idx; | ||
goto out; | ||
} | ||
hif = NULL; |
49 changes: 49 additions & 0 deletions
49
package/kernel/mt76/patches/032-backport-mt7915-decrease-mcu-timeout.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
commit 0d8474602a9bdc1296cd729afd58d6bdf06b281c | ||
Author: Felix Fietkau <[email protected]> | ||
Date: Tue Oct 8 21:53:53 2024 +0200 | ||
|
||
wifi: mt76: mt7915: decrease timeout for commonly issued MCU commands | ||
|
||
This allows faster recovery from firmware issues | ||
|
||
Signed-off-by: Felix Fietkau <[email protected]> | ||
|
||
diff --git a/mt7915/mcu.c b/mt7915/mcu.c | ||
index b4760820..fee36abb 100644 | ||
--- a/mt7915/mcu.c | ||
+++ b/mt7915/mcu.c | ||
@@ -194,6 +194,25 @@ mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd, | ||
return ret; | ||
} | ||
|
||
+static void | ||
+mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd) | ||
+{ | ||
+ if ((cmd & __MCU_CMD_FIELD_ID) != MCU_CMD_EXT_CID) | ||
+ return; | ||
+ | ||
+ switch (FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd)) { | ||
+ case MCU_EXT_CMD_THERMAL_CTRL: | ||
+ case MCU_EXT_CMD_GET_MIB_INFO: | ||
+ case MCU_EXT_CMD_PHY_STAT_INFO: | ||
+ case MCU_EXT_CMD_STA_REC_UPDATE: | ||
+ case MCU_EXT_CMD_BSS_INFO_UPDATE: | ||
+ mdev->mcu.timeout = 2 * HZ; | ||
+ return; | ||
+ default: | ||
+ break; | ||
+ } | ||
+} | ||
+ | ||
static int | ||
mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, | ||
int cmd, int *wait_seq) | ||
@@ -208,6 +227,8 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, | ||
else | ||
qid = MT_MCUQ_WM; | ||
|
||
+ mt7915_mcu_set_timeout(mdev, cmd); | ||
+ | ||
return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[qid], skb, 0); | ||
} | ||
|
37 changes: 37 additions & 0 deletions
37
package/kernel/mt76/patches/032-backport-mt7915-fix-omac-idx.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
commit ecca0e77b4bce629ec1f79d83bbd14a68f919188 | ||
Author: Felix Fietkau <[email protected]> | ||
Date: Fri Oct 11 19:59:25 2024 +0200 | ||
|
||
wifi: mt76: mt7915: fix omac index assignment after hardware reset | ||
|
||
Reset per-phy mac address slot mask in order to avoid leaking entries. | ||
|
||
Fixes: 8a55712d124f ("wifi: mt76: mt7915: enable full system reset support") | ||
Signed-off-by: Felix Fietkau <[email protected]> | ||
|
||
diff --git a/mt7915/mac.c b/mt7915/mac.c | ||
index b890a58d..799e8d2c 100644 | ||
--- a/mt7915/mac.c | ||
+++ b/mt7915/mac.c | ||
@@ -1444,9 +1444,11 @@ static void | ||
mt7915_mac_full_reset(struct mt7915_dev *dev) | ||
{ | ||
struct mt76_phy *ext_phy; | ||
+ struct mt7915_phy *phy2; | ||
int i; | ||
|
||
ext_phy = dev->mt76.phys[MT_BAND1]; | ||
+ phy2 = ext_phy ? ext_phy->priv : NULL; | ||
|
||
dev->recovery.hw_full_reset = true; | ||
|
||
@@ -1476,6 +1478,9 @@ mt7915_mac_full_reset(struct mt7915_dev *dev) | ||
|
||
memset(dev->mt76.wcid_mask, 0, sizeof(dev->mt76.wcid_mask)); | ||
dev->mt76.vif_mask = 0; | ||
+ dev->phy.omac_mask = 0; | ||
+ if (phy2) | ||
+ phy2->omac_mask = 0; | ||
|
||
i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA); | ||
dev->mt76.global_wcid.idx = i; |
90 changes: 90 additions & 0 deletions
90
package/kernel/mt76/patches/033-add-mt76_connac_mcu_del_wtbl_all.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
commit 1f4ac8faa529bbca5152b01ca5e9f1727e5162a9 | ||
Author: Felix Fietkau <[email protected]> | ||
Date: Thu Aug 22 22:43:41 2024 +0200 | ||
|
||
wifi: mt76: connac: move mt7615_mcu_del_wtbl_all to connac | ||
|
||
Preparation for reusing it in mt7915 | ||
|
||
Signed-off-by: Felix Fietkau <[email protected]> | ||
|
||
diff --git a/mt7615/init.c b/mt7615/init.c | ||
index f7722f67..f9274c13 100644 | ||
--- a/mt7615/init.c | ||
+++ b/mt7615/init.c | ||
@@ -319,7 +319,7 @@ void mt7615_init_work(struct mt7615_dev *dev) | ||
mt7615_mcu_set_eeprom(dev); | ||
mt7615_mac_init(dev); | ||
mt7615_phy_init(dev); | ||
- mt7615_mcu_del_wtbl_all(dev); | ||
+ mt76_connac_mcu_del_wtbl_all(&dev->mt76); | ||
mt7615_check_offload_capability(dev); | ||
} | ||
EXPORT_SYMBOL_GPL(mt7615_init_work); | ||
diff --git a/mt7615/mcu.c b/mt7615/mcu.c | ||
index f6eb9939..15921887 100644 | ||
--- a/mt7615/mcu.c | ||
+++ b/mt7615/mcu.c | ||
@@ -1880,16 +1880,6 @@ out: | ||
sizeof(req), true); | ||
} | ||
|
||
-int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev) | ||
-{ | ||
- struct wtbl_req_hdr req = { | ||
- .operation = WTBL_RESET_ALL, | ||
- }; | ||
- | ||
- return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(WTBL_UPDATE), | ||
- &req, sizeof(req), true); | ||
-} | ||
- | ||
int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, int val) | ||
{ | ||
struct { | ||
diff --git a/mt7615/mt7615.h b/mt7615/mt7615.h | ||
index 68f4a772..530da48c 100644 | ||
--- a/mt7615/mt7615.h | ||
+++ b/mt7615/mt7615.h | ||
@@ -399,7 +399,6 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta, | ||
struct ieee80211_tx_rate *rates); | ||
void mt7615_pm_wake_work(struct work_struct *work); | ||
void mt7615_pm_power_save_work(struct work_struct *work); | ||
-int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev); | ||
int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd); | ||
int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue, | ||
const struct ieee80211_tx_queue_params *params); | ||
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c | ||
index 3a575ceb..864246f9 100644 | ||
--- a/mt76_connac_mcu.c | ||
+++ b/mt76_connac_mcu.c | ||
@@ -2849,6 +2849,17 @@ int mt76_connac_mcu_restart(struct mt76_dev *dev) | ||
} | ||
EXPORT_SYMBOL_GPL(mt76_connac_mcu_restart); | ||
|
||
+int mt76_connac_mcu_del_wtbl_all(struct mt76_dev *dev) | ||
+{ | ||
+ struct wtbl_req_hdr req = { | ||
+ .operation = WTBL_RESET_ALL, | ||
+ }; | ||
+ | ||
+ return mt76_mcu_send_msg(dev, MCU_EXT_CMD(WTBL_UPDATE), | ||
+ &req, sizeof(req), true); | ||
+} | ||
+EXPORT_SYMBOL_GPL(mt76_connac_mcu_del_wtbl_all); | ||
+ | ||
int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 index, | ||
u8 rx_sel, u8 val) | ||
{ | ||
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h | ||
index e04ae7ed..66d70d6e 100644 | ||
--- a/mt76_connac_mcu.h | ||
+++ b/mt76_connac_mcu.h | ||
@@ -2032,6 +2032,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb, | ||
void *sta_wtbl, void *wtbl_tlv); | ||
int mt76_connac_mcu_set_pm(struct mt76_dev *dev, int band, int enter); | ||
int mt76_connac_mcu_restart(struct mt76_dev *dev); | ||
+int mt76_connac_mcu_del_wtbl_all(struct mt76_dev *dev); | ||
int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 index, | ||
u8 rx_sel, u8 val); | ||
int mt76_connac_mcu_sta_wed_update(struct mt76_dev *dev, struct sk_buff *skb); |
Empty file.