linux-wireless.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: linux-wireless@vger.kernel.org, rt2400-devel@lists.sourceforge.net
Subject: [PATCH 02/12] rt2x00: Always call ieee80211_stop_queue() when return NETDEV_TX_BUSY
Date: Sun, 6 Jan 2008 23:38:34 +0100	[thread overview]
Message-ID: <200801062338.34687.IvDoorn@gmail.com> (raw)
In-Reply-To: <200801062337.35904.IvDoorn@gmail.com>

Apparently it was possible that ieee80211_stop_queue() was not full while
NETDEV_TX_BUSY was being reported back. I think that is what causing the WARN_ON().
This moves all calls to ieee80211_stop_queue() in rt2x00mac.c where it is easier
to determine if the queue should be halted.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2x00mac.c |   17 +++++++++++++----
 drivers/net/wireless/rt2x00/rt2x00pci.c |    8 +-------
 drivers/net/wireless/rt2x00/rt2x00usb.c |    8 +-------
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 86b6a33..978cffb 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -84,7 +84,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
 	 */
 	if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) {
 		ieee80211_stop_queues(hw);
-		return 0;
+		return NETDEV_TX_OK;
 	}
 
 	/*
@@ -110,15 +110,24 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
 	if (!is_rts_frame(frame_control) && !is_cts_frame(frame_control) &&
 	    (control->flags & (IEEE80211_TXCTL_USE_RTS_CTS |
 			       IEEE80211_TXCTL_USE_CTS_PROTECT))) {
-		if (rt2x00_ring_free(ring) <= 1)
+		if (rt2x00_ring_free(ring) <= 1) {
+			ieee80211_stop_queue(rt2x00dev->hw, control->queue);
 			return NETDEV_TX_BUSY;
+		}
 
-		if (rt2x00mac_tx_rts_cts(rt2x00dev, ring, skb, control))
+		if (rt2x00mac_tx_rts_cts(rt2x00dev, ring, skb, control)) {
+			ieee80211_stop_queue(rt2x00dev->hw, control->queue);
 			return NETDEV_TX_BUSY;
+		}
 	}
 
-	if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, ring, skb, control))
+	if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, ring, skb, control)) {
+		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
 		return NETDEV_TX_BUSY;
+	}
+
+	if (rt2x00_ring_full(ring))
+		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
 
 	if (rt2x00dev->ops->lib->kick_tx_queue)
 		rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue);
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index abeffdb..70cb81c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -86,10 +86,8 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
 	struct skb_desc *desc;
 	u32 word;
 
-	if (rt2x00_ring_full(ring)) {
-		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
+	if (rt2x00_ring_full(ring))
 		return -EINVAL;
-	}
 
 	rt2x00_desc_read(txd, 0, &word);
 
@@ -99,7 +97,6 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
 		      "Arrived at non-free entry in the non-full queue %d.\n"
 		      "Please file bug report to %s.\n",
 		      control->queue, DRV_PROJECT);
-		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
 		return -EINVAL;
 	}
 
@@ -119,9 +116,6 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
 
 	rt2x00_ring_index_inc(ring);
 
-	if (rt2x00_ring_full(ring))
-		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data);
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 82e95b9..7aba357 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -179,17 +179,14 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
 	struct skb_desc *desc;
 	u32 length;
 
-	if (rt2x00_ring_full(ring)) {
-		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
+	if (rt2x00_ring_full(ring))
 		return -EINVAL;
-	}
 
 	if (test_bit(ENTRY_OWNER_NIC, &entry->flags)) {
 		ERROR(rt2x00dev,
 		      "Arrived at non-free entry in the non-full queue %d.\n"
 		      "Please file bug report to %s.\n",
 		      control->queue, DRV_PROJECT);
-		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
 		return -EINVAL;
 	}
 
@@ -229,9 +226,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
 
 	rt2x00_ring_index_inc(ring);
 
-	if (rt2x00_ring_full(ring))
-		ieee80211_stop_queue(rt2x00dev->hw, control->queue);
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data);
-- 
1.5.3.7


  parent reply	other threads:[~2008-01-06 22:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-06 22:37 Please pull 'upstream' branch of rt2x00 Ivo van Doorn
2008-01-06 22:38 ` [PATCH 01/12] rt2x00: Fix chipset debugfs file Ivo van Doorn
2008-01-06 22:38 ` Ivo van Doorn [this message]
2008-01-06 22:38 ` [PATCH 03/12] rt2x00: Only set the TBCN flag when the interface is configured to send beacons Ivo van Doorn
2008-01-06 22:39 ` [PATCH 04/12] rt2x00: Store queue idx and entry idx in data_ring and data_entry Ivo van Doorn
2008-01-06 22:40 ` [PATCH 05/12] rt2x00: Move start() and stop() handlers into rt2x00lib.c Ivo van Doorn
2008-01-06 22:40 ` [PATCH 06/12] rt2x00: Put 802.11 data on 4 byte boundary Ivo van Doorn
2008-01-11  0:32   ` Johannes Berg
2008-01-11 19:51     ` Ivo van Doorn
2008-01-06 22:40 ` [PATCH 07/12] rt2x00: Move packet filter flags Ivo van Doorn
2008-01-06 22:41 ` [PATCH 08/12] rt2x00: Cleanup write_tx_desc() arguments Ivo van Doorn
2008-01-06 22:41 ` [PATCH 09/12] rt2x00: Determine MY_BSS from descriptor Ivo van Doorn
2008-01-06 22:41 ` [PATCH 10/12] rt2x00: Move init_txring and init_rxring into rt2x00lib Ivo van Doorn
2008-01-06 22:42 ` [PATCH 11/12] rt2x00: Correctly initialize data and desc pointer Ivo van Doorn
2008-01-06 22:42 ` [PATCH 12/12] rt2x00: Release rt2x00 2.0.14 Ivo van Doorn
2008-01-10 11:52 ` [Rt2400-devel] Please pull 'upstream' branch of rt2x00 Will Dyson
2008-01-10 15:46   ` John W. Linville
2008-01-10 17:29     ` Ivo van Doorn
2008-01-15  0:44     ` Will Dyson
2008-01-10 17:29   ` Ivo van Doorn
2008-01-10 20:32   ` Stefan Lippers-Hollmann

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=200801062338.34687.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rt2400-devel@lists.sourceforge.net \
    /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).