]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7915: reset the device after MCU timeout
authorFelix Fietkau <nbd@nbd.name>
Tue, 27 Aug 2024 09:30:02 +0000 (11:30 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 6 Sep 2024 12:23:06 +0000 (14:23 +0200)
On MT7915, MCU hangs do not trigger watchdog interrupts, so they can only
be detected through MCU message timeouts. Ensure that the hardware gets
restarted when that happens in order to prevent a permanent stuck state.

Link: https://patch.msgid.link/20240827093011.18621-15-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c

index 0cde1b3c7d41636f9f8073b81a2c36de8fda563f..81375b5d0021a47da83b7bb90893fa8dd0bb1989 100644 (file)
@@ -157,12 +157,21 @@ static int
 mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd,
                          struct sk_buff *skb, int seq)
 {
+       struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
        struct mt76_connac2_mcu_rxd *rxd;
        int ret = 0;
 
        if (!skb) {
                dev_err(mdev->dev, "Message %08x (seq %d) timeout\n",
                        cmd, seq);
+
+               if (!test_and_set_bit(MT76_MCU_RESET, &dev->mphy.state)) {
+                       dev->recovery.restart = true;
+                       wake_up(&dev->mt76.mcu.wait);
+                       queue_work(dev->mt76.wq, &dev->reset_work);
+                       wake_up(&dev->reset_wait);
+               }
+
                return -ETIMEDOUT;
        }