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.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 83630f16dc6..7e30144c5cf 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -33,9 +33,9 @@
33#include "rt2x00.h" 33#include "rt2x00.h"
34#include "rt2x00lib.h" 34#include "rt2x00lib.h"
35 35
36struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev, 36struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry)
37 struct queue_entry *entry)
38{ 37{
38 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
39 struct sk_buff *skb; 39 struct sk_buff *skb;
40 struct skb_frame_desc *skbdesc; 40 struct skb_frame_desc *skbdesc;
41 unsigned int frame_size; 41 unsigned int frame_size;
@@ -97,39 +97,42 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,
97 return skb; 97 return skb;
98} 98}
99 99
100void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) 100void rt2x00queue_map_txskb(struct queue_entry *entry)
101{ 101{
102 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 102 struct device *dev = entry->queue->rt2x00dev->dev;
103 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
103 104
104 skbdesc->skb_dma = 105 skbdesc->skb_dma =
105 dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE); 106 dma_map_single(dev, entry->skb->data, entry->skb->len, DMA_TO_DEVICE);
106 skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; 107 skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
107} 108}
108EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb); 109EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb);
109 110
110void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) 111void rt2x00queue_unmap_skb(struct queue_entry *entry)
111{ 112{
112 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 113 struct device *dev = entry->queue->rt2x00dev->dev;
114 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
113 115
114 if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) { 116 if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) {
115 dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len, 117 dma_unmap_single(dev, skbdesc->skb_dma, entry->skb->len,
116 DMA_FROM_DEVICE); 118 DMA_FROM_DEVICE);
117 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_RX; 119 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_RX;
118 } else if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) { 120 } else if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) {
119 dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len, 121 dma_unmap_single(dev, skbdesc->skb_dma, entry->skb->len,
120 DMA_TO_DEVICE); 122 DMA_TO_DEVICE);
121 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; 123 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
122 } 124 }
123} 125}
124EXPORT_SYMBOL_GPL(rt2x00queue_unmap_skb); 126EXPORT_SYMBOL_GPL(rt2x00queue_unmap_skb);
125 127
126void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) 128void rt2x00queue_free_skb(struct queue_entry *entry)
127{ 129{
128 if (!skb) 130 if (!entry->skb)
129 return; 131 return;
130 132
131 rt2x00queue_unmap_skb(rt2x00dev, skb); 133 rt2x00queue_unmap_skb(entry);
132 dev_kfree_skb_any(skb); 134 dev_kfree_skb_any(entry->skb);
135 entry->skb = NULL;
133} 136}
134 137
135void rt2x00queue_align_frame(struct sk_buff *skb) 138void rt2x00queue_align_frame(struct sk_buff *skb)
@@ -438,7 +441,7 @@ static int rt2x00queue_write_tx_data(struct queue_entry *entry,
438 * Map the skb to DMA. 441 * Map the skb to DMA.
439 */ 442 */
440 if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) 443 if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
441 rt2x00queue_map_txskb(rt2x00dev, entry->skb); 444 rt2x00queue_map_txskb(entry);
442 445
443 return 0; 446 return 0;
444} 447}
@@ -585,8 +588,7 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
585 /* 588 /*
586 * Clean up the beacon skb. 589 * Clean up the beacon skb.
587 */ 590 */
588 rt2x00queue_free_skb(rt2x00dev, intf->beacon->skb); 591 rt2x00queue_free_skb(intf->beacon);
589 intf->beacon->skb = NULL;
590 592
591 if (!enable_beacon) { 593 if (!enable_beacon) {
592 rt2x00dev->ops->lib->kill_tx_queue(intf->beacon->queue); 594 rt2x00dev->ops->lib->kill_tx_queue(intf->beacon->queue);
@@ -827,8 +829,7 @@ static int rt2x00queue_alloc_entries(struct data_queue *queue,
827 return 0; 829 return 0;
828} 830}
829 831
830static void rt2x00queue_free_skbs(struct rt2x00_dev *rt2x00dev, 832static void rt2x00queue_free_skbs(struct data_queue *queue)
831 struct data_queue *queue)
832{ 833{
833 unsigned int i; 834 unsigned int i;
834 835
@@ -836,19 +837,17 @@ static void rt2x00queue_free_skbs(struct rt2x00_dev *rt2x00dev,
836 return; 837 return;
837 838
838 for (i = 0; i < queue->limit; i++) { 839 for (i = 0; i < queue->limit; i++) {
839 if (queue->entries[i].skb) 840 rt2x00queue_free_skb(&queue->entries[i]);
840 rt2x00queue_free_skb(rt2x00dev, queue->entries[i].skb);
841 } 841 }
842} 842}
843 843
844static int rt2x00queue_alloc_rxskbs(struct rt2x00_dev *rt2x00dev, 844static int rt2x00queue_alloc_rxskbs(struct data_queue *queue)
845 struct data_queue *queue)
846{ 845{
847 unsigned int i; 846 unsigned int i;
848 struct sk_buff *skb; 847 struct sk_buff *skb;
849 848
850 for (i = 0; i < queue->limit; i++) { 849 for (i = 0; i < queue->limit; i++) {
851 skb = rt2x00queue_alloc_rxskb(rt2x00dev, &queue->entries[i]); 850 skb = rt2x00queue_alloc_rxskb(&queue->entries[i]);
852 if (!skb) 851 if (!skb)
853 return -ENOMEM; 852 return -ENOMEM;
854 queue->entries[i].skb = skb; 853 queue->entries[i].skb = skb;
@@ -883,7 +882,7 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)
883 goto exit; 882 goto exit;
884 } 883 }
885 884
886 status = rt2x00queue_alloc_rxskbs(rt2x00dev, rt2x00dev->rx); 885 status = rt2x00queue_alloc_rxskbs(rt2x00dev->rx);
887 if (status) 886 if (status)
888 goto exit; 887 goto exit;
889 888
@@ -901,7 +900,7 @@ void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev)
901{ 900{
902 struct data_queue *queue; 901 struct data_queue *queue;
903 902
904 rt2x00queue_free_skbs(rt2x00dev, rt2x00dev->rx); 903 rt2x00queue_free_skbs(rt2x00dev->rx);
905 904
906 queue_for_each(rt2x00dev, queue) { 905 queue_for_each(rt2x00dev, queue) {
907 kfree(queue->entries); 906 kfree(queue->entries);