diff options
author | Ivo van Doorn <IvDoorn@gmail.com> | 2008-06-06 16:47:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:17:56 -0400 |
commit | f019d51410a9b61278eeff811a1ca11d2a905241 (patch) | |
tree | 3f038d3e8b7301c33df31344307c7a3180227e51 /drivers/net/wireless/rt2x00/rt2x00usb.c | |
parent | 565a019ac635d4f5140a8c4da21387c3b2b28fb9 (diff) |
rt2x00: Implement rt2x00usb_kick_tx_queue()
rt2x00usb_kick_tx_queue() will loop over all entries
within the INDEX_DONE->INDEX range and kick each entry
which is pending to be kicked. This makes the kick_tx_queue
approach work the same as with the PCI drivers which
will allow for more code generalisation into rt2x00lib.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 66f15e6c7d25..cdac9280fe42 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -232,9 +232,10 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
232 | * Initialize URB and send the frame to the device. | 232 | * Initialize URB and send the frame to the device. |
233 | */ | 233 | */ |
234 | __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | 234 | __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
235 | __set_bit(ENTRY_DATA_PENDING, &entry->flags); | ||
236 | |||
235 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, usb_sndbulkpipe(usb_dev, 1), | 237 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, usb_sndbulkpipe(usb_dev, 1), |
236 | skb->data, length, rt2x00usb_interrupt_txdone, entry); | 238 | skb->data, length, rt2x00usb_interrupt_txdone, entry); |
237 | usb_submit_urb(entry_priv->urb, GFP_ATOMIC); | ||
238 | 239 | ||
239 | rt2x00queue_index_inc(queue, Q_INDEX); | 240 | rt2x00queue_index_inc(queue, Q_INDEX); |
240 | 241 | ||
@@ -242,6 +243,51 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
242 | } | 243 | } |
243 | EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data); | 244 | EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data); |
244 | 245 | ||
246 | static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry) | ||
247 | { | ||
248 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | ||
249 | |||
250 | if (__test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) | ||
251 | usb_submit_urb(entry_priv->urb, GFP_ATOMIC); | ||
252 | } | ||
253 | |||
254 | void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
255 | const enum data_queue_qid qid) | ||
256 | { | ||
257 | struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, qid); | ||
258 | unsigned long irqflags; | ||
259 | unsigned int index; | ||
260 | unsigned int index_done; | ||
261 | unsigned int i; | ||
262 | |||
263 | /* | ||
264 | * Only protect the range we are going to loop over, | ||
265 | * if during our loop a extra entry is set to pending | ||
266 | * it should not be kicked during this run, since it | ||
267 | * is part of another TX operation. | ||
268 | */ | ||
269 | spin_lock_irqsave(&queue->lock, irqflags); | ||
270 | index = queue->index[Q_INDEX]; | ||
271 | index_done = queue->index[Q_INDEX_DONE]; | ||
272 | spin_unlock_irqrestore(&queue->lock, irqflags); | ||
273 | |||
274 | /* | ||
275 | * Start from the TX done pointer, this guarentees that we will | ||
276 | * send out all frames in the correct order. | ||
277 | */ | ||
278 | if (index_done < index) { | ||
279 | for (i = index_done; i < index; i++) | ||
280 | rt2x00usb_kick_tx_entry(&queue->entries[i]); | ||
281 | } else { | ||
282 | for (i = index_done; i < queue->limit; i++) | ||
283 | rt2x00usb_kick_tx_entry(&queue->entries[i]); | ||
284 | |||
285 | for (i = 0; i < index; i++) | ||
286 | rt2x00usb_kick_tx_entry(&queue->entries[i]); | ||
287 | } | ||
288 | } | ||
289 | EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue); | ||
290 | |||
245 | /* | 291 | /* |
246 | * RX data handlers. | 292 | * RX data handlers. |
247 | */ | 293 | */ |