aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00queue.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c43
1 files changed, 10 insertions, 33 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 20dbdd6fb904..f91637147116 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -100,21 +100,8 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
100{ 100{
101 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 101 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
102 102
103 /*
104 * If device has requested headroom, we should make sure that
105 * is also mapped to the DMA so it can be used for transfering
106 * additional descriptor information to the hardware.
107 */
108 skb_push(skb, rt2x00dev->ops->extra_tx_headroom);
109
110 skbdesc->skb_dma = 103 skbdesc->skb_dma =
111 dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE); 104 dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
112
113 /*
114 * Restore data pointer to original location again.
115 */
116 skb_pull(skb, rt2x00dev->ops->extra_tx_headroom);
117
118 skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; 105 skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
119} 106}
120EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb); 107EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb);
@@ -130,16 +117,12 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
130 } 117 }
131 118
132 if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) { 119 if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) {
133 /* 120 dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len,
134 * Add headroom to the skb length, it has been removed
135 * by the driver, but it was actually mapped to DMA.
136 */
137 dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma,
138 skb->len + rt2x00dev->ops->extra_tx_headroom,
139 DMA_TO_DEVICE); 121 DMA_TO_DEVICE);
140 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; 122 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
141 } 123 }
142} 124}
125EXPORT_SYMBOL_GPL(rt2x00queue_unmap_skb);
143 126
144void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) 127void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
145{ 128{
@@ -370,13 +353,18 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
370 /* 353 /*
371 * Check if more fragments are pending 354 * Check if more fragments are pending
372 */ 355 */
373 if (ieee80211_has_morefrags(hdr->frame_control) || 356 if (ieee80211_has_morefrags(hdr->frame_control)) {
374 (tx_info->flags & IEEE80211_TX_CTL_MORE_FRAMES)) {
375 __set_bit(ENTRY_TXD_BURST, &txdesc->flags); 357 __set_bit(ENTRY_TXD_BURST, &txdesc->flags);
376 __set_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags); 358 __set_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags);
377 } 359 }
378 360
379 /* 361 /*
362 * Check if more frames (!= fragments) are pending
363 */
364 if (tx_info->flags & IEEE80211_TX_CTL_MORE_FRAMES)
365 __set_bit(ENTRY_TXD_BURST, &txdesc->flags);
366
367 /*
380 * Beacons and probe responses require the tsf timestamp 368 * Beacons and probe responses require the tsf timestamp
381 * to be inserted into the frame, except for a frame that has been injected 369 * to be inserted into the frame, except for a frame that has been injected
382 * through a monitor interface. This latter is needed for testing a 370 * through a monitor interface. This latter is needed for testing a
@@ -421,7 +409,6 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
421{ 409{
422 struct data_queue *queue = entry->queue; 410 struct data_queue *queue = entry->queue;
423 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; 411 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
424 enum rt2x00_dump_type dump_type;
425 412
426 rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc); 413 rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc);
427 414
@@ -429,9 +416,7 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
429 * All processing on the frame has been completed, this means 416 * All processing on the frame has been completed, this means
430 * it is now ready to be dumped to userspace through debugfs. 417 * it is now ready to be dumped to userspace through debugfs.
431 */ 418 */
432 dump_type = (txdesc->queue == QID_BEACON) ? 419 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb);
433 DUMP_FRAME_BEACON : DUMP_FRAME_TX;
434 rt2x00debug_dump_frame(rt2x00dev, dump_type, entry->skb);
435} 420}
436 421
437static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, 422static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,
@@ -537,9 +522,6 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
537 return -EIO; 522 return -EIO;
538 } 523 }
539 524
540 if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
541 rt2x00queue_map_txskb(queue->rt2x00dev, skb);
542
543 set_bit(ENTRY_DATA_PENDING, &entry->flags); 525 set_bit(ENTRY_DATA_PENDING, &entry->flags);
544 526
545 rt2x00queue_index_inc(queue, Q_INDEX); 527 rt2x00queue_index_inc(queue, Q_INDEX);
@@ -595,11 +577,6 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
595 skbdesc->entry = intf->beacon; 577 skbdesc->entry = intf->beacon;
596 578
597 /* 579 /*
598 * Write TX descriptor into reserved room in front of the beacon.
599 */
600 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
601
602 /*
603 * Send beacon to hardware and enable beacon genaration.. 580 * Send beacon to hardware and enable beacon genaration..
604 */ 581 */
605 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc); 582 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc);