netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 21/26] rt2x00: Fix txdone race condition
Date: Sun, 3 Dec 2006 19:18:57 +0100	[thread overview]
Message-ID: <200612031918.58175.IvDoorn@gmail.com> (raw)

Always call ieee80211_wake_queue if the ring
is not full after the txrun. The ieee80211_wake_queue
is responsible for chacking if the queue was stopped
or not.
The current implementation of checking the ring_full
before the txdone run was flawed and race conditions
could occur that blocked all tx handling.

Signed-off-by Ivo van Doorn <IvDoorn@gmail.com>

---

diff -rU3 wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt2400pci.c wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
--- wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt2400pci.c	2006-12-03 15:09:41.000000000 +0100
+++ wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt2400pci.c	2006-12-03 15:14:07.000000000 +0100
@@ -1613,14 +1613,8 @@
 	u32 word;
 	int tx_status;
 	int ack;
-	int ring_full;
 	int rts;
 
-	/*
-	 * Store the current status of the ring.
-	 */
-	ring_full = rt2x00_ring_full(ring);
-
 	while (!rt2x00_ring_empty(ring)) {
 		entry = rt2x00_get_data_entry_done(ring);
 		txd = rt2x00_desc_addr(entry);
@@ -1687,7 +1681,7 @@
 	 * is reenabled when the txdone handler has finished.
 	 */
 	entry = ring->entry;
-	if (ring_full && !rt2x00_ring_full(ring))
+	if (!rt2x00_ring_full(ring))
 		ieee80211_wake_queue(rt2x00dev->hw,
 			entry->tx_status.control.queue);
 }
diff -rU3 wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt2500pci.c wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
--- wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt2500pci.c	2006-12-03 15:09:55.000000000 +0100
+++ wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt2500pci.c	2006-12-03 15:14:05.000000000 +0100
@@ -1776,14 +1776,8 @@
 	u32 word;
 	int tx_status;
 	int ack;
-	int ring_full;
 	int rts;
 
-	/*
-	 * Store the current status of the ring.
-	 */
-	ring_full = rt2x00_ring_full(ring);
-
 	while (!rt2x00_ring_empty(ring)) {
 		entry = rt2x00_get_data_entry_done(ring);
 		txd = rt2x00_desc_addr(entry);
@@ -1850,7 +1844,7 @@
 	 * is reenabled when the txdone handler has finished.
 	 */
 	entry = ring->entry;
-	if (ring_full && !rt2x00_ring_full(ring))
+	if (!rt2x00_ring_full(ring))
 		ieee80211_wake_queue(rt2x00dev->hw,
 			entry->tx_status.control.queue);
 }
diff -rU3 wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt2500usb.c wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
--- wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt2500usb.c	2006-12-03 15:10:04.000000000 +0100
+++ wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt2500usb.c	2006-12-03 15:14:10.000000000 +0100
@@ -1753,14 +1753,8 @@
 	struct urb *urb;
 	u32 word;
 	int ack;
-	int ring_full;
 	int rts;
 
-	/*
-	 * Store the current status of the ring.
-	 */
-	ring_full = rt2x00_ring_full(ring);
-
 	 while (!rt2x00_ring_empty(ring)) {
 		entry = rt2x00_get_data_entry_done(ring);
 		txd = rt2x00_txdesc_addr(entry);
@@ -1821,7 +1815,7 @@
 	 * is reenabled when the txdone handler has finished.
 	 */
 	entry = ring->entry;
-	if (ring_full && !rt2x00_ring_full(ring))
+	if (!rt2x00_ring_full(ring))
 		ieee80211_wake_queue(rt2x00dev->hw,
 			entry->tx_status.control.queue);
 }
diff -rU3 wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt61pci.c wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt61pci.c
--- wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt61pci.c	2006-12-03 15:10:28.000000000 +0100
+++ wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt61pci.c	2006-12-03 15:14:18.000000000 +0100
@@ -2235,7 +2235,6 @@
 	u32 word;
 	int tx_status;
 	int ack;
-	int ring_full;
 	int rts;
 
 	txd = rt2x00_desc_addr(entry);
@@ -2285,11 +2284,6 @@
 	CLEAR_FLAG(entry, ENTRY_RTS_FRAME);
 	entry->skb = NULL;
 
-	/*
-	 * Store the current status of the ring.
-	 */
-	ring_full = rt2x00_ring_full(entry->ring);
-
 	rt2x00_ring_index_done_inc(entry->ring);
 
 	/*
@@ -2297,7 +2291,8 @@
 	 * we must make sure the packet queue in the d80211 stack
 	 * is reenabled when the txdone handler has finished.
 	 */
-	if (ring_full && !rt2x00_ring_full(entry->ring))
+	entry = ring->entry;
+	if (!rt2x00_ring_full(ring))
 		ieee80211_wake_queue(rt2x00dev->hw,
 			entry->tx_status.control.queue);
 }
diff -rU3 wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt73usb.c wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt73usb.c
--- wireless-dev-led/drivers/net/wireless/d80211/rt2x00/rt73usb.c	2006-12-03 14:52:44.000000000 +0100
+++ wireless-dev-ringfull/drivers/net/wireless/d80211/rt2x00/rt73usb.c	2006-12-03 15:14:33.000000000 +0100
@@ -2026,14 +2026,8 @@
 	struct urb *urb;
 	u32 word;
 	int ack;
-	int ring_full;
 	int rts;
 
-	/*
-	 * Store the current status of the ring.
-	 */
-	ring_full = rt2x00_ring_full(ring);
-
 	while (!rt2x00_ring_empty(ring)) {
 		entry = rt2x00_get_data_entry_done(ring);
 		txd = rt2x00_desc_addr(entry);
@@ -2096,7 +2090,7 @@
 	 * is reenabled when the txdone handler has finished.
 	 */
 	entry = ring->entry;
-	if (ring_full && !rt2x00_ring_full(ring))
+	if (!rt2x00_ring_full(ring))
 		ieee80211_wake_queue(rt2x00dev->hw,
 			entry->tx_status.control.queue);
 }

                 reply	other threads:[~2006-12-03 18:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200612031918.58175.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linville@tuxdriver.com \
    --cc=netdev@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).