aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c42
1 files changed, 7 insertions, 35 deletions
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/*