linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: ath9k-devel@venema.h4ckr.net, Ben Greear <greearb@candelatech.com>
Subject: [PATCH 2/2] ath9k:  Fix incorrect tx-hang detection logic.
Date: Fri,  7 Jan 2011 10:00:59 -0800	[thread overview]
Message-ID: <1294423259-8163-2-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1294423259-8163-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

It is not guaranteed that the ath_tx_complete_poll_work runs
after some fixed duration because the channel-reset logic
removes the work and then re-adds it to run immediately.
Two channel-changes 1ms apart, with a transmit was being
attempted, could thus incorrectly trigger a reset by
the ath_tx_complete_poll_work method.

Add a jiffies timestamp to ensure that at least 1 second
has elapsed before triggering the reset.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 3f5c513... 93209d6... M	drivers/net/wireless/ath/ath9k/ath9k.h
:100644 100644 3aae523... e63de71... M	drivers/net/wireless/ath/ath9k/xmit.c
 drivers/net/wireless/ath/ath9k/ath9k.h |    1 +
 drivers/net/wireless/ath/ath9k/xmit.c  |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

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);
 }
 
 
-- 
1.7.2.3


  reply	other threads:[~2011-01-07 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07 18:00 [PATCH 1/2] ath9k: More xmit queue debugfs information greearb
2011-01-07 18:00 ` greearb [this message]
2011-01-10  5:38   ` [PATCH 2/2] ath9k: Fix incorrect tx-hang detection logic Vasanthakumar Thiagarajan
2011-01-10  5:48     ` Ben Greear

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294423259-8163-2-git-send-email-greearb@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=ath9k-devel@venema.h4ckr.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).