diff mbox

[2/2] ath9k: Fix incorrect tx-hang detection logic.

Message ID 1294423259-8163-2-git-send-email-greearb@candelatech.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ben Greear Jan. 7, 2011, 6 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 3f5c513..93209d6 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -190,6 +190,7 @@  struct ath_txq {
 	spinlock_t axq_lock;
 	u32 axq_depth;
 	u32 axq_ampdu_depth;
+	unsigned long start_tx_timer; /* jiffies */
 	bool stopped;
 	bool axq_tx_inprogress;
 	struct list_head axq_acq;
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 3aae523..e63de71 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2097,6 +2097,7 @@  static void ath_tx_complete_poll_work(struct work_struct *work)
 	struct ath_txq *txq;
 	int i;
 	bool needreset = false;
+	unsigned long timeout = msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT);
 
 	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
 		if (ATH_TXQ_SETUP(sc, i)) {
@@ -2104,11 +2105,16 @@  static void ath_tx_complete_poll_work(struct work_struct *work)
 			spin_lock_bh(&txq->axq_lock);
 			if (txq->axq_depth) {
 				if (txq->axq_tx_inprogress) {
-					needreset = true;
-					spin_unlock_bh(&txq->axq_lock);
-					break;
+					if (time_after_eq(jiffies,
+							  txq->start_tx_timer +
+							  timeout)) {
+						needreset = true;
+						spin_unlock_bh(&txq->axq_lock);
+						break;
+					}
 				} else {
 					txq->axq_tx_inprogress = true;
+					txq->start_tx_timer = jiffies;
 				}
 			}
 			spin_unlock_bh(&txq->axq_lock);
@@ -2122,8 +2128,7 @@  static void ath_tx_complete_poll_work(struct work_struct *work)
 		ath9k_ps_restore(sc);
 	}
 
-	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
-			msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT));
+	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, timeout);
 }