aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-06-16 13:56:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-26 16:49:16 -0400
commitd74f5ba473b915e5d4ea1ed391984bb62d9de8b1 (patch)
tree93e1a847c61b053096657b132034c7df86a13bfa /drivers/net/wireless
parentc4da004857056e6ee034c4110ccdcba659077b7e (diff)
rt2x00: Cleanup symbol exports
With a bit of code moving to rt2x00lib within the TX and RX paths we can now remove a lot of EXPORT_SYMBOL_GPL() statements. This cleans up the interface between rt2x00lib and the drivers and has the additional benefit that rt2x00pci and rt2x00usb are trimmed down in size as well since they have less to do. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h34
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c29
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h51
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c49
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.h9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c15
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c42
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
11 files changed, 102 insertions, 137 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index de2dd336f23d..b3dffcfed835 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1154,7 +1154,7 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev,
1154 } 1154 }
1155 txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); 1155 txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT);
1156 1156
1157 rt2x00pci_txdone(rt2x00dev, entry, &txdesc); 1157 rt2x00lib_txdone(entry, &txdesc);
1158 } 1158 }
1159} 1159}
1160 1160
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 5077b62dcc5a..0423c251c78e 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1312,7 +1312,7 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev,
1312 } 1312 }
1313 txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); 1313 txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT);
1314 1314
1315 rt2x00pci_txdone(rt2x00dev, entry, &txdesc); 1315 rt2x00lib_txdone(entry, &txdesc);
1316 } 1316 }
1317} 1317}
1318 1318
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 28c9026bb568..94b7c9bd09e5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -900,14 +900,6 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)
900} 900}
901 901
902/** 902/**
903 * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes.
904 * @rt2x00dev: Pointer to &struct rt2x00_dev.
905 * @queue: The queue for which the skb will be applicable.
906 */
907struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,
908 struct queue_entry *entry);
909
910/**
911 * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. 903 * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
912 * @rt2x00dev: Pointer to &struct rt2x00_dev. 904 * @rt2x00dev: Pointer to &struct rt2x00_dev.
913 * @skb: The skb to map. 905 * @skb: The skb to map.
@@ -915,20 +907,6 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,
915void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); 907void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
916 908
917/** 909/**
918 * rt2x00queue_unmap_skb - Unmap a skb from DMA.
919 * @rt2x00dev: Pointer to &struct rt2x00_dev.
920 * @skb: The skb to unmap.
921 */
922void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
923
924/**
925 * rt2x00queue_free_skb - free a skb
926 * @rt2x00dev: Pointer to &struct rt2x00_dev.
927 * @skb: The skb to free.
928 */
929void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
930
931/**
932 * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input 910 * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input
933 * @entry: The entry which will be used to transfer the TX frame. 911 * @entry: The entry which will be used to transfer the TX frame.
934 * @txdesc: rt2x00 TX descriptor which will be initialized by this function. 912 * @txdesc: rt2x00 TX descriptor which will be initialized by this function.
@@ -977,18 +955,6 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
977struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, 955struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,
978 enum queue_index index); 956 enum queue_index index);
979 957
980/**
981 * rt2x00queue_index_inc - Index incrementation function
982 * @queue: Queue (&struct data_queue) to perform the action on.
983 * @index: Index type (&enum queue_index) to perform the action on.
984 *
985 * This function will increase the requested index on the queue,
986 * it will grab the appropriate locks and handle queue overflow events by
987 * resetting the index to the start of the queue.
988 */
989void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index);
990
991
992/* 958/*
993 * Interrupt context handlers. 959 * Interrupt context handlers.
994 */ 960 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 99b14ba99d97..2a63a7b911b4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -504,6 +504,12 @@ void rt2x00lib_txdone(struct queue_entry *entry,
504{ 504{
505 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 505 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
506 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); 506 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
507 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
508
509 /*
510 * Unmap the skb.
511 */
512 rt2x00queue_unmap_skb(rt2x00dev, entry->skb);
507 513
508 /* 514 /*
509 * Send frame to debugfs immediately, after this call is completed 515 * Send frame to debugfs immediately, after this call is completed
@@ -552,7 +558,25 @@ void rt2x00lib_txdone(struct queue_entry *entry,
552 ieee80211_tx_status_irqsafe(rt2x00dev->hw, entry->skb); 558 ieee80211_tx_status_irqsafe(rt2x00dev->hw, entry->skb);
553 else 559 else
554 dev_kfree_skb_irq(entry->skb); 560 dev_kfree_skb_irq(entry->skb);
561
562 /*
563 * Make this entry available for reuse.
564 */
555 entry->skb = NULL; 565 entry->skb = NULL;
566 entry->flags = 0;
567
568 rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry);
569
570 __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
571 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
572
573 /*
574 * If the data queue was below the threshold before the txdone
575 * handler we must make sure the packet queue in the mac80211 stack
576 * is reenabled when the txdone handler has finished.
577 */
578 if (!rt2x00queue_threshold(entry->queue))
579 ieee80211_wake_queue(rt2x00dev->hw, qid);
556} 580}
557EXPORT_SYMBOL_GPL(rt2x00lib_txdone); 581EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
558 582
@@ -657,6 +681,11 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
657 * Replace the skb with the freshly allocated one. 681 * Replace the skb with the freshly allocated one.
658 */ 682 */
659 entry->skb = skb; 683 entry->skb = skb;
684 entry->flags = 0;
685
686 rt2x00dev->ops->lib->init_rxentry(rt2x00dev, entry);
687
688 rt2x00queue_index_inc(entry->queue, Q_INDEX);
660} 689}
661EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); 690EXPORT_SYMBOL_GPL(rt2x00lib_rxdone);
662 691
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 558f45bf27e3..1d1f0749375e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -98,10 +98,57 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
98void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 98void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
99 struct ieee80211_conf *conf, const int force_config); 99 struct ieee80211_conf *conf, const int force_config);
100 100
101/* 101/**
102 * Queue handlers. 102 * DOC: Queue handlers
103 */
104
105/**
106 * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes.
107 * @rt2x00dev: Pointer to &struct rt2x00_dev.
108 * @queue: The queue for which the skb will be applicable.
109 */
110struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,
111 struct queue_entry *entry);
112
113/**
114 * rt2x00queue_unmap_skb - Unmap a skb from DMA.
115 * @rt2x00dev: Pointer to &struct rt2x00_dev.
116 * @skb: The skb to unmap.
117 */
118void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
119
120/**
121 * rt2x00queue_free_skb - free a skb
122 * @rt2x00dev: Pointer to &struct rt2x00_dev.
123 * @skb: The skb to free.
124 */
125void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
126
127/**
128 * rt2x00queue_free_skb - free a skb
129 * @rt2x00dev: Pointer to &struct rt2x00_dev.
130 * @skb: The skb to free.
131 */
132void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
133
134/**
135 * rt2x00queue_write_tx_frame - Write TX frame to hardware
136 * @queue: Queue over which the frame should be send
137 * @skb: The skb to send
103 */ 138 */
104int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb); 139int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb);
140
141/**
142 * rt2x00queue_index_inc - Index incrementation function
143 * @queue: Queue (&struct data_queue) to perform the action on.
144 * @index: Index type (&enum queue_index) to perform the action on.
145 *
146 * This function will increase the requested index on the queue,
147 * it will grab the appropriate locks and handle queue overflow events by
148 * resetting the index to the start of the queue.
149 */
150void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index);
151
105void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev); 152void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev);
106void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev); 153void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev);
107int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev); 154int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index f9d0d76f8706..adf2876ed8ab 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -60,12 +60,8 @@ int rt2x00pci_write_tx_data(struct queue_entry *entry)
60 * Fill in skb descriptor 60 * Fill in skb descriptor
61 */ 61 */
62 skbdesc = get_skb_frame_desc(entry->skb); 62 skbdesc = get_skb_frame_desc(entry->skb);
63 memset(skbdesc, 0, sizeof(*skbdesc));
64 skbdesc->desc = entry_priv->desc; 63 skbdesc->desc = entry_priv->desc;
65 skbdesc->desc_len = entry->queue->desc_size; 64 skbdesc->desc_len = entry->queue->desc_size;
66 skbdesc->entry = entry;
67
68 rt2x00queue_map_txskb(entry->queue->rt2x00dev, entry->skb);
69 65
70 return 0; 66 return 0;
71} 67}
@@ -101,55 +97,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
101 * Send the frame to rt2x00lib for further processing. 97 * Send the frame to rt2x00lib for further processing.
102 */ 98 */
103 rt2x00lib_rxdone(rt2x00dev, entry); 99 rt2x00lib_rxdone(rt2x00dev, entry);
104
105 /*
106 * Reset the RXD for this entry.
107 */
108 rt2x00dev->ops->lib->init_rxentry(rt2x00dev, entry);
109
110 rt2x00queue_index_inc(queue, Q_INDEX);
111 } 100 }
112} 101}
113EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); 102EXPORT_SYMBOL_GPL(rt2x00pci_rxdone);
114 103
115void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry,
116 struct txdone_entry_desc *txdesc)
117{
118 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
119 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
120 u32 word;
121
122 /*
123 * Unmap the skb.
124 */
125 rt2x00queue_unmap_skb(rt2x00dev, entry->skb);
126
127 rt2x00lib_txdone(entry, txdesc);
128
129 /*
130 * Make this entry available for reuse.
131 */
132 entry->flags = 0;
133
134 rt2x00_desc_read(entry_priv->desc, 0, &word);
135 rt2x00_set_field32(&word, TXD_ENTRY_OWNER_NIC, 0);
136 rt2x00_set_field32(&word, TXD_ENTRY_VALID, 0);
137 rt2x00_desc_write(entry_priv->desc, 0, word);
138
139 __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
140 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
141
142 /*
143 * If the data queue was below the threshold before the txdone
144 * handler we must make sure the packet queue in the mac80211 stack
145 * is reenabled when the txdone handler has finished.
146 */
147 if (!rt2x00queue_threshold(entry->queue))
148 ieee80211_wake_queue(rt2x00dev->hw, qid);
149
150}
151EXPORT_SYMBOL_GPL(rt2x00pci_txdone);
152
153/* 104/*
154 * Device initialization handlers. 105 * Device initialization handlers.
155 */ 106 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h
index 7e5708dca731..50c6df4f81db 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.h
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.h
@@ -115,15 +115,6 @@ struct queue_entry_priv_pci {
115 */ 115 */
116void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); 116void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev);
117 117
118/**
119 * rt2x00pci_txdone - Handle TX done events
120 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
121 * @entry: Entry which has completed the transmission of a frame.
122 * @desc: TX done descriptor
123 */
124void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry,
125 struct txdone_entry_desc *desc);
126
127/* 118/*
128 * Device initialization handlers. 119 * Device initialization handlers.
129 */ 120 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 29d2b9128533..49d3bb84ab6b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -77,7 +77,6 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,
77 77
78 return skb; 78 return skb;
79} 79}
80EXPORT_SYMBOL_GPL(rt2x00queue_alloc_rxskb);
81 80
82void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) 81void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
83{ 82{
@@ -105,7 +104,6 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
105 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; 104 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
106 } 105 }
107} 106}
108EXPORT_SYMBOL_GPL(rt2x00queue_unmap_skb);
109 107
110void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) 108void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
111{ 109{
@@ -123,7 +121,6 @@ void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
123 121
124 dev_kfree_skb_any(skb); 122 dev_kfree_skb_any(skb);
125} 123}
126EXPORT_SYMBOL_GPL(rt2x00queue_free_skb);
127 124
128void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, 125void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
129 struct txentry_desc *txdesc) 126 struct txentry_desc *txdesc)
@@ -289,6 +286,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
289{ 286{
290 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); 287 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
291 struct txentry_desc txdesc; 288 struct txentry_desc txdesc;
289 struct skb_frame_desc *skbdesc;
292 290
293 if (unlikely(rt2x00queue_full(queue))) 291 if (unlikely(rt2x00queue_full(queue)))
294 return -EINVAL; 292 return -EINVAL;
@@ -309,11 +307,21 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
309 entry->skb = skb; 307 entry->skb = skb;
310 rt2x00queue_create_tx_descriptor(entry, &txdesc); 308 rt2x00queue_create_tx_descriptor(entry, &txdesc);
311 309
310 /*
311 * skb->cb array is now ours and we are free to use it.
312 */
313 skbdesc = get_skb_frame_desc(entry->skb);
314 memset(skbdesc, 0, sizeof(*skbdesc));
315 skbdesc->entry = entry;
316
312 if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) { 317 if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) {
313 __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); 318 __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
314 return -EIO; 319 return -EIO;
315 } 320 }
316 321
322 if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
323 rt2x00queue_map_txskb(queue->rt2x00dev, skb);
324
317 __set_bit(ENTRY_DATA_PENDING, &entry->flags); 325 __set_bit(ENTRY_DATA_PENDING, &entry->flags);
318 326
319 rt2x00queue_index_inc(queue, Q_INDEX); 327 rt2x00queue_index_inc(queue, Q_INDEX);
@@ -389,7 +397,6 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index)
389 397
390 spin_unlock_irqrestore(&queue->lock, irqflags); 398 spin_unlock_irqrestore(&queue->lock, irqflags);
391} 399}
392EXPORT_SYMBOL_GPL(rt2x00queue_index_inc);
393 400
394static void rt2x00queue_reset(struct data_queue *queue) 401static void rt2x00queue_reset(struct data_queue *queue)
395{ 402{
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 192b6e789a7f..14ce8d4e1397 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -82,6 +82,8 @@ enum data_queue_qid {
82/** 82/**
83 * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc 83 * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc
84 * 84 *
85 * @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX
86 * @SKBDESC_DMA_MAPPED_TX: &skb_dma field has been mapped for TX
85 */ 87 */
86enum skb_frame_desc_flags { 88enum skb_frame_desc_flags {
87 SKBDESC_DMA_MAPPED_RX = (1 << 0), 89 SKBDESC_DMA_MAPPED_RX = (1 << 0),
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 552f0e94f800..b94c461fbaf9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -131,10 +131,9 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
131 struct queue_entry *entry = (struct queue_entry *)urb->context; 131 struct queue_entry *entry = (struct queue_entry *)urb->context;
132 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 132 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
133 struct txdone_entry_desc txdesc; 133 struct txdone_entry_desc txdesc;
134 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
135 134
136 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 135 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
137 !__test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 136 !test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
138 return; 137 return;
139 138
140 /* 139 /*
@@ -158,20 +157,6 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
158 txdesc.retry = 0; 157 txdesc.retry = 0;
159 158
160 rt2x00lib_txdone(entry, &txdesc); 159 rt2x00lib_txdone(entry, &txdesc);
161
162 /*
163 * Make this entry available for reuse.
164 */
165 entry->flags = 0;
166 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
167
168 /*
169 * If the data queue was below the threshold before the txdone
170 * handler we must make sure the packet queue in the mac80211 stack
171 * is reenabled when the txdone handler has finished.
172 */
173 if (!rt2x00queue_threshold(entry->queue))
174 ieee80211_wake_queue(rt2x00dev->hw, qid);
175} 160}
176 161
177int rt2x00usb_write_tx_data(struct queue_entry *entry) 162int rt2x00usb_write_tx_data(struct queue_entry *entry)
@@ -193,10 +178,8 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry)
193 * Fill in skb descriptor 178 * Fill in skb descriptor
194 */ 179 */
195 skbdesc = get_skb_frame_desc(entry->skb); 180 skbdesc = get_skb_frame_desc(entry->skb);
196 memset(skbdesc, 0, sizeof(*skbdesc));
197 skbdesc->desc = entry->skb->data; 181 skbdesc->desc = entry->skb->data;
198 skbdesc->desc_len = entry->queue->desc_size; 182 skbdesc->desc_len = entry->queue->desc_size;
199 skbdesc->entry = entry;
200 183
201 /* 184 /*
202 * USB devices cannot blindly pass the skb->len as the 185 * USB devices cannot blindly pass the skb->len as the
@@ -270,7 +253,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
270 u8 rxd[32]; 253 u8 rxd[32];
271 254
272 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 255 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
273 !test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 256 !test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
274 return; 257 return;
275 258
276 /* 259 /*
@@ -278,8 +261,11 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
278 * to be actually valid, or if the urb is signaling 261 * to be actually valid, or if the urb is signaling
279 * a problem. 262 * a problem.
280 */ 263 */
281 if (urb->actual_length < entry->queue->desc_size || urb->status) 264 if (urb->actual_length < entry->queue->desc_size || urb->status) {
282 goto skip_entry; 265 __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
266 usb_submit_urb(urb, GFP_ATOMIC);
267 return;
268 }
283 269
284 /* 270 /*
285 * Fill in desc fields of the skb descriptor 271 * Fill in desc fields of the skb descriptor
@@ -291,20 +277,6 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
291 * Send the frame to rt2x00lib for further processing. 277 * Send the frame to rt2x00lib for further processing.
292 */ 278 */
293 rt2x00lib_rxdone(rt2x00dev, entry); 279 rt2x00lib_rxdone(rt2x00dev, entry);
294
295 /*
296 * Reinitialize the urb.
297 */
298 urb->transfer_buffer = entry->skb->data;
299 urb->transfer_buffer_length = entry->skb->len;
300
301skip_entry:
302 if (test_bit(DEVICE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags)) {
303 __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
304 usb_submit_urb(urb, GFP_ATOMIC);
305 }
306
307 rt2x00queue_index_inc(entry->queue, Q_INDEX);
308} 280}
309 281
310/* 282/*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index c9f6d4844139..bbf1048f6400 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1767,7 +1767,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1767 __set_bit(TXDONE_UNKNOWN, &txdesc.flags); 1767 __set_bit(TXDONE_UNKNOWN, &txdesc.flags);
1768 txdesc.retry = 0; 1768 txdesc.retry = 0;
1769 1769
1770 rt2x00pci_txdone(rt2x00dev, entry_done, &txdesc); 1770 rt2x00lib_txdone(entry_done, &txdesc);
1771 entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); 1771 entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
1772 } 1772 }
1773 1773
@@ -1787,7 +1787,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1787 } 1787 }
1788 txdesc.retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT); 1788 txdesc.retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT);
1789 1789
1790 rt2x00pci_txdone(rt2x00dev, entry, &txdesc); 1790 rt2x00lib_txdone(entry, &txdesc);
1791 } 1791 }
1792} 1792}
1793 1793