Search Linux Wireless

[PATCH] rt2x00: synchronize transmission routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux