linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jordi Pujol <jordipujolp@gmail.com>
To: linux-wireless@vger.kernel.org
Subject: [PATCH] rt2x00: synchronize transmission routines
Date: Sun, 13 Feb 2011 15:31:29 +0100	[thread overview]
Message-ID: <201102131531.29984.jordipujolp@gmail.com> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 2365 bytes --]

Hello,

This patch will synchronize the transmission routines of rt2x00lib to avoid 
processing interferences in systems with multiple execution threads.
Has been tested on an AMD 64 X2 6000 running Debian unstable
and a custom x86_64 kernel at version 2.6.37
The Wireless adapter is a D-Link USB,
 ID 07d1:3c03 D-Link System AirPlus G DWL-G122 Wireless Adapter(rev.C1) 
[Ralink RT73]

Now It works a lot better.

*** BEGIN PATCH
 rt2x00: synchonize transmission_done routines

Signed-off-by: Jordi Pujol <jordipujolp AT gmail DOT com>

--- linux-2.6.37-old/drivers/net/wireless/rt2x00/rt2x00dev.c	2011-01-05 
01:50:19.000000000 +0100
+++ linux-2.6.37/drivers/net/wireless/rt2x00/rt2x00dev.c	2011-02-12 
14:59:58.043409531 +0100
@@ -258,6 +258,11 @@ void rt2x00lib_dmadone(struct queue_entr
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_dmadone);
 
+/*
+ * rt2x00lib_txdone_mutex: synchonize rt2x00lib_txdone
+ */
+static DEFINE_MUTEX(rt2x00lib_txdone_mutex);
+
 void rt2x00lib_txdone(struct queue_entry *entry,
 		      struct txdone_entry_desc *txdesc)
 {
@@ -271,6 +276,8 @@ void rt2x00lib_txdone(struct queue_entry
 	unsigned int i;
 	bool success;
 
+	mutex_lock(&rt2x00lib_txdone_mutex);
+
 	/*
 	 * Unmap the skb.
 	 */
@@ -415,6 +422,8 @@ void rt2x00lib_txdone(struct queue_entry
 	 */
 	if (!rt2x00queue_threshold(entry->queue))
 		ieee80211_wake_queue(rt2x00dev->hw, qid);
+
+	mutex_unlock(&rt2x00lib_txdone_mutex);
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
 
@@ -486,6 +486,11 @@ static int rt2x00lib_rxdone_read_signal(
 	return 0;
 }
 
+/*
+ * rt2x00lib_rxdone_mutex: synchonize rt2x00lib_rxdone
+ */
+static DEFINE_MUTEX(rt2x00lib_rxdone_mutex);
+
 void rt2x00lib_rxdone(struct queue_entry *entry)
 {
 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
@@ -495,6 +500,8 @@ void rt2x00lib_rxdone(struct queue_entry
 	unsigned int header_length;
 	int rate_idx;
 
+	mutex_lock(&rt2x00lib_rxdone_mutex);
+
 	if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
 		goto submit_entry;
 
@@ -582,6 +589,8 @@ submit_entry:
 	rt2x00dev->ops->lib->clear_entry(entry);
 	rt2x00queue_index_inc(entry->queue, Q_INDEX);
 	rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
+
+	mutex_unlock(&rt2x00lib_rxdone_mutex);
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_rxdone);
 
*** END PATCH

Kind regards,

Jordi Pujol

Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com

[-- Attachment #2: rt2x00lib_transmission_done_synchronize.patch --]
[-- Type: text/x-patch, Size: 1817 bytes --]

 rt2x00: synchonize transmission_done routines

Signed-off-by: Jordi Pujol <jordipujolp AT gmail DOT com>

--- linux-2.6.37-old/drivers/net/wireless/rt2x00/rt2x00dev.c	2011-01-05 01:50:19.000000000 +0100
+++ linux-2.6.37/drivers/net/wireless/rt2x00/rt2x00dev.c	2011-02-12 14:59:58.043409531 +0100
@@ -258,6 +258,11 @@ void rt2x00lib_dmadone(struct queue_entr
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_dmadone);
 
+/*
+ * rt2x00lib_txdone_mutex: synchonize rt2x00lib_txdone
+ */
+static DEFINE_MUTEX(rt2x00lib_txdone_mutex);
+
 void rt2x00lib_txdone(struct queue_entry *entry,
 		      struct txdone_entry_desc *txdesc)
 {
@@ -271,6 +276,8 @@ void rt2x00lib_txdone(struct queue_entry
 	unsigned int i;
 	bool success;
 
+	mutex_lock(&rt2x00lib_txdone_mutex);
+
 	/*
 	 * Unmap the skb.
 	 */
@@ -415,6 +422,8 @@ void rt2x00lib_txdone(struct queue_entry
 	 */
 	if (!rt2x00queue_threshold(entry->queue))
 		ieee80211_wake_queue(rt2x00dev->hw, qid);
+
+	mutex_unlock(&rt2x00lib_txdone_mutex);
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
 
@@ -486,6 +486,11 @@ static int rt2x00lib_rxdone_read_signal(
 	return 0;
 }
 
+/*
+ * rt2x00lib_rxdone_mutex: synchonize rt2x00lib_rxdone
+ */
+static DEFINE_MUTEX(rt2x00lib_rxdone_mutex);
+
 void rt2x00lib_rxdone(struct queue_entry *entry)
 {
 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
@@ -495,6 +500,8 @@ void rt2x00lib_rxdone(struct queue_entry
 	unsigned int header_length;
 	int rate_idx;
 
+	mutex_lock(&rt2x00lib_rxdone_mutex);
+
 	if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
 		goto submit_entry;
 
@@ -582,6 +589,8 @@ submit_entry:
 	rt2x00dev->ops->lib->clear_entry(entry);
 	rt2x00queue_index_inc(entry->queue, Q_INDEX);
 	rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
+
+	mutex_unlock(&rt2x00lib_rxdone_mutex);
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_rxdone);
 

             reply	other threads:[~2011-02-13 14:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13 14:31 Jordi Pujol [this message]
2011-02-14  8:43 ` [PATCH] rt2x00: synchronize transmission routines Jordi Pujol
2011-02-14  8:51   ` Ivo Van Doorn
2011-02-14  9:47     ` Jordi Pujol
2011-02-14  9:54       ` Ivo Van Doorn
2011-02-14 10:57         ` Jordi Pujol
2011-02-14 11:44           ` Ivo Van Doorn
2011-02-14 13:20           ` Jordi Pujol

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=201102131531.29984.jordipujolp@gmail.com \
    --to=jordipujolp@gmail.com \
    --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).