Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c965c74b authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville
Browse files

rt2x00: Implement watchdog monitoring



Implement watchdog monitoring for USB devices (PCI support can
be added later). This will determine if URBs being uploaded to
the hardware are actually returning. Both rt2500usb and rt2800usb
have shown that URBs being uploaded can remain hanging without
being released by the hardware.
By using this watchdog, a queue can be reset when this occurs.
For rt2800usb it has been tested that the connection is preserved
even though this interruption.

Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 223dcc26
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1736,6 +1736,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
		__set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
		__set_bit(DRIVER_REQUIRE_COPY_IV, &rt2x00dev->flags);
	}
	__set_bit(DRIVER_SUPPORT_WATCHDOG, &rt2x00dev->flags);

	/*
	 * Set the rssi offset.
@@ -1772,6 +1773,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
	.rfkill_poll		= rt2500usb_rfkill_poll,
	.link_stats		= rt2500usb_link_stats,
	.reset_tuner		= rt2500usb_reset_tuner,
	.watchdog		= rt2x00usb_watchdog,
	.write_tx_desc		= rt2500usb_write_tx_desc,
	.write_beacon		= rt2500usb_write_beacon,
	.get_tx_data_len	= rt2500usb_get_tx_data_len,
+2 −0
Original line number Diff line number Diff line
@@ -633,6 +633,7 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
	if (!modparam_nohwcrypt)
		__set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
	__set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
	__set_bit(DRIVER_SUPPORT_WATCHDOG, &rt2x00dev->flags);

	/*
	 * Set the rssi offset.
@@ -655,6 +656,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
	.link_stats		= rt2800_link_stats,
	.reset_tuner		= rt2800_reset_tuner,
	.link_tuner		= rt2800_link_tuner,
	.watchdog		= rt2x00usb_watchdog,
	.write_tx_desc		= rt2800usb_write_tx_desc,
	.write_tx_data		= rt2800usb_write_tx_data,
	.write_beacon		= rt2800_write_beacon,
+7 −0
Original line number Diff line number Diff line
@@ -332,6 +332,11 @@ struct link {
	 * Work structure for scheduling periodic link tuning.
	 */
	struct delayed_work work;

	/*
	 * Work structure for scheduling periodic watchdog monitoring.
	 */
	struct delayed_work watchdog_work;
};

/*
@@ -543,6 +548,7 @@ struct rt2x00lib_ops {
			     struct link_qual *qual);
	void (*link_tuner) (struct rt2x00_dev *rt2x00dev,
			    struct link_qual *qual, const u32 count);
	void (*watchdog) (struct rt2x00_dev *rt2x00dev);

	/*
	 * TX control handlers
@@ -648,6 +654,7 @@ enum rt2x00_flags {
	DRIVER_SUPPORT_CONTROL_FILTERS,
	DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL,
	DRIVER_SUPPORT_LINK_TUNING,
	DRIVER_SUPPORT_WATCHDOG,

	/*
	 * Driver configuration
+10 −0
Original line number Diff line number Diff line
@@ -69,6 +69,11 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
	 */
	rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);

	/*
	 * Start watchdog monitoring.
	 */
	rt2x00link_start_watchdog(rt2x00dev);

	/*
	 * Start the TX queues.
	 */
@@ -88,6 +93,11 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
	ieee80211_stop_queues(rt2x00dev->hw);
	rt2x00queue_stop_queues(rt2x00dev);

	/*
	 * Stop watchdog monitoring.
	 */
	rt2x00link_stop_watchdog(rt2x00dev);

	/*
	 * Disable RX.
	 */
+23 −3
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
/*
 * Interval defines
 */
#define WATCHDOG_INTERVAL	round_jiffies_relative(HZ)
#define LINK_TUNE_INTERVAL	round_jiffies_relative(HZ)

/*
@@ -257,11 +258,30 @@ void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev);
void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna);

/**
 * rt2x00link_register - Initialize link tuning functionality
 * rt2x00link_start_watchdog - Start periodic watchdog monitoring
 * @rt2x00dev: Pointer to &struct rt2x00_dev.
 *
 * Initialize work structure and all link tuning related
 * parameters. This will not start the link tuning process itself.
 * This start the watchdog periodic work, this work will
 *be executed periodically until &rt2x00link_stop_watchdog has
 * been called.
 */
void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev);

/**
 * rt2x00link_stop_watchdog - Stop periodic watchdog monitoring
 * @rt2x00dev: Pointer to &struct rt2x00_dev.
 *
 * After this function completed the watchdog monitoring will not
 * be running until &rt2x00link_start_watchdog is called.
 */
void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev);

/**
 * rt2x00link_register - Initialize link tuning & watchdog functionality
 * @rt2x00dev: Pointer to &struct rt2x00_dev.
 *
 * Initialize work structure and all link tuning and watchdog related
 * parameters. This will not start the periodic work itself.
 */
void rt2x00link_register(struct rt2x00_dev *rt2x00dev);

Loading