Skip to contentSkip to conversation

wifi: rt2x00: make watchdog param per device

PATCH In review [email protected] 3 participants 3 messages Nov 26, 2023 – Dec 1, 2023 Ralink RT2X00 wireless LAN driver

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 wifi: rt2x00: make watchdog param per device

From: Stanislaw Gruszka <[email protected]>

We can run PCI/MMIO devices together with USB devices in the system. Make watchdog parameter per device to avoid situation when plugin USB device change modparam_watchdog for PCI/MMIO device.

---
Shiji, could you please test it on your setup and give Tested-by: tag ?

 drivers/net/wireless/ralink/rt2x00/rt2800lib.c  | 11 +++++------
 drivers/net/wireless/ralink/rt2x00/rt2x00.h     |  2 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00link.c |  2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +5 -6
index 44127a036ac1..f93c7844dd42 100644
@@ -1353,10 +1353,10 @@ void rt2800_watchdog(struct rt2x00_dev *rt2x00dev)
 	if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
 		return;
 
-	if (modparam_watchdog & RT2800_WATCHDOG_DMA_BUSY)
+	if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_DMA_BUSY)
 		reset = rt2800_watchdog_dma_busy(rt2x00dev);
 
-	if (modparam_watchdog & RT2800_WATCHDOG_HANG)
+	if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_HANG)
 		reset = rt2800_watchdog_hung(rt2x00dev) || reset;
 
 	if (reset)
@@ -12058,14 +12058,13 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
 		__set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
 	}
 
+	rt2x00dev->link.watchdog = modparam_watchdog;
 	/* USB NICs don't support DMA watchdog as INT_SOURCE_CSR is invalid */
 	if (rt2x00_is_usb(rt2x00dev))
-		modparam_watchdog &= ~RT2800_WATCHDOG_DMA_BUSY;
-	if (modparam_watchdog) {
+		rt2x00dev->link.watchdog &= ~RT2800_WATCHDOG_DMA_BUSY;
+	if (rt2x00dev->link.watchdog) {
 		__set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags);
 		rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100);
-	} else {
-		rt2x00dev->link.watchdog_disabled = true;
 	}
 
 	/*
drivers/net/wireless/ralink/rt2x00/rt2x00.h +1 -1
index 62fed38f41c0..82af01448a0a 100644
@@ -334,7 +334,7 @@ struct link {
 	 */
 	struct delayed_work watchdog_work;
 	unsigned int watchdog_interval;
-	bool watchdog_disabled;
+	unsigned int watchdog;
 
 	/*
 	 * Work structure for scheduling periodic AGC adjustments.
drivers/net/wireless/ralink/rt2x00/rt2x00link.c +1 -1
index 6cf7e7c997c2..fb23d409fba8 100644
@@ -384,7 +384,7 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev)
 	struct link *link = &rt2x00dev->link;
 
 	if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
-	    rt2x00dev->ops->lib->watchdog && !link->watchdog_disabled)
+	    rt2x00dev->ops->lib->watchdog && link->watchdog)
 		ieee80211_queue_delayed_work(rt2x00dev->hw,
 					     &link->watchdog_work,
 					     link->watchdog_interval);
Signature · 1 line
2.42.0
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Stanislaw Gruszka

We can run PCI/MMIO devices together with USB devices in the system. Make watchdog parameter per device to avoid situation when plugin USB device change modparam_watchdog for PCI/MMIO device.

---
Shiji, could you please test it on your setup and give Tested-by: tag ?

Hi!

Thanks for fixing it. I've tested it based on OpenWrt main branch and it worked well on MT7620. The watchdog is still working.

Regards

#2 lore raw
In reply to [email protected]
Quoted 8 lines · [email protected] wrote:

From: Stanislaw Gruszka <[email protected]>

We can run PCI/MMIO devices together with USB devices in the system. Make watchdog parameter per device to avoid situation when plugin USB device change modparam_watchdog for PCI/MMIO device.

Patch applied to wireless-next.git, thanks.

62ad3b976cd7 wifi: rt2x00: make watchdog param per device

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches