summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Wang <sean.wang@mediatek.com>2021-05-20 11:46:38 +0800
committerFelix Fietkau <nbd@nbd.name>2021-06-19 09:22:45 +0200
commitf07ac384b4579f294bb1e0380ed501156219ed71 (patch)
tree0c0feed3e4279b7d75908c15e20be7012daec755
parentf011c3691a7efe66b1ef76bbf7821973b8490a15 (diff)
mt76: mt7921: avoid unnecessary consecutive WiFi resets
Avoid unnecessary consecutive WiFi resets by dropping reset request when reset work is working. Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/mac.c5
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 96a6c0aabe06..ffc73fabb5b9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -1312,6 +1312,7 @@ void mt7921_mac_reset_work(struct work_struct *work)
int i;
dev_err(dev->mt76.dev, "chip reset\n");
+ dev->hw_full_reset = true;
ieee80211_stop_queues(hw);
cancel_delayed_work_sync(&dev->mphy.mac_work);
@@ -1338,6 +1339,7 @@ void mt7921_mac_reset_work(struct work_struct *work)
ieee80211_scan_completed(dev->mphy.hw, &info);
}
+ dev->hw_full_reset = false;
ieee80211_wake_queues(hw);
ieee80211_iterate_active_interfaces(hw,
IEEE80211_IFACE_ITER_RESUME_ALL,
@@ -1349,7 +1351,8 @@ void mt7921_reset(struct mt76_dev *mdev)
{
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
- queue_work(dev->mt76.wq, &dev->reset_work);
+ if (!dev->hw_full_reset)
+ queue_work(dev->mt76.wq, &dev->reset_work);
}
static void
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
index 03bcb210c357..710ad242fd53 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -156,6 +156,7 @@ struct mt7921_dev {
u16 chainmask;
struct work_struct reset_work;
+ bool hw_full_reset;
struct list_head sta_poll_list;
spinlock_t sta_poll_lock;