aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-04-21 13:00:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:21 -0400
commite58c6aca99357d7f85f18e0b661d8c5a87f926a9 (patch)
tree8f7f5c3b78a1beae3121d8fbe95d21a21e361df9 /drivers/net/wireless/rt2x00
parent62e70cf8568151a41e8525ddf0e56c0380a71cfd (diff)
rt2x00: Use rt2x00 queue numbering
Use the rt2x00 queue enumeration as much as possible, removing the usage of the mac80211 queue numbering wherever it is possible. This makes it easier for mac80211 to change it queue identification scheme without having to deal with big changes in the rt2x00 code. 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')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c32
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c35
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c13
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h40
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c27
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c15
12 files changed, 80 insertions, 116 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 560b9c73c0b9..705bc2d41dc1 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1055,11 +1055,11 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1055 * TX data initialization 1055 * TX data initialization
1056 */ 1056 */
1057static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1057static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1058 const unsigned int queue) 1058 const enum data_queue_qid queue)
1059{ 1059{
1060 u32 reg; 1060 u32 reg;
1061 1061
1062 if (queue == RT2X00_BCN_QUEUE_BEACON) { 1062 if (queue == QID_BEACON) {
1063 rt2x00pci_register_read(rt2x00dev, CSR14, &reg); 1063 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1064 if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) { 1064 if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
1065 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1); 1065 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
@@ -1071,12 +1071,9 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1071 } 1071 }
1072 1072
1073 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1073 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1074 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, 1074 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE));
1075 (queue == IEEE80211_TX_QUEUE_DATA0)); 1075 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK));
1076 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, 1076 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue == QID_ATIM));
1077 (queue == IEEE80211_TX_QUEUE_DATA1));
1078 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM,
1079 (queue == RT2X00_BCN_QUEUE_ATIM));
1080 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); 1077 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1081} 1078}
1082 1079
@@ -1120,7 +1117,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
1120 * Interrupt functions. 1117 * Interrupt functions.
1121 */ 1118 */
1122static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, 1119static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev,
1123 const enum ieee80211_tx_queue queue_idx) 1120 const enum data_queue_qid queue_idx)
1124{ 1121{
1125 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 1122 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
1126 struct queue_entry_priv_pci_tx *priv_tx; 1123 struct queue_entry_priv_pci_tx *priv_tx;
@@ -1187,19 +1184,19 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)
1187 * 3 - Atim ring transmit done interrupt. 1184 * 3 - Atim ring transmit done interrupt.
1188 */ 1185 */
1189 if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING)) 1186 if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING))
1190 rt2400pci_txdone(rt2x00dev, RT2X00_BCN_QUEUE_ATIM); 1187 rt2400pci_txdone(rt2x00dev, QID_ATIM);
1191 1188
1192 /* 1189 /*
1193 * 4 - Priority ring transmit done interrupt. 1190 * 4 - Priority ring transmit done interrupt.
1194 */ 1191 */
1195 if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) 1192 if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING))
1196 rt2400pci_txdone(rt2x00dev, IEEE80211_TX_QUEUE_DATA0); 1193 rt2400pci_txdone(rt2x00dev, QID_AC_BE);
1197 1194
1198 /* 1195 /*
1199 * 5 - Tx ring transmit done interrupt. 1196 * 5 - Tx ring transmit done interrupt.
1200 */ 1197 */
1201 if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) 1198 if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING))
1202 rt2400pci_txdone(rt2x00dev, IEEE80211_TX_QUEUE_DATA1); 1199 rt2400pci_txdone(rt2x00dev, QID_AC_BK);
1203 1200
1204 return IRQ_HANDLED; 1201 return IRQ_HANDLED;
1205} 1202}
@@ -1521,20 +1518,13 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1521 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 1518 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1522 1519
1523 /* 1520 /*
1524 * mac80211 doesn't provide the control->queue variable
1525 * for beacons. Set our own queue identification so
1526 * it can be used during descriptor initialization.
1527 */
1528 control->queue = RT2X00_BCN_QUEUE_BEACON;
1529 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
1530
1531 /*
1532 * Enable beacon generation. 1521 * Enable beacon generation.
1533 * Write entire beacon with descriptor to register, 1522 * Write entire beacon with descriptor to register,
1534 * and kick the beacon generator. 1523 * and kick the beacon generator.
1535 */ 1524 */
1525 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
1536 memcpy(priv_tx->data, skb->data, skb->len); 1526 memcpy(priv_tx->data, skb->data, skb->len);
1537 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue); 1527 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
1538 1528
1539 return 0; 1529 return 0;
1540} 1530}
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index a5ed54b69262..0d53c75d55dd 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -317,8 +317,7 @@ static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
317 struct rt2x00intf_conf *conf, 317 struct rt2x00intf_conf *conf,
318 const unsigned int flags) 318 const unsigned int flags)
319{ 319{
320 struct data_queue *queue = 320 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, QID_BEACON);
321 rt2x00queue_get_queue(rt2x00dev, RT2X00_BCN_QUEUE_BEACON);
322 unsigned int bcn_preload; 321 unsigned int bcn_preload;
323 u32 reg; 322 u32 reg;
324 323
@@ -1210,11 +1209,11 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1210 * TX data initialization 1209 * TX data initialization
1211 */ 1210 */
1212static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1211static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1213 const unsigned int queue) 1212 const enum data_queue_qid queue)
1214{ 1213{
1215 u32 reg; 1214 u32 reg;
1216 1215
1217 if (queue == RT2X00_BCN_QUEUE_BEACON) { 1216 if (queue == QID_BEACON) {
1218 rt2x00pci_register_read(rt2x00dev, CSR14, &reg); 1217 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1219 if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) { 1218 if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
1220 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1); 1219 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
@@ -1226,12 +1225,9 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1226 } 1225 }
1227 1226
1228 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1227 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1229 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, 1228 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE));
1230 (queue == IEEE80211_TX_QUEUE_DATA0)); 1229 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK));
1231 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, 1230 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue == QID_ATIM));
1232 (queue == IEEE80211_TX_QUEUE_DATA1));
1233 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM,
1234 (queue == RT2X00_BCN_QUEUE_ATIM));
1235 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); 1231 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1236} 1232}
1237 1233
@@ -1276,7 +1272,7 @@ static void rt2500pci_fill_rxdone(struct queue_entry *entry,
1276 * Interrupt functions. 1272 * Interrupt functions.
1277 */ 1273 */
1278static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, 1274static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev,
1279 const enum ieee80211_tx_queue queue_idx) 1275 const enum data_queue_qid queue_idx)
1280{ 1276{
1281 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 1277 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
1282 struct queue_entry_priv_pci_tx *priv_tx; 1278 struct queue_entry_priv_pci_tx *priv_tx;
@@ -1343,19 +1339,19 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)
1343 * 3 - Atim ring transmit done interrupt. 1339 * 3 - Atim ring transmit done interrupt.
1344 */ 1340 */
1345 if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING)) 1341 if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING))
1346 rt2500pci_txdone(rt2x00dev, RT2X00_BCN_QUEUE_ATIM); 1342 rt2500pci_txdone(rt2x00dev, QID_ATIM);
1347 1343
1348 /* 1344 /*
1349 * 4 - Priority ring transmit done interrupt. 1345 * 4 - Priority ring transmit done interrupt.
1350 */ 1346 */
1351 if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) 1347 if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING))
1352 rt2500pci_txdone(rt2x00dev, IEEE80211_TX_QUEUE_DATA0); 1348 rt2500pci_txdone(rt2x00dev, QID_AC_BE);
1353 1349
1354 /* 1350 /*
1355 * 5 - Tx ring transmit done interrupt. 1351 * 5 - Tx ring transmit done interrupt.
1356 */ 1352 */
1357 if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) 1353 if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING))
1358 rt2500pci_txdone(rt2x00dev, IEEE80211_TX_QUEUE_DATA1); 1354 rt2500pci_txdone(rt2x00dev, QID_AC_BK);
1359 1355
1360 return IRQ_HANDLED; 1356 return IRQ_HANDLED;
1361} 1357}
@@ -1834,20 +1830,13 @@ static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1834 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 1830 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1835 1831
1836 /* 1832 /*
1837 * mac80211 doesn't provide the control->queue variable
1838 * for beacons. Set our own queue identification so
1839 * it can be used during descriptor initialization.
1840 */
1841 control->queue = RT2X00_BCN_QUEUE_BEACON;
1842 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
1843
1844 /*
1845 * Enable beacon generation. 1833 * Enable beacon generation.
1846 * Write entire beacon with descriptor to register, 1834 * Write entire beacon with descriptor to register,
1847 * and kick the beacon generator. 1835 * and kick the beacon generator.
1848 */ 1836 */
1837 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
1849 memcpy(priv_tx->data, skb->data, skb->len); 1838 memcpy(priv_tx->data, skb->data, skb->len);
1850 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue); 1839 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
1851 1840
1852 return 0; 1841 return 0;
1853} 1842}
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index fdbd0ef2be4b..0dac1f5b5c4a 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1094,11 +1094,11 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1094 * TX data initialization 1094 * TX data initialization
1095 */ 1095 */
1096static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1096static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1097 const unsigned int queue) 1097 const enum data_queue_qid queue)
1098{ 1098{
1099 u16 reg; 1099 u16 reg;
1100 1100
1101 if (queue != RT2X00_BCN_QUEUE_BEACON) 1101 if (queue != QID_BEACON)
1102 return; 1102 return;
1103 1103
1104 rt2500usb_register_read(rt2x00dev, TXRX_CSR19, &reg); 1104 rt2500usb_register_read(rt2x00dev, TXRX_CSR19, &reg);
@@ -1720,12 +1720,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1720 rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0); 1720 rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0);
1721 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); 1721 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1722 1722
1723 /*
1724 * mac80211 doesn't provide the control->queue variable
1725 * for beacons. Set our own queue identification so
1726 * it can be used during descriptor initialization.
1727 */
1728 control->queue = RT2X00_BCN_QUEUE_BEACON;
1729 rt2x00lib_write_tx_desc(rt2x00dev, skb, control); 1723 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
1730 1724
1731 /* 1725 /*
@@ -1757,7 +1751,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1757 /* 1751 /*
1758 * Enable beacon generation. 1752 * Enable beacon generation.
1759 */ 1753 */
1760 rt2500usb_kick_tx_queue(rt2x00dev, control->queue); 1754 rt2500usb_kick_tx_queue(rt2x00dev, QID_BEACON);
1761 1755
1762 return 0; 1756 return 0;
1763} 1757}
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 7a23b00c6895..d85553f6351e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -548,7 +548,7 @@ struct rt2x00lib_ops {
548 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, 548 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
549 struct sk_buff *skb); 549 struct sk_buff *skb);
550 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 550 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
551 const unsigned int queue); 551 const enum data_queue_qid queue);
552 552
553 /* 553 /*
554 * RX control handlers 554 * RX control handlers
@@ -927,13 +927,12 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)
927} 927}
928 928
929/** 929/**
930 * rt2x00queue_get_queue - Convert mac80211 queue index to rt2x00 queue 930 * rt2x00queue_get_queue - Convert queue index to queue pointer
931 * @rt2x00dev: Pointer to &struct rt2x00_dev. 931 * @rt2x00dev: Pointer to &struct rt2x00_dev.
932 * @queue: mac80211/rt2x00 queue index 932 * @queue: rt2x00 queue index (see &enum data_queue_qid).
933 * (see &enum ieee80211_tx_queue and &enum rt2x00_bcn_queue).
934 */ 933 */
935struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, 934struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
936 const unsigned int queue); 935 const enum data_queue_qid queue);
937 936
938/** 937/**
939 * rt2x00queue_get_entry - Get queue entry where the given index points to. 938 * rt2x00queue_get_entry - Get queue entry where the given index points to.
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 8d8657fb64dd..b1a324dead5f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -687,8 +687,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
687 * Beacons and probe responses require the tsf timestamp 687 * Beacons and probe responses require the tsf timestamp
688 * to be inserted into the frame. 688 * to be inserted into the frame.
689 */ 689 */
690 if (control->queue == RT2X00_BCN_QUEUE_BEACON || 690 if (txdesc.queue == QID_BEACON || is_probe_resp(frame_control))
691 is_probe_resp(frame_control))
692 __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc.flags); 691 __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc.flags);
693 692
694 /* 693 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index e078e0ad0d06..d4ceab7646e7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -81,6 +81,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
81{ 81{
82 struct rt2x00_dev *rt2x00dev = hw->priv; 82 struct rt2x00_dev *rt2x00dev = hw->priv;
83 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; 83 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
84 enum data_queue_qid qid = mac80211_queue_to_qid(control->queue);
84 struct data_queue *queue; 85 struct data_queue *queue;
85 struct skb_frame_desc *skbdesc; 86 struct skb_frame_desc *skbdesc;
86 u16 frame_control; 87 u16 frame_control;
@@ -101,14 +102,13 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
101 */ 102 */
102 if (control->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM && 103 if (control->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM &&
103 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) 104 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags))
104 queue = rt2x00queue_get_queue(rt2x00dev, RT2X00_BCN_QUEUE_ATIM); 105 queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM);
105 else 106 else
106 queue = rt2x00queue_get_queue(rt2x00dev, control->queue); 107 queue = rt2x00queue_get_queue(rt2x00dev, qid);
107 if (unlikely(!queue)) { 108 if (unlikely(!queue)) {
108 ERROR(rt2x00dev, 109 ERROR(rt2x00dev,
109 "Attempt to send packet over invalid queue %d.\n" 110 "Attempt to send packet over invalid queue %d.\n"
110 "Please file bug report to %s.\n", 111 "Please file bug report to %s.\n", qid, DRV_PROJECT);
111 control->queue, DRV_PROJECT);
112 dev_kfree_skb_any(skb); 112 dev_kfree_skb_any(skb);
113 return NETDEV_TX_OK; 113 return NETDEV_TX_OK;
114 } 114 }
@@ -154,7 +154,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
154 ieee80211_stop_queue(rt2x00dev->hw, control->queue); 154 ieee80211_stop_queue(rt2x00dev->hw, control->queue);
155 155
156 if (rt2x00dev->ops->lib->kick_tx_queue) 156 if (rt2x00dev->ops->lib->kick_tx_queue)
157 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue); 157 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, qid);
158 158
159 return NETDEV_TX_OK; 159 return NETDEV_TX_OK;
160} 160}
@@ -187,8 +187,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
187{ 187{
188 struct rt2x00_dev *rt2x00dev = hw->priv; 188 struct rt2x00_dev *rt2x00dev = hw->priv;
189 struct rt2x00_intf *intf = vif_to_intf(conf->vif); 189 struct rt2x00_intf *intf = vif_to_intf(conf->vif);
190 struct data_queue *queue = 190 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, QID_BEACON);
191 rt2x00queue_get_queue(rt2x00dev, RT2X00_BCN_QUEUE_BEACON);
192 struct queue_entry *entry = NULL; 191 struct queue_entry *entry = NULL;
193 unsigned int i; 192 unsigned int i;
194 193
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 7867ec64bd2c..9e5d94e44c5c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -53,7 +53,7 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
53 ERROR(rt2x00dev, 53 ERROR(rt2x00dev,
54 "Arrived at non-free entry in the non-full queue %d.\n" 54 "Arrived at non-free entry in the non-full queue %d.\n"
55 "Please file bug report to %s.\n", 55 "Please file bug report to %s.\n",
56 control->queue, DRV_PROJECT); 56 entry->queue->qid, DRV_PROJECT);
57 return -EINVAL; 57 return -EINVAL;
58 } 58 }
59 59
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 659e9f44c40c..e5b861f8416d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -30,7 +30,7 @@
30#include "rt2x00lib.h" 30#include "rt2x00lib.h"
31 31
32struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, 32struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
33 const unsigned int queue) 33 const enum data_queue_qid queue)
34{ 34{
35 int atim = test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 35 int atim = test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
36 36
@@ -40,9 +40,9 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
40 if (!rt2x00dev->bcn) 40 if (!rt2x00dev->bcn)
41 return NULL; 41 return NULL;
42 42
43 if (queue == RT2X00_BCN_QUEUE_BEACON) 43 if (queue == QID_BEACON)
44 return &rt2x00dev->bcn[0]; 44 return &rt2x00dev->bcn[0];
45 else if (queue == RT2X00_BCN_QUEUE_ATIM && atim) 45 else if (queue == QID_ATIM && atim)
46 return &rt2x00dev->bcn[1]; 46 return &rt2x00dev->bcn[1];
47 47
48 return NULL; 48 return NULL;
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 7027c9f47d3f..29fe26525550 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -54,6 +54,17 @@
54 54
55/** 55/**
56 * enum data_queue_qid: Queue identification 56 * enum data_queue_qid: Queue identification
57 *
58 * @QID_AC_BE: AC BE queue
59 * @QID_AC_BK: AC BK queue
60 * @QID_AC_VI: AC VI queue
61 * @QID_AC_VO: AC VO queue
62 * @QID_HCCA: HCCA queue
63 * @QID_MGMT: MGMT queue (prio queue)
64 * @QID_RX: RX queue
65 * @QID_OTHER: None of the above (don't use, only present for completeness)
66 * @QID_BEACON: Beacon queue (value unspecified, don't send it to device)
67 * @QID_ATIM: Atim queue (value unspeficied, don't send it to device)
57 */ 68 */
58enum data_queue_qid { 69enum data_queue_qid {
59 QID_AC_BE = 0, 70 QID_AC_BE = 0,
@@ -64,22 +75,25 @@ enum data_queue_qid {
64 QID_MGMT = 13, 75 QID_MGMT = 13,
65 QID_RX = 14, 76 QID_RX = 14,
66 QID_OTHER = 15, 77 QID_OTHER = 15,
78 QID_BEACON,
79 QID_ATIM,
67}; 80};
68 81
69/** 82/**
70 * enum rt2x00_bcn_queue: Beacon queue index 83 * mac80211_queue_to_qid - Convert mac80211 queue to rt2x00 qid
71 * 84 * @queue: mac80211 queue.
72 * Start counting with a high offset, this because this enumeration
73 * supplements &enum ieee80211_tx_queue and we should prevent value
74 * conflicts.
75 *
76 * @RT2X00_BCN_QUEUE_BEACON: Beacon queue
77 * @RT2X00_BCN_QUEUE_ATIM: Atim queue (sends frame after beacon)
78 */ 85 */
79enum rt2x00_bcn_queue { 86static inline enum data_queue_qid mac80211_queue_to_qid(unsigned int queue)
80 RT2X00_BCN_QUEUE_BEACON = 100, 87{
81 RT2X00_BCN_QUEUE_ATIM = 101, 88 /* Regular TX queues are mapped directly */
82}; 89 if (queue < NUM_TX_DATA_QUEUES)
90 return queue;
91 else if (queue == IEEE80211_TX_QUEUE_BEACON)
92 return QID_BEACON;
93 else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON)
94 return QID_ATIM;
95 return QID_OTHER;
96}
83 97
84/** 98/**
85 * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc 99 * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc
@@ -105,7 +119,6 @@ enum skb_frame_desc_flags {
105 * of the scope of the skb->data pointer. 119 * of the scope of the skb->data pointer.
106 * @data_len: Length of the frame data. 120 * @data_len: Length of the frame data.
107 * @desc_len: Length of the frame descriptor. 121 * @desc_len: Length of the frame descriptor.
108
109 * @entry: The entry to which this sk buffer belongs. 122 * @entry: The entry to which this sk buffer belongs.
110 */ 123 */
111struct skb_frame_desc { 124struct skb_frame_desc {
@@ -240,7 +253,6 @@ struct txentry_desc {
240 * encryption or decryption. The entry should only be touched after 253 * encryption or decryption. The entry should only be touched after
241 * the device has signaled it is done with it. 254 * the device has signaled it is done with it.
242 */ 255 */
243
244enum queue_entry_flags { 256enum queue_entry_flags {
245 ENTRY_BCN_ASSIGNED, 257 ENTRY_BCN_ASSIGNED,
246 ENTRY_OWNER_DEVICE_DATA, 258 ENTRY_OWNER_DEVICE_DATA,
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 5a331674dcb2..47f96b34087e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -186,7 +186,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
186 ERROR(rt2x00dev, 186 ERROR(rt2x00dev,
187 "Arrived at non-free entry in the non-full queue %d.\n" 187 "Arrived at non-free entry in the non-full queue %d.\n"
188 "Please file bug report to %s.\n", 188 "Please file bug report to %s.\n",
189 control->queue, DRV_PROJECT); 189 entry->queue->qid, DRV_PROJECT);
190 return -EINVAL; 190 return -EINVAL;
191 } 191 }
192 192
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index ae12dcdd3c24..98af4d26583d 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1591,11 +1591,11 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1591 * TX data initialization 1591 * TX data initialization
1592 */ 1592 */
1593static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1593static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1594 const unsigned int queue) 1594 const enum data_queue_qid queue)
1595{ 1595{
1596 u32 reg; 1596 u32 reg;
1597 1597
1598 if (queue == RT2X00_BCN_QUEUE_BEACON) { 1598 if (queue == QID_BEACON) {
1599 /* 1599 /*
1600 * For Wi-Fi faily generated beacons between participating 1600 * For Wi-Fi faily generated beacons between participating
1601 * stations. Set TBTT phase adaptive adjustment step to 8us. 1601 * stations. Set TBTT phase adaptive adjustment step to 8us.
@@ -1613,14 +1613,10 @@ static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1613 } 1613 }
1614 1614
1615 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg); 1615 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
1616 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, 1616 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE));
1617 (queue == IEEE80211_TX_QUEUE_DATA0)); 1617 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK));
1618 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, 1618 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC2, (queue == QID_AC_VI));
1619 (queue == IEEE80211_TX_QUEUE_DATA1)); 1619 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC3, (queue == QID_AC_VO));
1620 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC2,
1621 (queue == IEEE80211_TX_QUEUE_DATA2));
1622 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC3,
1623 (queue == IEEE80211_TX_QUEUE_DATA3));
1624 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); 1620 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
1625} 1621}
1626 1622
@@ -2412,21 +2408,14 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2412 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); 2408 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
2413 2409
2414 /* 2410 /*
2415 * mac80211 doesn't provide the control->queue variable
2416 * for beacons. Set our own queue identification so
2417 * it can be used during descriptor initialization.
2418 */
2419 control->queue = RT2X00_BCN_QUEUE_BEACON;
2420 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
2421
2422 /*
2423 * Write entire beacon with descriptor to register, 2411 * Write entire beacon with descriptor to register,
2424 * and kick the beacon generator. 2412 * and kick the beacon generator.
2425 */ 2413 */
2414 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
2426 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); 2415 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx);
2427 rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, 2416 rt2x00pci_register_multiwrite(rt2x00dev, beacon_base,
2428 skb->data, skb->len); 2417 skb->data, skb->len);
2429 rt61pci_kick_tx_queue(rt2x00dev, control->queue); 2418 rt61pci_kick_tx_queue(rt2x00dev, QID_BEACON);
2430 2419
2431 return 0; 2420 return 0;
2432} 2421}
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index da19a3a91f4d..a6419c900772 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1331,11 +1331,11 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1331 * TX data initialization 1331 * TX data initialization
1332 */ 1332 */
1333static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1333static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1334 const unsigned int queue) 1334 const enum data_queue_qid queue)
1335{ 1335{
1336 u32 reg; 1336 u32 reg;
1337 1337
1338 if (queue != RT2X00_BCN_QUEUE_BEACON) 1338 if (queue != QID_BEACON)
1339 return; 1339 return;
1340 1340
1341 /* 1341 /*
@@ -2001,23 +2001,16 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2001 rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg); 2001 rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg);
2002 2002
2003 /* 2003 /*
2004 * mac80211 doesn't provide the control->queue variable
2005 * for beacons. Set our own queue identification so
2006 * it can be used during descriptor initialization.
2007 */
2008 control->queue = RT2X00_BCN_QUEUE_BEACON;
2009 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
2010
2011 /*
2012 * Write entire beacon with descriptor to register, 2004 * Write entire beacon with descriptor to register,
2013 * and kick the beacon generator. 2005 * and kick the beacon generator.
2014 */ 2006 */
2007 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
2015 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); 2008 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx);
2016 timeout = REGISTER_TIMEOUT * (skb->len / sizeof(u32)); 2009 timeout = REGISTER_TIMEOUT * (skb->len / sizeof(u32));
2017 rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, 2010 rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
2018 USB_VENDOR_REQUEST_OUT, beacon_base, 0, 2011 USB_VENDOR_REQUEST_OUT, beacon_base, 0,
2019 skb->data, skb->len, timeout); 2012 skb->data, skb->len, timeout);
2020 rt73usb_kick_tx_queue(rt2x00dev, control->queue); 2013 rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON);
2021 2014
2022 return 0; 2015 return 0;
2023} 2016}