aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 70a3d135f64e..a6bac75de9f2 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -34,52 +34,40 @@
34/* 34/*
35 * TX data handlers. 35 * TX data handlers.
36 */ 36 */
37int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, 37int rt2x00pci_write_tx_data(struct queue_entry *entry)
38 struct data_queue *queue, struct sk_buff *skb)
39{ 38{
40 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
41 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 39 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
42 struct skb_frame_desc *skbdesc; 40 struct skb_frame_desc *skbdesc;
43 struct txentry_desc txdesc;
44 u32 word; 41 u32 word;
45 42
46 if (rt2x00queue_full(queue))
47 return -EINVAL;
48
49 rt2x00_desc_read(entry_priv->desc, 0, &word); 43 rt2x00_desc_read(entry_priv->desc, 0, &word);
50 44
51 if (rt2x00_get_field32(word, TXD_ENTRY_OWNER_NIC) || 45 /*
52 rt2x00_get_field32(word, TXD_ENTRY_VALID)) { 46 * This should not happen, we already checked the entry
53 ERROR(rt2x00dev, 47 * was ours. When the hardware disagrees there has been
54 "Arrived at non-free entry in the non-full queue %d.\n" 48 * a queue corruption!
49 */
50 if (unlikely(rt2x00_get_field32(word, TXD_ENTRY_OWNER_NIC) ||
51 rt2x00_get_field32(word, TXD_ENTRY_VALID))) {
52 ERROR(entry->queue->rt2x00dev,
53 "Corrupt queue %d, accessing entry which is not ours.\n"
55 "Please file bug report to %s.\n", 54 "Please file bug report to %s.\n",
56 entry->queue->qid, DRV_PROJECT); 55 entry->queue->qid, DRV_PROJECT);
57 return -EINVAL; 56 return -EINVAL;
58 } 57 }
59 58
60 /* 59 /*
61 * Copy all TX descriptor information into txdesc,
62 * after that we are free to use the skb->cb array
63 * for our information.
64 */
65 entry->skb = skb;
66 rt2x00queue_create_tx_descriptor(entry, &txdesc);
67
68 /*
69 * Fill in skb descriptor 60 * Fill in skb descriptor
70 */ 61 */
71 skbdesc = get_skb_frame_desc(skb); 62 skbdesc = get_skb_frame_desc(entry->skb);
72 memset(skbdesc, 0, sizeof(*skbdesc)); 63 memset(skbdesc, 0, sizeof(*skbdesc));
73 skbdesc->data = skb->data; 64 skbdesc->data = entry->skb->data;
74 skbdesc->data_len = skb->len; 65 skbdesc->data_len = entry->skb->len;
75 skbdesc->desc = entry_priv->desc; 66 skbdesc->desc = entry_priv->desc;
76 skbdesc->desc_len = queue->desc_size; 67 skbdesc->desc_len = entry->queue->desc_size;
77 skbdesc->entry = entry; 68 skbdesc->entry = entry;
78 69
79 memcpy(entry_priv->data, skb->data, skb->len); 70 memcpy(entry_priv->data, entry->skb->data, entry->skb->len);
80
81 rt2x00queue_write_tx_descriptor(entry, &txdesc);
82 rt2x00queue_index_inc(queue, Q_INDEX);
83 71
84 return 0; 72 return 0;
85} 73}
@@ -178,6 +166,7 @@ void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry,
178 rt2x00_set_field32(&word, TXD_ENTRY_VALID, 0); 166 rt2x00_set_field32(&word, TXD_ENTRY_VALID, 0);
179 rt2x00_desc_write(entry_priv->desc, 0, word); 167 rt2x00_desc_write(entry_priv->desc, 0, word);
180 168
169 __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
181 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); 170 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
182 171
183 /* 172 /*