diff options
author | Ivo van Doorn <IvDoorn@gmail.com> | 2008-06-06 16:50:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:17:56 -0400 |
commit | 6db3786aee36b32e5ed072ed67fad6d5341b0991 (patch) | |
tree | af6ef8406b539e418f2cbc74609e50faa28a4ee1 /drivers/net/wireless/rt2x00/rt2x00queue.c | |
parent | f019d51410a9b61278eeff811a1ca11d2a905241 (diff) |
rt2x00: Move generic TX frame writing code into rt2x00queue
The write_tx_data functions in rt2x00pci and rt2x00usb have
a lot in common. This moves that duplicate code into
rt2x00queue_write_tx_frame().
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/rt2x00queue.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 6f3aa0f71f9f..f875b7ab09fe 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -188,6 +188,43 @@ void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, | |||
188 | } | 188 | } |
189 | EXPORT_SYMBOL_GPL(rt2x00queue_write_tx_descriptor); | 189 | EXPORT_SYMBOL_GPL(rt2x00queue_write_tx_descriptor); |
190 | 190 | ||
191 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) | ||
192 | { | ||
193 | struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
194 | struct txentry_desc txdesc; | ||
195 | |||
196 | if (unlikely(rt2x00queue_full(queue))) | ||
197 | return -EINVAL; | ||
198 | |||
199 | if (__test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) { | ||
200 | ERROR(queue->rt2x00dev, | ||
201 | "Arrived at non-free entry in the non-full queue %d.\n" | ||
202 | "Please file bug report to %s.\n", | ||
203 | queue->qid, DRV_PROJECT); | ||
204 | return -EINVAL; | ||
205 | } | ||
206 | |||
207 | /* | ||
208 | * Copy all TX descriptor information into txdesc, | ||
209 | * after that we are free to use the skb->cb array | ||
210 | * for our information. | ||
211 | */ | ||
212 | entry->skb = skb; | ||
213 | rt2x00queue_create_tx_descriptor(entry, &txdesc); | ||
214 | |||
215 | if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) { | ||
216 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | ||
217 | return -EIO; | ||
218 | } | ||
219 | |||
220 | __set_bit(ENTRY_DATA_PENDING, &entry->flags); | ||
221 | |||
222 | rt2x00queue_index_inc(queue, Q_INDEX); | ||
223 | rt2x00queue_write_tx_descriptor(entry, &txdesc); | ||
224 | |||
225 | return 0; | ||
226 | } | ||
227 | |||
191 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | 228 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, |
192 | const enum data_queue_qid queue) | 229 | const enum data_queue_qid queue) |
193 | { | 230 | { |