aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2010-08-23 13:53:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-25 14:34:54 -0400
commit933314582ee5db00123683cf4c4d713ec9add306 (patch)
tree6d0be156f19ad0f4b78da5577f56995beb43a15a /drivers
parent18c121d7558a550e8e48956fbd389759a850ab53 (diff)
rt2x00: Simplify arguments to rt2x00 driver callback functions
write_tx_desc shouldn't pass a rt2x00dev and skb pointer, instead it should use the same format as other TX frame callback functions, which is passing the data_entry pointer which contains all the information which is needed to work on a TX frame. Most callers of the kick_tx_queue and kill_tx_queue already have the data_queue pointer, so rather then sending the QID with the given function, when the driver requests a new pointer to the data_queue, it is more efficient to just send the data_queue pointer directly. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c25
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c25
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c41
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h12
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c39
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c11
11 files changed, 90 insertions, 115 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 5063e01410e..b86b6132a69 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1007,12 +1007,11 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,
1007/* 1007/*
1008 * TX descriptor initialization 1008 * TX descriptor initialization
1009 */ 1009 */
1010static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, 1010static void rt2400pci_write_tx_desc(struct queue_entry *entry,
1011 struct sk_buff *skb,
1012 struct txentry_desc *txdesc) 1011 struct txentry_desc *txdesc)
1013{ 1012{
1014 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 1013 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1015 struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; 1014 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1016 __le32 *txd = entry_priv->desc; 1015 __le32 *txd = entry_priv->desc;
1017 u32 word; 1016 u32 word;
1018 1017
@@ -1096,7 +1095,7 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,
1096 /* 1095 /*
1097 * Write the TX descriptor for the beacon. 1096 * Write the TX descriptor for the beacon.
1098 */ 1097 */
1099 rt2400pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); 1098 rt2400pci_write_tx_desc(entry, txdesc);
1100 1099
1101 /* 1100 /*
1102 * Dump beacon to userspace through debugfs. 1101 * Dump beacon to userspace through debugfs.
@@ -1112,24 +1111,24 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,
1112 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 1111 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1113} 1112}
1114 1113
1115static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1114static void rt2400pci_kick_tx_queue(struct data_queue *queue)
1116 const enum data_queue_qid queue)
1117{ 1115{
1116 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1118 u32 reg; 1117 u32 reg;
1119 1118
1120 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1119 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1121 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); 1120 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE));
1122 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK)); 1121 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK));
1123 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue == QID_ATIM)); 1122 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM));
1124 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); 1123 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1125} 1124}
1126 1125
1127static void rt2400pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, 1126static void rt2400pci_kill_tx_queue(struct data_queue *queue)
1128 const enum data_queue_qid qid)
1129{ 1127{
1128 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1130 u32 reg; 1129 u32 reg;
1131 1130
1132 if (qid == QID_BEACON) { 1131 if (queue->qid == QID_BEACON) {
1133 rt2x00pci_register_write(rt2x00dev, CSR14, 0); 1132 rt2x00pci_register_write(rt2x00dev, CSR14, 0);
1134 } else { 1133 } else {
1135 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1134 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index c2a555d5376..21f45810fd1 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1161,12 +1161,11 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
1161/* 1161/*
1162 * TX descriptor initialization 1162 * TX descriptor initialization
1163 */ 1163 */
1164static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, 1164static void rt2500pci_write_tx_desc(struct queue_entry *entry,
1165 struct sk_buff *skb,
1166 struct txentry_desc *txdesc) 1165 struct txentry_desc *txdesc)
1167{ 1166{
1168 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 1167 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1169 struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; 1168 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1170 __le32 *txd = entry_priv->desc; 1169 __le32 *txd = entry_priv->desc;
1171 u32 word; 1170 u32 word;
1172 1171
@@ -1249,7 +1248,7 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,
1249 /* 1248 /*
1250 * Write the TX descriptor for the beacon. 1249 * Write the TX descriptor for the beacon.
1251 */ 1250 */
1252 rt2500pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); 1251 rt2500pci_write_tx_desc(entry, txdesc);
1253 1252
1254 /* 1253 /*
1255 * Dump beacon to userspace through debugfs. 1254 * Dump beacon to userspace through debugfs.
@@ -1265,24 +1264,24 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,
1265 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 1264 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1266} 1265}
1267 1266
1268static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1267static void rt2500pci_kick_tx_queue(struct data_queue *queue)
1269 const enum data_queue_qid queue)
1270{ 1268{
1269 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1271 u32 reg; 1270 u32 reg;
1272 1271
1273 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1272 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1274 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); 1273 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE));
1275 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK)); 1274 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK));
1276 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue == QID_ATIM)); 1275 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM));
1277 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); 1276 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1278} 1277}
1279 1278
1280static void rt2500pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, 1279static void rt2500pci_kill_tx_queue(struct data_queue *queue)
1281 const enum data_queue_qid qid)
1282{ 1280{
1281 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1283 u32 reg; 1282 u32 reg;
1284 1283
1285 if (qid == QID_BEACON) { 1284 if (queue->qid == QID_BEACON) {
1286 rt2x00pci_register_write(rt2x00dev, CSR14, 0); 1285 rt2x00pci_register_write(rt2x00dev, CSR14, 0);
1287 } else { 1286 } else {
1288 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1287 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 97cf72f8bc1..8722464944f 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1041,12 +1041,11 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,
1041/* 1041/*
1042 * TX descriptor initialization 1042 * TX descriptor initialization
1043 */ 1043 */
1044static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, 1044static void rt2500usb_write_tx_desc(struct queue_entry *entry,
1045 struct sk_buff *skb,
1046 struct txentry_desc *txdesc) 1045 struct txentry_desc *txdesc)
1047{ 1046{
1048 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 1047 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1049 __le32 *txd = (__le32 *) skb->data; 1048 __le32 *txd = (__le32 *) entry->skb->data;
1050 u32 word; 1049 u32 word;
1051 1050
1052 /* 1051 /*
@@ -1129,7 +1128,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry,
1129 /* 1128 /*
1130 * Write the TX descriptor for the beacon. 1129 * Write the TX descriptor for the beacon.
1131 */ 1130 */
1132 rt2500usb_write_tx_desc(rt2x00dev, entry->skb, txdesc); 1131 rt2500usb_write_tx_desc(entry, txdesc);
1133 1132
1134 /* 1133 /*
1135 * Dump beacon to userspace through debugfs. 1134 * Dump beacon to userspace through debugfs.
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 4390f2b74b2..af1c6914d7b 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -571,12 +571,11 @@ static __le32 *rt2800pci_get_txwi(struct queue_entry *entry)
571 return (__le32 *) entry->skb->data; 571 return (__le32 *) entry->skb->data;
572} 572}
573 573
574static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, 574static void rt2800pci_write_tx_desc(struct queue_entry *entry,
575 struct sk_buff *skb,
576 struct txentry_desc *txdesc) 575 struct txentry_desc *txdesc)
577{ 576{
578 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 577 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
579 struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; 578 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
580 __le32 *txd = entry_priv->desc; 579 __le32 *txd = entry_priv->desc;
581 u32 word; 580 u32 word;
582 581
@@ -596,7 +595,7 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
596 rt2x00_desc_write(txd, 0, word); 595 rt2x00_desc_write(txd, 0, word);
597 596
598 rt2x00_desc_read(txd, 1, &word); 597 rt2x00_desc_read(txd, 1, &word);
599 rt2x00_set_field32(&word, TXD_W1_SD_LEN1, skb->len); 598 rt2x00_set_field32(&word, TXD_W1_SD_LEN1, entry->skb->len);
600 rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, 599 rt2x00_set_field32(&word, TXD_W1_LAST_SEC1,
601 !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); 600 !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
602 rt2x00_set_field32(&word, TXD_W1_BURST, 601 rt2x00_set_field32(&word, TXD_W1_BURST,
@@ -627,41 +626,35 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
627/* 626/*
628 * TX data initialization 627 * TX data initialization
629 */ 628 */
630static void rt2800pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 629static void rt2800pci_kick_tx_queue(struct data_queue *queue)
631 const enum data_queue_qid queue_idx)
632{ 630{
633 struct data_queue *queue; 631 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
634 unsigned int idx, qidx = 0; 632 unsigned int idx = queue->index[Q_INDEX];
635 633 unsigned int qidx = 0;
636 if (queue_idx > QID_HCCA && queue_idx != QID_MGMT)
637 return;
638
639 queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
640 idx = queue->index[Q_INDEX];
641 634
642 if (queue_idx == QID_MGMT) 635 if (queue->qid == QID_MGMT)
643 qidx = 5; 636 qidx = 5;
644 else 637 else
645 qidx = queue_idx; 638 qidx = queue->qid;
646 639
647 rt2800_register_write(rt2x00dev, TX_CTX_IDX(qidx), idx); 640 rt2800_register_write(rt2x00dev, TX_CTX_IDX(qidx), idx);
648} 641}
649 642
650static void rt2800pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, 643static void rt2800pci_kill_tx_queue(struct data_queue *queue)
651 const enum data_queue_qid qid)
652{ 644{
645 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
653 u32 reg; 646 u32 reg;
654 647
655 if (qid == QID_BEACON) { 648 if (queue->qid == QID_BEACON) {
656 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, 0); 649 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, 0);
657 return; 650 return;
658 } 651 }
659 652
660 rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, &reg); 653 rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, &reg);
661 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX0, (qid == QID_AC_BE)); 654 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX0, (queue->qid == QID_AC_BE));
662 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX1, (qid == QID_AC_BK)); 655 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX1, (queue->qid == QID_AC_BK));
663 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX2, (qid == QID_AC_VI)); 656 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX2, (queue->qid == QID_AC_VI));
664 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX3, (qid == QID_AC_VO)); 657 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX3, (queue->qid == QID_AC_VO));
665 rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg); 658 rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
666} 659}
667 660
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 9ad28be294e..02f95892aa0 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -329,12 +329,11 @@ static __le32 *rt2800usb_get_txwi(struct queue_entry *entry)
329 return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE); 329 return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE);
330} 330}
331 331
332static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, 332static void rt2800usb_write_tx_desc(struct queue_entry *entry,
333 struct sk_buff *skb,
334 struct txentry_desc *txdesc) 333 struct txentry_desc *txdesc)
335{ 334{
336 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 335 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
337 __le32 *txi = (__le32 *) skb->data; 336 __le32 *txi = (__le32 *) entry->skb->data;
338 u32 word; 337 u32 word;
339 338
340 /* 339 /*
@@ -342,7 +341,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
342 */ 341 */
343 rt2x00_desc_read(txi, 0, &word); 342 rt2x00_desc_read(txi, 0, &word);
344 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, 343 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
345 skb->len - TXINFO_DESC_SIZE); 344 entry->skb->len - TXINFO_DESC_SIZE);
346 rt2x00_set_field32(&word, TXINFO_W0_WIV, 345 rt2x00_set_field32(&word, TXINFO_W0_WIV,
347 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); 346 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
348 rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); 347 rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 8c65244a847..69308a0df74 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -559,18 +559,15 @@ struct rt2x00lib_ops {
559 /* 559 /*
560 * TX control handlers 560 * TX control handlers
561 */ 561 */
562 void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev, 562 void (*write_tx_desc) (struct queue_entry *entry,
563 struct sk_buff *skb,
564 struct txentry_desc *txdesc); 563 struct txentry_desc *txdesc);
565 void (*write_tx_data) (struct queue_entry *entry, 564 void (*write_tx_data) (struct queue_entry *entry,
566 struct txentry_desc *txdesc); 565 struct txentry_desc *txdesc);
567 void (*write_beacon) (struct queue_entry *entry, 566 void (*write_beacon) (struct queue_entry *entry,
568 struct txentry_desc *txdesc); 567 struct txentry_desc *txdesc);
569 int (*get_tx_data_len) (struct queue_entry *entry); 568 int (*get_tx_data_len) (struct queue_entry *entry);
570 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 569 void (*kick_tx_queue) (struct data_queue *queue);
571 const enum data_queue_qid queue); 570 void (*kill_tx_queue) (struct data_queue *queue);
572 void (*kill_tx_queue) (struct rt2x00_dev *rt2x00dev,
573 const enum data_queue_qid queue);
574 571
575 /* 572 /*
576 * RX control handlers 573 * RX control handlers
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 18220953851..189eaf72967 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -449,15 +449,14 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
449 struct txentry_desc *txdesc) 449 struct txentry_desc *txdesc)
450{ 450{
451 struct data_queue *queue = entry->queue; 451 struct data_queue *queue = entry->queue;
452 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
453 452
454 rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc); 453 queue->rt2x00dev->ops->lib->write_tx_desc(entry, txdesc);
455 454
456 /* 455 /*
457 * All processing on the frame has been completed, this means 456 * All processing on the frame has been completed, this means
458 * it is now ready to be dumped to userspace through debugfs. 457 * it is now ready to be dumped to userspace through debugfs.
459 */ 458 */
460 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); 459 rt2x00debug_dump_frame(queue->rt2x00dev, DUMP_FRAME_TX, entry->skb);
461} 460}
462 461
463static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, 462static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,
@@ -477,7 +476,7 @@ static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,
477 */ 476 */
478 if (rt2x00queue_threshold(queue) || 477 if (rt2x00queue_threshold(queue) ||
479 !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) 478 !test_bit(ENTRY_TXD_BURST, &txdesc->flags))
480 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); 479 rt2x00dev->ops->lib->kick_tx_queue(queue);
481} 480}
482 481
483int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, 482int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
@@ -591,7 +590,7 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
591 intf->beacon->skb = NULL; 590 intf->beacon->skb = NULL;
592 591
593 if (!enable_beacon) { 592 if (!enable_beacon) {
594 rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_BEACON); 593 rt2x00dev->ops->lib->kill_tx_queue(intf->beacon->queue);
595 mutex_unlock(&intf->beacon_skb_mutex); 594 mutex_unlock(&intf->beacon_skb_mutex);
596 return 0; 595 return 0;
597 } 596 }
@@ -719,7 +718,7 @@ void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev)
719 struct data_queue *queue; 718 struct data_queue *queue;
720 719
721 txall_queue_for_each(rt2x00dev, queue) 720 txall_queue_for_each(rt2x00dev, queue)
722 rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, queue->qid); 721 rt2x00dev->ops->lib->kill_tx_queue(queue);
723} 722}
724 723
725void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) 724void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index f76014f732c..52ed3f44c84 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -249,10 +249,8 @@ static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
249 } 249 }
250} 250}
251 251
252void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 252void rt2x00usb_kick_tx_queue(struct data_queue *queue)
253 const enum data_queue_qid qid)
254{ 253{
255 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, qid);
256 unsigned long irqflags; 254 unsigned long irqflags;
257 unsigned int index; 255 unsigned int index;
258 unsigned int index_done; 256 unsigned int index_done;
@@ -286,10 +284,8 @@ void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
286} 284}
287EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue); 285EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue);
288 286
289void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev, 287void rt2x00usb_kill_tx_queue(struct data_queue *queue)
290 const enum data_queue_qid qid)
291{ 288{
292 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, qid);
293 struct queue_entry_priv_usb *entry_priv; 289 struct queue_entry_priv_usb *entry_priv;
294 struct queue_entry_priv_usb_bcn *bcn_priv; 290 struct queue_entry_priv_usb_bcn *bcn_priv;
295 unsigned int i; 291 unsigned int i;
@@ -300,8 +296,8 @@ void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev,
300 * the beacon guard byte. 296 * the beacon guard byte.
301 */ 297 */
302 kill_guard = 298 kill_guard =
303 (qid == QID_BEACON) && 299 (queue->qid == QID_BEACON) &&
304 (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)); 300 (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &queue->rt2x00dev->flags));
305 301
306 /* 302 /*
307 * Cancel all entries. 303 * Cancel all entries.
@@ -447,7 +443,7 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev)
447 * The USB version of kill_tx_queue also works 443 * The USB version of kill_tx_queue also works
448 * on the RX queue. 444 * on the RX queue.
449 */ 445 */
450 rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_RX); 446 rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev->rx);
451} 447}
452EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); 448EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio);
453 449
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index d3d3ddc4087..c2d997f67b3 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -379,25 +379,21 @@ struct queue_entry_priv_usb_bcn {
379 379
380/** 380/**
381 * rt2x00usb_kick_tx_queue - Kick data queue 381 * rt2x00usb_kick_tx_queue - Kick data queue
382 * @rt2x00dev: Pointer to &struct rt2x00_dev 382 * @queue: Data queue to kick
383 * @qid: Data queue to kick
384 * 383 *
385 * This will walk through all entries of the queue and push all pending 384 * This will walk through all entries of the queue and push all pending
386 * frames to the hardware as a single burst. 385 * frames to the hardware as a single burst.
387 */ 386 */
388void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 387void rt2x00usb_kick_tx_queue(struct data_queue *queue);
389 const enum data_queue_qid qid);
390 388
391/** 389/**
392 * rt2x00usb_kill_tx_queue - Kill data queue 390 * rt2x00usb_kill_tx_queue - Kill data queue
393 * @rt2x00dev: Pointer to &struct rt2x00_dev 391 * @queue: Data queue to kill
394 * @qid: Data queue to kill
395 * 392 *
396 * This will walk through all entries of the queue and kill all 393 * This will walk through all entries of the queue and kill all
397 * previously kicked frames before they can be send. 394 * previously kicked frames before they can be send.
398 */ 395 */
399void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev, 396void rt2x00usb_kill_tx_queue(struct data_queue *queue);
400 const enum data_queue_qid qid);
401 397
402/** 398/**
403 * rt2x00usb_watchdog - Watchdog for USB communication 399 * rt2x00usb_watchdog - Watchdog for USB communication
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index cff503faac6..ae4698e1872 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1766,12 +1766,11 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,
1766/* 1766/*
1767 * TX descriptor initialization 1767 * TX descriptor initialization
1768 */ 1768 */
1769static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, 1769static void rt61pci_write_tx_desc(struct queue_entry *entry,
1770 struct sk_buff *skb,
1771 struct txentry_desc *txdesc) 1770 struct txentry_desc *txdesc)
1772{ 1771{
1773 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 1772 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1774 struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; 1773 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1775 __le32 *txd = entry_priv->desc; 1774 __le32 *txd = entry_priv->desc;
1776 u32 word; 1775 u32 word;
1777 1776
@@ -1802,11 +1801,11 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1802 } 1801 }
1803 1802
1804 rt2x00_desc_read(txd, 5, &word); 1803 rt2x00_desc_read(txd, 5, &word);
1805 rt2x00_set_field32(&word, TXD_W5_PID_TYPE, skbdesc->entry->queue->qid); 1804 rt2x00_set_field32(&word, TXD_W5_PID_TYPE, entry->queue->qid);
1806 rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, 1805 rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE,
1807 skbdesc->entry->entry_idx); 1806 skbdesc->entry->entry_idx);
1808 rt2x00_set_field32(&word, TXD_W5_TX_POWER, 1807 rt2x00_set_field32(&word, TXD_W5_TX_POWER,
1809 TXPOWER_TO_DEV(rt2x00dev->tx_power)); 1808 TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power));
1810 rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); 1809 rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1);
1811 rt2x00_desc_write(txd, 5, word); 1810 rt2x00_desc_write(txd, 5, word);
1812 1811
@@ -1882,7 +1881,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry,
1882 /* 1881 /*
1883 * Write the TX descriptor for the beacon. 1882 * Write the TX descriptor for the beacon.
1884 */ 1883 */
1885 rt61pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); 1884 rt61pci_write_tx_desc(entry, txdesc);
1886 1885
1887 /* 1886 /*
1888 * Dump beacon to userspace through debugfs. 1887 * Dump beacon to userspace through debugfs.
@@ -1918,34 +1917,34 @@ static void rt61pci_write_beacon(struct queue_entry *entry,
1918 entry->skb = NULL; 1917 entry->skb = NULL;
1919} 1918}
1920 1919
1921static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1920static void rt61pci_kick_tx_queue(struct data_queue *queue)
1922 const enum data_queue_qid queue)
1923{ 1921{
1922 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1924 u32 reg; 1923 u32 reg;
1925 1924
1926 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg); 1925 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
1927 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); 1926 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, (queue->qid == QID_AC_BE));
1928 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); 1927 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, (queue->qid == QID_AC_BK));
1929 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC2, (queue == QID_AC_VI)); 1928 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC2, (queue->qid == QID_AC_VI));
1930 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC3, (queue == QID_AC_VO)); 1929 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC3, (queue->qid == QID_AC_VO));
1931 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); 1930 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
1932} 1931}
1933 1932
1934static void rt61pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, 1933static void rt61pci_kill_tx_queue(struct data_queue *queue)
1935 const enum data_queue_qid qid)
1936{ 1934{
1935 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1937 u32 reg; 1936 u32 reg;
1938 1937
1939 if (qid == QID_BEACON) { 1938 if (queue->qid == QID_BEACON) {
1940 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0); 1939 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0);
1941 return; 1940 return;
1942 } 1941 }
1943 1942
1944 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg); 1943 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
1945 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC0, (qid == QID_AC_BE)); 1944 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC0, (queue->qid == QID_AC_BE));
1946 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC1, (qid == QID_AC_BK)); 1945 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC1, (queue->qid == QID_AC_BK));
1947 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC2, (qid == QID_AC_VI)); 1946 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC2, (queue->qid == QID_AC_VI));
1948 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC3, (qid == QID_AC_VO)); 1947 rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC3, (queue->qid == QID_AC_VO));
1949 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); 1948 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
1950} 1949}
1951 1950
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c65529678fb..ab9389439d7 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1426,12 +1426,11 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,
1426/* 1426/*
1427 * TX descriptor initialization 1427 * TX descriptor initialization
1428 */ 1428 */
1429static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, 1429static void rt73usb_write_tx_desc(struct queue_entry *entry,
1430 struct sk_buff *skb,
1431 struct txentry_desc *txdesc) 1430 struct txentry_desc *txdesc)
1432{ 1431{
1433 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 1432 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1434 __le32 *txd = (__le32 *) skb->data; 1433 __le32 *txd = (__le32 *) entry->skb->data;
1435 u32 word; 1434 u32 word;
1436 1435
1437 /* 1436 /*
@@ -1487,7 +1486,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1487 1486
1488 rt2x00_desc_read(txd, 5, &word); 1487 rt2x00_desc_read(txd, 5, &word);
1489 rt2x00_set_field32(&word, TXD_W5_TX_POWER, 1488 rt2x00_set_field32(&word, TXD_W5_TX_POWER,
1490 TXPOWER_TO_DEV(rt2x00dev->tx_power)); 1489 TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power));
1491 rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); 1490 rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1);
1492 rt2x00_desc_write(txd, 5, word); 1491 rt2x00_desc_write(txd, 5, word);
1493 1492
@@ -1526,7 +1525,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
1526 /* 1525 /*
1527 * Write the TX descriptor for the beacon. 1526 * Write the TX descriptor for the beacon.
1528 */ 1527 */
1529 rt73usb_write_tx_desc(rt2x00dev, entry->skb, txdesc); 1528 rt73usb_write_tx_desc(entry, txdesc);
1530 1529
1531 /* 1530 /*
1532 * Dump beacon to userspace through debugfs. 1531 * Dump beacon to userspace through debugfs.