diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 66 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 178 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 166 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 176 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.h | 40 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00crypto.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00ht.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00reg.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 41 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 51 |
16 files changed, 374 insertions, 447 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 06b92f8b7a5..6126c0ab588 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1060,7 +1060,8 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1060 | /* | 1060 | /* |
1061 | * TX data initialization | 1061 | * TX data initialization |
1062 | */ | 1062 | */ |
1063 | static void rt2400pci_write_beacon(struct queue_entry *entry) | 1063 | static void rt2400pci_write_beacon(struct queue_entry *entry, |
1064 | struct txentry_desc *txdesc) | ||
1064 | { | 1065 | { |
1065 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1066 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1066 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 1067 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
@@ -1090,6 +1091,14 @@ static void rt2400pci_write_beacon(struct queue_entry *entry) | |||
1090 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1091 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
1091 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1092 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1092 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1093 | rt2x00_desc_write(entry_priv->desc, 1, word); |
1094 | |||
1095 | /* | ||
1096 | * Enable beaconing again. | ||
1097 | */ | ||
1098 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1099 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1100 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1101 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1093 | } | 1102 | } |
1094 | 1103 | ||
1095 | static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1104 | static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, |
@@ -1097,17 +1106,6 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1097 | { | 1106 | { |
1098 | u32 reg; | 1107 | u32 reg; |
1099 | 1108 | ||
1100 | if (queue == QID_BEACON) { | ||
1101 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
1102 | if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) { | ||
1103 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1104 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1105 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1106 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1107 | } | ||
1108 | return; | ||
1109 | } | ||
1110 | |||
1111 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1109 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1112 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1110 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); |
1113 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1111 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index ae8e205df26..2e4f461406a 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1217,7 +1217,8 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1217 | /* | 1217 | /* |
1218 | * TX data initialization | 1218 | * TX data initialization |
1219 | */ | 1219 | */ |
1220 | static void rt2500pci_write_beacon(struct queue_entry *entry) | 1220 | static void rt2500pci_write_beacon(struct queue_entry *entry, |
1221 | struct txentry_desc *txdesc) | ||
1221 | { | 1222 | { |
1222 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1223 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1223 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 1224 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
@@ -1247,6 +1248,14 @@ static void rt2500pci_write_beacon(struct queue_entry *entry) | |||
1247 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1248 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
1248 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1249 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1249 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1250 | rt2x00_desc_write(entry_priv->desc, 1, word); |
1251 | |||
1252 | /* | ||
1253 | * Enable beaconing again. | ||
1254 | */ | ||
1255 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1256 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1257 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1258 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1250 | } | 1259 | } |
1251 | 1260 | ||
1252 | static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1261 | static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, |
@@ -1254,17 +1263,6 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1254 | { | 1263 | { |
1255 | u32 reg; | 1264 | u32 reg; |
1256 | 1265 | ||
1257 | if (queue == QID_BEACON) { | ||
1258 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
1259 | if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) { | ||
1260 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1261 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1262 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1263 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1264 | } | ||
1265 | return; | ||
1266 | } | ||
1267 | |||
1268 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1266 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1269 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1267 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); |
1270 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1268 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 41d9996c80e..e88d7033fbc 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1083,7 +1083,8 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1083 | */ | 1083 | */ |
1084 | static void rt2500usb_beacondone(struct urb *urb); | 1084 | static void rt2500usb_beacondone(struct urb *urb); |
1085 | 1085 | ||
1086 | static void rt2500usb_write_beacon(struct queue_entry *entry) | 1086 | static void rt2500usb_write_beacon(struct queue_entry *entry, |
1087 | struct txentry_desc *txdesc) | ||
1087 | { | 1088 | { |
1088 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1089 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1089 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | 1090 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
@@ -1091,7 +1092,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) | |||
1091 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1092 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1092 | int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); | 1093 | int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); |
1093 | int length; | 1094 | int length; |
1094 | u16 reg; | 1095 | u16 reg, reg0; |
1095 | 1096 | ||
1096 | /* | 1097 | /* |
1097 | * Add the descriptor in front of the skb. | 1098 | * Add the descriptor in front of the skb. |
@@ -1133,6 +1134,26 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) | |||
1133 | * Send out the guardian byte. | 1134 | * Send out the guardian byte. |
1134 | */ | 1135 | */ |
1135 | usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC); | 1136 | usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC); |
1137 | |||
1138 | /* | ||
1139 | * Enable beaconing again. | ||
1140 | */ | ||
1141 | rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); | ||
1142 | rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); | ||
1143 | reg0 = reg; | ||
1144 | rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); | ||
1145 | /* | ||
1146 | * Beacon generation will fail initially. | ||
1147 | * To prevent this we need to change the TXRX_CSR19 | ||
1148 | * register several times (reg0 is the same as reg | ||
1149 | * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0 | ||
1150 | * and 1 in reg). | ||
1151 | */ | ||
1152 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1153 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1154 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1155 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1156 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1136 | } | 1157 | } |
1137 | 1158 | ||
1138 | static int rt2500usb_get_tx_data_len(struct queue_entry *entry) | 1159 | static int rt2500usb_get_tx_data_len(struct queue_entry *entry) |
@@ -1149,37 +1170,6 @@ static int rt2500usb_get_tx_data_len(struct queue_entry *entry) | |||
1149 | return length; | 1170 | return length; |
1150 | } | 1171 | } |
1151 | 1172 | ||
1152 | static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
1153 | const enum data_queue_qid queue) | ||
1154 | { | ||
1155 | u16 reg, reg0; | ||
1156 | |||
1157 | if (queue != QID_BEACON) { | ||
1158 | rt2x00usb_kick_tx_queue(rt2x00dev, queue); | ||
1159 | return; | ||
1160 | } | ||
1161 | |||
1162 | rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); | ||
1163 | if (!rt2x00_get_field16(reg, TXRX_CSR19_BEACON_GEN)) { | ||
1164 | rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); | ||
1165 | rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); | ||
1166 | reg0 = reg; | ||
1167 | rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); | ||
1168 | /* | ||
1169 | * Beacon generation will fail initially. | ||
1170 | * To prevent this we need to change the TXRX_CSR19 | ||
1171 | * register several times (reg0 is the same as reg | ||
1172 | * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0 | ||
1173 | * and 1 in reg). | ||
1174 | */ | ||
1175 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1176 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1177 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1178 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1179 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1180 | } | ||
1181 | } | ||
1182 | |||
1183 | /* | 1173 | /* |
1184 | * RX control handlers | 1174 | * RX control handlers |
1185 | */ | 1175 | */ |
@@ -1214,11 +1204,9 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, | |||
1214 | if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) | 1204 | if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) |
1215 | rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; | 1205 | rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; |
1216 | 1206 | ||
1217 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 1207 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); |
1218 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); | 1208 | if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) |
1219 | if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) | 1209 | rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY; |
1220 | rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY; | ||
1221 | } | ||
1222 | 1210 | ||
1223 | if (rxdesc->cipher != CIPHER_NONE) { | 1211 | if (rxdesc->cipher != CIPHER_NONE) { |
1224 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); | 1212 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); |
@@ -1780,7 +1768,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1780 | .write_tx_data = rt2x00usb_write_tx_data, | 1768 | .write_tx_data = rt2x00usb_write_tx_data, |
1781 | .write_beacon = rt2500usb_write_beacon, | 1769 | .write_beacon = rt2500usb_write_beacon, |
1782 | .get_tx_data_len = rt2500usb_get_tx_data_len, | 1770 | .get_tx_data_len = rt2500usb_get_tx_data_len, |
1783 | .kick_tx_queue = rt2500usb_kick_tx_queue, | 1771 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
1784 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 1772 | .kill_tx_queue = rt2x00usb_kill_tx_queue, |
1785 | .fill_rxdone = rt2500usb_fill_rxdone, | 1773 | .fill_rxdone = rt2500usb_fill_rxdone, |
1786 | .config_shared_key = rt2500usb_config_key, | 1774 | .config_shared_key = rt2500usb_config_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index e37bbeab923..db4250d1c8b 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -282,6 +282,104 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) | |||
282 | } | 282 | } |
283 | EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); | 283 | EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); |
284 | 284 | ||
285 | void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc) | ||
286 | { | ||
287 | __le32 *txwi = (__le32 *)(skb->data - TXWI_DESC_SIZE); | ||
288 | u32 word; | ||
289 | |||
290 | /* | ||
291 | * Initialize TX Info descriptor | ||
292 | */ | ||
293 | rt2x00_desc_read(txwi, 0, &word); | ||
294 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
295 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
296 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
297 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
298 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
299 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
300 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
301 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
302 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
303 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop); | ||
304 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
305 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
306 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
307 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
308 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
309 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
310 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
311 | rt2x00_desc_write(txwi, 0, word); | ||
312 | |||
313 | rt2x00_desc_read(txwi, 1, &word); | ||
314 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
315 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
316 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
317 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
318 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
319 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
320 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
321 | txdesc->key_idx : 0xff); | ||
322 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
323 | txdesc->length); | ||
324 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, txdesc->queue + 1); | ||
325 | rt2x00_desc_write(txwi, 1, word); | ||
326 | |||
327 | /* | ||
328 | * Always write 0 to IV/EIV fields, hardware will insert the IV | ||
329 | * from the IVEIV register when TXD_W3_WIV is set to 0. | ||
330 | * When TXD_W3_WIV is set to 1 it will use the IV data | ||
331 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
332 | * crypto entry in the registers should be used to encrypt the frame. | ||
333 | */ | ||
334 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
335 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
336 | } | ||
337 | EXPORT_SYMBOL_GPL(rt2800_write_txwi); | ||
338 | |||
339 | void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *rxdesc) | ||
340 | { | ||
341 | __le32 *rxwi = (__le32 *) skb->data; | ||
342 | u32 word; | ||
343 | |||
344 | rt2x00_desc_read(rxwi, 0, &word); | ||
345 | |||
346 | rxdesc->cipher = rt2x00_get_field32(word, RXWI_W0_UDF); | ||
347 | rxdesc->size = rt2x00_get_field32(word, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); | ||
348 | |||
349 | rt2x00_desc_read(rxwi, 1, &word); | ||
350 | |||
351 | if (rt2x00_get_field32(word, RXWI_W1_SHORT_GI)) | ||
352 | rxdesc->flags |= RX_FLAG_SHORT_GI; | ||
353 | |||
354 | if (rt2x00_get_field32(word, RXWI_W1_BW)) | ||
355 | rxdesc->flags |= RX_FLAG_40MHZ; | ||
356 | |||
357 | /* | ||
358 | * Detect RX rate, always use MCS as signal type. | ||
359 | */ | ||
360 | rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; | ||
361 | rxdesc->signal = rt2x00_get_field32(word, RXWI_W1_MCS); | ||
362 | rxdesc->rate_mode = rt2x00_get_field32(word, RXWI_W1_PHYMODE); | ||
363 | |||
364 | /* | ||
365 | * Mask of 0x8 bit to remove the short preamble flag. | ||
366 | */ | ||
367 | if (rxdesc->rate_mode == RATE_MODE_CCK) | ||
368 | rxdesc->signal &= ~0x8; | ||
369 | |||
370 | rt2x00_desc_read(rxwi, 2, &word); | ||
371 | |||
372 | rxdesc->rssi = | ||
373 | (rt2x00_get_field32(word, RXWI_W2_RSSI0) + | ||
374 | rt2x00_get_field32(word, RXWI_W2_RSSI1)) / 2; | ||
375 | |||
376 | /* | ||
377 | * Remove RXWI descriptor from start of buffer. | ||
378 | */ | ||
379 | skb_pull(skb, RXWI_DESC_SIZE); | ||
380 | } | ||
381 | EXPORT_SYMBOL_GPL(rt2800_process_rxwi); | ||
382 | |||
285 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 383 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
286 | const struct rt2x00debug rt2800_rt2x00debug = { | 384 | const struct rt2x00debug rt2800_rt2x00debug = { |
287 | .owner = THIS_MODULE, | 385 | .owner = THIS_MODULE, |
@@ -640,8 +738,6 @@ void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp) | |||
640 | rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); | 738 | rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); |
641 | 739 | ||
642 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); | 740 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); |
643 | rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, erp->sifs); | ||
644 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, erp->sifs); | ||
645 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, erp->eifs); | 741 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, erp->eifs); |
646 | rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); | 742 | rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); |
647 | 743 | ||
@@ -1415,9 +1511,16 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1415 | 1511 | ||
1416 | rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); | 1512 | rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); |
1417 | 1513 | ||
1514 | /* | ||
1515 | * Usually the CCK SIFS time should be set to 10 and the OFDM SIFS | ||
1516 | * time should be set to 16. However, the original Ralink driver uses | ||
1517 | * 16 for both and indeed using a value of 10 for CCK SIFS results in | ||
1518 | * connection problems with 11g + CTS protection. Hence, use the same | ||
1519 | * defaults as the Ralink driver: 16 for both, CCK and OFDM SIFS. | ||
1520 | */ | ||
1418 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); | 1521 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); |
1419 | rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, 32); | 1522 | rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, 16); |
1420 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, 32); | 1523 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, 16); |
1421 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); | 1524 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); |
1422 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, 314); | 1525 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, 314); |
1423 | rt2x00_set_field32(®, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); | 1526 | rt2x00_set_field32(®, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); |
@@ -2219,7 +2322,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2219 | EXPORT_SYMBOL_GPL(rt2800_init_eeprom); | 2322 | EXPORT_SYMBOL_GPL(rt2800_init_eeprom); |
2220 | 2323 | ||
2221 | /* | 2324 | /* |
2222 | * RF value list for rt28x0 | 2325 | * RF value list for rt28xx |
2223 | * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) | 2326 | * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) |
2224 | */ | 2327 | */ |
2225 | static const struct rf_channel rf_vals[] = { | 2328 | static const struct rf_channel rf_vals[] = { |
@@ -2294,10 +2397,10 @@ static const struct rf_channel rf_vals[] = { | |||
2294 | }; | 2397 | }; |
2295 | 2398 | ||
2296 | /* | 2399 | /* |
2297 | * RF value list for rt3070 | 2400 | * RF value list for rt3xxx |
2298 | * Supports: 2.4 GHz | 2401 | * Supports: 2.4 GHz (all) & 5.2 GHz (RF3052) |
2299 | */ | 2402 | */ |
2300 | static const struct rf_channel rf_vals_302x[] = { | 2403 | static const struct rf_channel rf_vals_3x[] = { |
2301 | {1, 241, 2, 2 }, | 2404 | {1, 241, 2, 2 }, |
2302 | {2, 241, 2, 7 }, | 2405 | {2, 241, 2, 7 }, |
2303 | {3, 242, 2, 2 }, | 2406 | {3, 242, 2, 2 }, |
@@ -2312,6 +2415,51 @@ static const struct rf_channel rf_vals_302x[] = { | |||
2312 | {12, 246, 2, 7 }, | 2415 | {12, 246, 2, 7 }, |
2313 | {13, 247, 2, 2 }, | 2416 | {13, 247, 2, 2 }, |
2314 | {14, 248, 2, 4 }, | 2417 | {14, 248, 2, 4 }, |
2418 | |||
2419 | /* 802.11 UNI / HyperLan 2 */ | ||
2420 | {36, 0x56, 0, 4}, | ||
2421 | {38, 0x56, 0, 6}, | ||
2422 | {40, 0x56, 0, 8}, | ||
2423 | {44, 0x57, 0, 0}, | ||
2424 | {46, 0x57, 0, 2}, | ||
2425 | {48, 0x57, 0, 4}, | ||
2426 | {52, 0x57, 0, 8}, | ||
2427 | {54, 0x57, 0, 10}, | ||
2428 | {56, 0x58, 0, 0}, | ||
2429 | {60, 0x58, 0, 4}, | ||
2430 | {62, 0x58, 0, 6}, | ||
2431 | {64, 0x58, 0, 8}, | ||
2432 | |||
2433 | /* 802.11 HyperLan 2 */ | ||
2434 | {100, 0x5b, 0, 8}, | ||
2435 | {102, 0x5b, 0, 10}, | ||
2436 | {104, 0x5c, 0, 0}, | ||
2437 | {108, 0x5c, 0, 4}, | ||
2438 | {110, 0x5c, 0, 6}, | ||
2439 | {112, 0x5c, 0, 8}, | ||
2440 | {116, 0x5d, 0, 0}, | ||
2441 | {118, 0x5d, 0, 2}, | ||
2442 | {120, 0x5d, 0, 4}, | ||
2443 | {124, 0x5d, 0, 8}, | ||
2444 | {126, 0x5d, 0, 10}, | ||
2445 | {128, 0x5e, 0, 0}, | ||
2446 | {132, 0x5e, 0, 4}, | ||
2447 | {134, 0x5e, 0, 6}, | ||
2448 | {136, 0x5e, 0, 8}, | ||
2449 | {140, 0x5f, 0, 0}, | ||
2450 | |||
2451 | /* 802.11 UNII */ | ||
2452 | {149, 0x5f, 0, 9}, | ||
2453 | {151, 0x5f, 0, 11}, | ||
2454 | {153, 0x60, 0, 1}, | ||
2455 | {157, 0x60, 0, 5}, | ||
2456 | {159, 0x60, 0, 7}, | ||
2457 | {161, 0x60, 0, 9}, | ||
2458 | {165, 0x61, 0, 1}, | ||
2459 | {167, 0x61, 0, 3}, | ||
2460 | {169, 0x61, 0, 5}, | ||
2461 | {171, 0x61, 0, 7}, | ||
2462 | {173, 0x61, 0, 9}, | ||
2315 | }; | 2463 | }; |
2316 | 2464 | ||
2317 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | 2465 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) |
@@ -2352,11 +2500,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2352 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; | 2500 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; |
2353 | 2501 | ||
2354 | if (rt2x00_rf(rt2x00dev, RF2820) || | 2502 | if (rt2x00_rf(rt2x00dev, RF2820) || |
2355 | rt2x00_rf(rt2x00dev, RF2720) || | 2503 | rt2x00_rf(rt2x00dev, RF2720)) { |
2356 | rt2x00_rf(rt2x00dev, RF3052)) { | ||
2357 | spec->num_channels = 14; | 2504 | spec->num_channels = 14; |
2358 | spec->channels = rf_vals; | 2505 | spec->channels = rf_vals; |
2359 | } else if (rt2x00_rf(rt2x00dev, RF2850) || rt2x00_rf(rt2x00dev, RF2750)) { | 2506 | } else if (rt2x00_rf(rt2x00dev, RF2850) || |
2507 | rt2x00_rf(rt2x00dev, RF2750)) { | ||
2360 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 2508 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
2361 | spec->num_channels = ARRAY_SIZE(rf_vals); | 2509 | spec->num_channels = ARRAY_SIZE(rf_vals); |
2362 | spec->channels = rf_vals; | 2510 | spec->channels = rf_vals; |
@@ -2364,8 +2512,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2364 | rt2x00_rf(rt2x00dev, RF2020) || | 2512 | rt2x00_rf(rt2x00dev, RF2020) || |
2365 | rt2x00_rf(rt2x00dev, RF3021) || | 2513 | rt2x00_rf(rt2x00dev, RF3021) || |
2366 | rt2x00_rf(rt2x00dev, RF3022)) { | 2514 | rt2x00_rf(rt2x00dev, RF3022)) { |
2367 | spec->num_channels = ARRAY_SIZE(rf_vals_302x); | 2515 | spec->num_channels = 14; |
2368 | spec->channels = rf_vals_302x; | 2516 | spec->channels = rf_vals_3x; |
2517 | } else if (rt2x00_rf(rt2x00dev, RF3052)) { | ||
2518 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | ||
2519 | spec->num_channels = ARRAY_SIZE(rf_vals_3x); | ||
2520 | spec->channels = rf_vals_3x; | ||
2369 | } | 2521 | } |
2370 | 2522 | ||
2371 | /* | 2523 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index ebabeae62d1..94de999e229 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -111,6 +111,9 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | |||
111 | const u8 command, const u8 token, | 111 | const u8 command, const u8 token, |
112 | const u8 arg0, const u8 arg1); | 112 | const u8 arg0, const u8 arg1); |
113 | 113 | ||
114 | void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc); | ||
115 | void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *txdesc); | ||
116 | |||
114 | extern const struct rt2x00debug rt2800_rt2x00debug; | 117 | extern const struct rt2x00debug rt2800_rt2x00debug; |
115 | 118 | ||
116 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); | 119 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index f08b6a37bf2..7d4778d66e7 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -616,67 +616,13 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
616 | static int rt2800pci_write_tx_data(struct queue_entry* entry, | 616 | static int rt2800pci_write_tx_data(struct queue_entry* entry, |
617 | struct txentry_desc *txdesc) | 617 | struct txentry_desc *txdesc) |
618 | { | 618 | { |
619 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
620 | struct sk_buff *skb = entry->skb; | ||
621 | struct skb_frame_desc *skbdesc; | ||
622 | int ret; | 619 | int ret; |
623 | __le32 *txwi; | ||
624 | u32 word; | ||
625 | 620 | ||
626 | ret = rt2x00pci_write_tx_data(entry, txdesc); | 621 | ret = rt2x00pci_write_tx_data(entry, txdesc); |
627 | if (ret) | 622 | if (ret) |
628 | return ret; | 623 | return ret; |
629 | 624 | ||
630 | skbdesc = get_skb_frame_desc(skb); | 625 | rt2800_write_txwi(entry->skb, txdesc); |
631 | txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom); | ||
632 | |||
633 | /* | ||
634 | * Initialize TX Info descriptor | ||
635 | */ | ||
636 | rt2x00_desc_read(txwi, 0, &word); | ||
637 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
638 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
639 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
640 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
641 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
642 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
643 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
644 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
645 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
646 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs); | ||
647 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
648 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
649 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
650 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
651 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
652 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
653 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
654 | rt2x00_desc_write(txwi, 0, word); | ||
655 | |||
656 | rt2x00_desc_read(txwi, 1, &word); | ||
657 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
658 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
659 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
660 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
661 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
662 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
663 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
664 | txdesc->key_idx : 0xff); | ||
665 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
666 | txdesc->length); | ||
667 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
668 | skbdesc->entry->queue->qid + 1); | ||
669 | rt2x00_desc_write(txwi, 1, word); | ||
670 | |||
671 | /* | ||
672 | * Always write 0 to IV/EIV fields, hardware will insert the IV | ||
673 | * from the IVEIV register when TXD_W3_WIV is set to 0. | ||
674 | * When TXD_W3_WIV is set to 1 it will use the IV data | ||
675 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
676 | * crypto entry in the registers should be used to encrypt the frame. | ||
677 | */ | ||
678 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
679 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
680 | 626 | ||
681 | return 0; | 627 | return 0; |
682 | } | 628 | } |
@@ -732,10 +678,10 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
732 | /* | 678 | /* |
733 | * TX data initialization | 679 | * TX data initialization |
734 | */ | 680 | */ |
735 | static void rt2800pci_write_beacon(struct queue_entry *entry) | 681 | static void rt2800pci_write_beacon(struct queue_entry *entry, |
682 | struct txentry_desc *txdesc) | ||
736 | { | 683 | { |
737 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 684 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
738 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
739 | unsigned int beacon_base; | 685 | unsigned int beacon_base; |
740 | u32 reg; | 686 | u32 reg; |
741 | 687 | ||
@@ -748,15 +694,25 @@ static void rt2800pci_write_beacon(struct queue_entry *entry) | |||
748 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 694 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
749 | 695 | ||
750 | /* | 696 | /* |
751 | * Write entire beacon with descriptor to register. | 697 | * Add the TXWI for the beacon to the skb. |
698 | */ | ||
699 | rt2800_write_txwi(entry->skb, txdesc); | ||
700 | skb_push(entry->skb, TXWI_DESC_SIZE); | ||
701 | |||
702 | /* | ||
703 | * Write entire beacon with TXWI to register. | ||
752 | */ | 704 | */ |
753 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 705 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
754 | rt2800_register_multiwrite(rt2x00dev, | 706 | rt2800_register_multiwrite(rt2x00dev, beacon_base, |
755 | beacon_base, | 707 | entry->skb->data, entry->skb->len); |
756 | skbdesc->desc, skbdesc->desc_len); | 708 | |
757 | rt2800_register_multiwrite(rt2x00dev, | 709 | /* |
758 | beacon_base + skbdesc->desc_len, | 710 | * Enable beaconing again. |
759 | entry->skb->data, entry->skb->len); | 711 | */ |
712 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
713 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
714 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
715 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
760 | 716 | ||
761 | /* | 717 | /* |
762 | * Clean up beacon skb. | 718 | * Clean up beacon skb. |
@@ -770,18 +726,6 @@ static void rt2800pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
770 | { | 726 | { |
771 | struct data_queue *queue; | 727 | struct data_queue *queue; |
772 | unsigned int idx, qidx = 0; | 728 | unsigned int idx, qidx = 0; |
773 | u32 reg; | ||
774 | |||
775 | if (queue_idx == QID_BEACON) { | ||
776 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
777 | if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) { | ||
778 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
779 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
780 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
781 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
782 | } | ||
783 | return; | ||
784 | } | ||
785 | 729 | ||
786 | if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) | 730 | if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) |
787 | return; | 731 | return; |
@@ -824,34 +768,21 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
824 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 768 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
825 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 769 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
826 | __le32 *rxd = entry_priv->desc; | 770 | __le32 *rxd = entry_priv->desc; |
827 | __le32 *rxwi = (__le32 *)entry->skb->data; | 771 | u32 word; |
828 | u32 rxd3; | 772 | |
829 | u32 rxwi0; | 773 | rt2x00_desc_read(rxd, 3, &word); |
830 | u32 rxwi1; | 774 | |
831 | u32 rxwi2; | 775 | if (rt2x00_get_field32(word, RXD_W3_CRC_ERROR)) |
832 | u32 rxwi3; | ||
833 | |||
834 | rt2x00_desc_read(rxd, 3, &rxd3); | ||
835 | rt2x00_desc_read(rxwi, 0, &rxwi0); | ||
836 | rt2x00_desc_read(rxwi, 1, &rxwi1); | ||
837 | rt2x00_desc_read(rxwi, 2, &rxwi2); | ||
838 | rt2x00_desc_read(rxwi, 3, &rxwi3); | ||
839 | |||
840 | if (rt2x00_get_field32(rxd3, RXD_W3_CRC_ERROR)) | ||
841 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 776 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
842 | 777 | ||
843 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 778 | /* |
844 | /* | 779 | * Unfortunately we don't know the cipher type used during |
845 | * Unfortunately we don't know the cipher type used during | 780 | * decryption. This prevents us from correct providing |
846 | * decryption. This prevents us from correct providing | 781 | * correct statistics through debugfs. |
847 | * correct statistics through debugfs. | 782 | */ |
848 | */ | 783 | rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W3_CIPHER_ERROR); |
849 | rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); | ||
850 | rxdesc->cipher_status = | ||
851 | rt2x00_get_field32(rxd3, RXD_W3_CIPHER_ERROR); | ||
852 | } | ||
853 | 784 | ||
854 | if (rt2x00_get_field32(rxd3, RXD_W3_DECRYPTED)) { | 785 | if (rt2x00_get_field32(word, RXD_W3_DECRYPTED)) { |
855 | /* | 786 | /* |
856 | * Hardware has stripped IV/EIV data from 802.11 frame during | 787 | * Hardware has stripped IV/EIV data from 802.11 frame during |
857 | * decryption. Unfortunately the descriptor doesn't contain | 788 | * decryption. Unfortunately the descriptor doesn't contain |
@@ -866,47 +797,22 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
866 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; | 797 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; |
867 | } | 798 | } |
868 | 799 | ||
869 | if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) | 800 | if (rt2x00_get_field32(word, RXD_W3_MY_BSS)) |
870 | rxdesc->dev_flags |= RXDONE_MY_BSS; | 801 | rxdesc->dev_flags |= RXDONE_MY_BSS; |
871 | 802 | ||
872 | if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) | 803 | if (rt2x00_get_field32(word, RXD_W3_L2PAD)) |
873 | rxdesc->dev_flags |= RXDONE_L2PAD; | 804 | rxdesc->dev_flags |= RXDONE_L2PAD; |
874 | 805 | ||
875 | if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) | ||
876 | rxdesc->flags |= RX_FLAG_SHORT_GI; | ||
877 | |||
878 | if (rt2x00_get_field32(rxwi1, RXWI_W1_BW)) | ||
879 | rxdesc->flags |= RX_FLAG_40MHZ; | ||
880 | |||
881 | /* | ||
882 | * Detect RX rate, always use MCS as signal type. | ||
883 | */ | ||
884 | rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; | ||
885 | rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE); | ||
886 | rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS); | ||
887 | |||
888 | /* | 806 | /* |
889 | * Mask of 0x8 bit to remove the short preamble flag. | 807 | * Process the RXWI structure that is at the start of the buffer. |
890 | */ | 808 | */ |
891 | if (rxdesc->rate_mode == RATE_MODE_CCK) | 809 | rt2800_process_rxwi(entry->skb, rxdesc); |
892 | rxdesc->signal &= ~0x8; | ||
893 | |||
894 | rxdesc->rssi = | ||
895 | (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) + | ||
896 | rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2; | ||
897 | |||
898 | rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); | ||
899 | 810 | ||
900 | /* | 811 | /* |
901 | * Set RX IDX in register to inform hardware that we have handled | 812 | * Set RX IDX in register to inform hardware that we have handled |
902 | * this entry and it is available for reuse again. | 813 | * this entry and it is available for reuse again. |
903 | */ | 814 | */ |
904 | rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); | 815 | rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); |
905 | |||
906 | /* | ||
907 | * Remove TXWI descriptor from start of buffer. | ||
908 | */ | ||
909 | skb_pull(entry->skb, RXWI_DESC_SIZE); | ||
910 | } | 816 | } |
911 | 817 | ||
912 | /* | 818 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index e3f3a97db80..8ad0669a1b9 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -401,59 +401,15 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
401 | { | 401 | { |
402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
403 | __le32 *txi = skbdesc->desc; | 403 | __le32 *txi = skbdesc->desc; |
404 | __le32 *txwi = &txi[TXINFO_DESC_SIZE / sizeof(__le32)]; | ||
405 | u32 word; | 404 | u32 word; |
406 | 405 | ||
407 | /* | 406 | /* |
408 | * Initialize TX Info descriptor | 407 | * Initialize TXWI descriptor |
409 | */ | 408 | */ |
410 | rt2x00_desc_read(txwi, 0, &word); | 409 | rt2800_write_txwi(skb, txdesc); |
411 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
412 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
413 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
414 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
415 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
416 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
417 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
418 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
419 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
420 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs); | ||
421 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
422 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
423 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
424 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
425 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
426 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
427 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
428 | rt2x00_desc_write(txwi, 0, word); | ||
429 | |||
430 | rt2x00_desc_read(txwi, 1, &word); | ||
431 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
432 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
433 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
434 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
435 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
436 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
437 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
438 | txdesc->key_idx : 0xff); | ||
439 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
440 | txdesc->length); | ||
441 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
442 | skbdesc->entry->queue->qid + 1); | ||
443 | rt2x00_desc_write(txwi, 1, word); | ||
444 | 410 | ||
445 | /* | 411 | /* |
446 | * Always write 0 to IV/EIV fields, hardware will insert the IV | 412 | * Initialize TXINFO descriptor |
447 | * from the IVEIV register when TXINFO_W0_WIV is set to 0. | ||
448 | * When TXINFO_W0_WIV is set to 1 it will use the IV data | ||
449 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
450 | * crypto entry in the registers should be used to encrypt the frame. | ||
451 | */ | ||
452 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
453 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
454 | |||
455 | /* | ||
456 | * Initialize TX descriptor | ||
457 | */ | 413 | */ |
458 | rt2x00_desc_read(txi, 0, &word); | 414 | rt2x00_desc_read(txi, 0, &word); |
459 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 415 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |
@@ -471,21 +427,14 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
471 | /* | 427 | /* |
472 | * TX data initialization | 428 | * TX data initialization |
473 | */ | 429 | */ |
474 | static void rt2800usb_write_beacon(struct queue_entry *entry) | 430 | static void rt2800usb_write_beacon(struct queue_entry *entry, |
431 | struct txentry_desc *txdesc) | ||
475 | { | 432 | { |
476 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 433 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
477 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
478 | unsigned int beacon_base; | 434 | unsigned int beacon_base; |
479 | u32 reg; | 435 | u32 reg; |
480 | 436 | ||
481 | /* | 437 | /* |
482 | * Add the descriptor in front of the skb. | ||
483 | */ | ||
484 | skb_push(entry->skb, entry->queue->desc_size); | ||
485 | memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len); | ||
486 | skbdesc->desc = entry->skb->data; | ||
487 | |||
488 | /* | ||
489 | * Disable beaconing while we are reloading the beacon data, | 438 | * Disable beaconing while we are reloading the beacon data, |
490 | * otherwise we might be sending out invalid data. | 439 | * otherwise we might be sending out invalid data. |
491 | */ | 440 | */ |
@@ -494,6 +443,12 @@ static void rt2800usb_write_beacon(struct queue_entry *entry) | |||
494 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 443 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
495 | 444 | ||
496 | /* | 445 | /* |
446 | * Add the TXWI for the beacon to the skb. | ||
447 | */ | ||
448 | rt2800_write_txwi(entry->skb, txdesc); | ||
449 | skb_push(entry->skb, TXWI_DESC_SIZE); | ||
450 | |||
451 | /* | ||
497 | * Write entire beacon with descriptor to register. | 452 | * Write entire beacon with descriptor to register. |
498 | */ | 453 | */ |
499 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 454 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
@@ -503,6 +458,14 @@ static void rt2800usb_write_beacon(struct queue_entry *entry) | |||
503 | REGISTER_TIMEOUT32(entry->skb->len)); | 458 | REGISTER_TIMEOUT32(entry->skb->len)); |
504 | 459 | ||
505 | /* | 460 | /* |
461 | * Enable beaconing again. | ||
462 | */ | ||
463 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
464 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
465 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
466 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
467 | |||
468 | /* | ||
506 | * Clean up the beacon skb. | 469 | * Clean up the beacon skb. |
507 | */ | 470 | */ |
508 | dev_kfree_skb(entry->skb); | 471 | dev_kfree_skb(entry->skb); |
@@ -524,84 +487,53 @@ static int rt2800usb_get_tx_data_len(struct queue_entry *entry) | |||
524 | return length; | 487 | return length; |
525 | } | 488 | } |
526 | 489 | ||
527 | static void rt2800usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
528 | const enum data_queue_qid queue) | ||
529 | { | ||
530 | u32 reg; | ||
531 | |||
532 | if (queue != QID_BEACON) { | ||
533 | rt2x00usb_kick_tx_queue(rt2x00dev, queue); | ||
534 | return; | ||
535 | } | ||
536 | |||
537 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
538 | if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) { | ||
539 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
540 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
541 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
542 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
543 | } | ||
544 | } | ||
545 | |||
546 | /* | 490 | /* |
547 | * RX control handlers | 491 | * RX control handlers |
548 | */ | 492 | */ |
549 | static void rt2800usb_fill_rxdone(struct queue_entry *entry, | 493 | static void rt2800usb_fill_rxdone(struct queue_entry *entry, |
550 | struct rxdone_entry_desc *rxdesc) | 494 | struct rxdone_entry_desc *rxdesc) |
551 | { | 495 | { |
552 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
553 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 496 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
554 | __le32 *rxi = (__le32 *)entry->skb->data; | 497 | __le32 *rxi = (__le32 *)entry->skb->data; |
555 | __le32 *rxwi; | ||
556 | __le32 *rxd; | 498 | __le32 *rxd; |
557 | u32 rxi0; | 499 | u32 word; |
558 | u32 rxwi0; | ||
559 | u32 rxwi1; | ||
560 | u32 rxwi2; | ||
561 | u32 rxwi3; | ||
562 | u32 rxd0; | ||
563 | int rx_pkt_len; | 500 | int rx_pkt_len; |
564 | 501 | ||
565 | /* | 502 | /* |
503 | * Copy descriptor to the skbdesc->desc buffer, making it safe from | ||
504 | * moving of frame data in rt2x00usb. | ||
505 | */ | ||
506 | memcpy(skbdesc->desc, rxi, skbdesc->desc_len); | ||
507 | |||
508 | /* | ||
566 | * RX frame format is : | 509 | * RX frame format is : |
567 | * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | | 510 | * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | |
568 | * |<------------ rx_pkt_len -------------->| | 511 | * |<------------ rx_pkt_len -------------->| |
569 | */ | 512 | */ |
570 | rt2x00_desc_read(rxi, 0, &rxi0); | 513 | rt2x00_desc_read(rxi, 0, &word); |
571 | rx_pkt_len = rt2x00_get_field32(rxi0, RXINFO_W0_USB_DMA_RX_PKT_LEN); | 514 | rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN); |
572 | |||
573 | rxwi = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE); | ||
574 | 515 | ||
575 | /* | 516 | /* |
576 | * FIXME : we need to check for rx_pkt_len validity | 517 | * Remove the RXINFO structure from the sbk. |
577 | */ | 518 | */ |
578 | rxd = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE + rx_pkt_len); | 519 | skb_pull(entry->skb, RXINFO_DESC_SIZE); |
579 | 520 | ||
580 | /* | 521 | /* |
581 | * Copy descriptor to the skbdesc->desc buffer, making it safe from | 522 | * FIXME: we need to check for rx_pkt_len validity |
582 | * moving of frame data in rt2x00usb. | ||
583 | */ | 523 | */ |
584 | memcpy(skbdesc->desc, rxi, skbdesc->desc_len); | 524 | rxd = (__le32 *)(entry->skb->data + rx_pkt_len); |
585 | 525 | ||
586 | /* | 526 | /* |
587 | * It is now safe to read the descriptor on all architectures. | 527 | * It is now safe to read the descriptor on all architectures. |
588 | */ | 528 | */ |
589 | rt2x00_desc_read(rxwi, 0, &rxwi0); | 529 | rt2x00_desc_read(rxd, 0, &word); |
590 | rt2x00_desc_read(rxwi, 1, &rxwi1); | ||
591 | rt2x00_desc_read(rxwi, 2, &rxwi2); | ||
592 | rt2x00_desc_read(rxwi, 3, &rxwi3); | ||
593 | rt2x00_desc_read(rxd, 0, &rxd0); | ||
594 | 530 | ||
595 | if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR)) | 531 | if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR)) |
596 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 532 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
597 | 533 | ||
598 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 534 | rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR); |
599 | rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); | ||
600 | rxdesc->cipher_status = | ||
601 | rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR); | ||
602 | } | ||
603 | 535 | ||
604 | if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) { | 536 | if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) { |
605 | /* | 537 | /* |
606 | * Hardware has stripped IV/EIV data from 802.11 frame during | 538 | * Hardware has stripped IV/EIV data from 802.11 frame during |
607 | * decryption. Unfortunately the descriptor doesn't contain | 539 | * decryption. Unfortunately the descriptor doesn't contain |
@@ -616,41 +548,21 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
616 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; | 548 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; |
617 | } | 549 | } |
618 | 550 | ||
619 | if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS)) | 551 | if (rt2x00_get_field32(word, RXD_W0_MY_BSS)) |
620 | rxdesc->dev_flags |= RXDONE_MY_BSS; | 552 | rxdesc->dev_flags |= RXDONE_MY_BSS; |
621 | 553 | ||
622 | if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) | 554 | if (rt2x00_get_field32(word, RXD_W0_L2PAD)) |
623 | rxdesc->dev_flags |= RXDONE_L2PAD; | 555 | rxdesc->dev_flags |= RXDONE_L2PAD; |
624 | 556 | ||
625 | if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) | ||
626 | rxdesc->flags |= RX_FLAG_SHORT_GI; | ||
627 | |||
628 | if (rt2x00_get_field32(rxwi1, RXWI_W1_BW)) | ||
629 | rxdesc->flags |= RX_FLAG_40MHZ; | ||
630 | |||
631 | /* | 557 | /* |
632 | * Detect RX rate, always use MCS as signal type. | 558 | * Remove RXD descriptor from end of buffer. |
633 | */ | 559 | */ |
634 | rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; | 560 | skb_trim(entry->skb, rx_pkt_len); |
635 | rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE); | ||
636 | rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS); | ||
637 | |||
638 | /* | ||
639 | * Mask of 0x8 bit to remove the short preamble flag. | ||
640 | */ | ||
641 | if (rxdesc->rate_mode == RATE_MODE_CCK) | ||
642 | rxdesc->signal &= ~0x8; | ||
643 | |||
644 | rxdesc->rssi = | ||
645 | (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) + | ||
646 | rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2; | ||
647 | |||
648 | rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); | ||
649 | 561 | ||
650 | /* | 562 | /* |
651 | * Remove RXWI descriptor from start of buffer. | 563 | * Process the RXWI structure. |
652 | */ | 564 | */ |
653 | skb_pull(entry->skb, skbdesc->desc_len); | 565 | rt2800_process_rxwi(entry->skb, rxdesc); |
654 | } | 566 | } |
655 | 567 | ||
656 | /* | 568 | /* |
@@ -743,7 +655,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | |||
743 | .write_tx_data = rt2x00usb_write_tx_data, | 655 | .write_tx_data = rt2x00usb_write_tx_data, |
744 | .write_beacon = rt2800usb_write_beacon, | 656 | .write_beacon = rt2800usb_write_beacon, |
745 | .get_tx_data_len = rt2800usb_get_tx_data_len, | 657 | .get_tx_data_len = rt2800usb_get_tx_data_len, |
746 | .kick_tx_queue = rt2800usb_kick_tx_queue, | 658 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
747 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 659 | .kill_tx_queue = rt2x00usb_kill_tx_queue, |
748 | .fill_rxdone = rt2800usb_fill_rxdone, | 660 | .fill_rxdone = rt2800usb_fill_rxdone, |
749 | .config_shared_key = rt2800_config_shared_key, | 661 | .config_shared_key = rt2800_config_shared_key, |
@@ -841,7 +753,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
841 | { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, | 753 | { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, |
842 | { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, | 754 | { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, |
843 | /* EnGenius */ | 755 | /* EnGenius */ |
844 | { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, | 756 | { USB_DEVICE(0x1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, |
845 | { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, | 757 | { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, |
846 | /* Gigabyte */ | 758 | /* Gigabyte */ |
847 | { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, | 759 | { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h index d1d8ae94b4d..2bca6a71a7f 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.h +++ b/drivers/net/wireless/rt2x00/rt2800usb.h | |||
@@ -79,8 +79,6 @@ | |||
79 | */ | 79 | */ |
80 | #define TXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) | 80 | #define TXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) |
81 | #define RXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) | 81 | #define RXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) |
82 | #define RXWI_DESC_SIZE ( 4 * sizeof(__le32) ) | ||
83 | #define RXD_DESC_SIZE ( 1 * sizeof(__le32) ) | ||
84 | 82 | ||
85 | /* | 83 | /* |
86 | * TX Info structure | 84 | * TX Info structure |
@@ -113,44 +111,6 @@ | |||
113 | #define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff) | 111 | #define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff) |
114 | 112 | ||
115 | /* | 113 | /* |
116 | * RX WI structure | ||
117 | */ | ||
118 | |||
119 | /* | ||
120 | * Word0 | ||
121 | */ | ||
122 | #define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff) | ||
123 | #define RXWI_W0_KEY_INDEX FIELD32(0x00000300) | ||
124 | #define RXWI_W0_BSSID FIELD32(0x00001c00) | ||
125 | #define RXWI_W0_UDF FIELD32(0x0000e000) | ||
126 | #define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000) | ||
127 | #define RXWI_W0_TID FIELD32(0xf0000000) | ||
128 | |||
129 | /* | ||
130 | * Word1 | ||
131 | */ | ||
132 | #define RXWI_W1_FRAG FIELD32(0x0000000f) | ||
133 | #define RXWI_W1_SEQUENCE FIELD32(0x0000fff0) | ||
134 | #define RXWI_W1_MCS FIELD32(0x007f0000) | ||
135 | #define RXWI_W1_BW FIELD32(0x00800000) | ||
136 | #define RXWI_W1_SHORT_GI FIELD32(0x01000000) | ||
137 | #define RXWI_W1_STBC FIELD32(0x06000000) | ||
138 | #define RXWI_W1_PHYMODE FIELD32(0xc0000000) | ||
139 | |||
140 | /* | ||
141 | * Word2 | ||
142 | */ | ||
143 | #define RXWI_W2_RSSI0 FIELD32(0x000000ff) | ||
144 | #define RXWI_W2_RSSI1 FIELD32(0x0000ff00) | ||
145 | #define RXWI_W2_RSSI2 FIELD32(0x00ff0000) | ||
146 | |||
147 | /* | ||
148 | * Word3 | ||
149 | */ | ||
150 | #define RXWI_W3_SNR0 FIELD32(0x000000ff) | ||
151 | #define RXWI_W3_SNR1 FIELD32(0x0000ff00) | ||
152 | |||
153 | /* | ||
154 | * RX descriptor format for RX Ring. | 114 | * RX descriptor format for RX Ring. |
155 | */ | 115 | */ |
156 | 116 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 4f9b666f7a7..6c1ff4c15c8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -551,7 +551,8 @@ struct rt2x00lib_ops { | |||
551 | struct txentry_desc *txdesc); | 551 | struct txentry_desc *txdesc); |
552 | int (*write_tx_data) (struct queue_entry *entry, | 552 | int (*write_tx_data) (struct queue_entry *entry, |
553 | struct txentry_desc *txdesc); | 553 | struct txentry_desc *txdesc); |
554 | void (*write_beacon) (struct queue_entry *entry); | 554 | void (*write_beacon) (struct queue_entry *entry, |
555 | struct txentry_desc *txdesc); | ||
555 | int (*get_tx_data_len) (struct queue_entry *entry); | 556 | int (*get_tx_data_len) (struct queue_entry *entry); |
556 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 557 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, |
557 | const enum data_queue_qid queue); | 558 | const enum data_queue_qid queue); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c index d291c7862e1..583dacd8d24 100644 --- a/drivers/net/wireless/rt2x00/rt2x00crypto.c +++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c | |||
@@ -128,6 +128,7 @@ void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, struct txentry_desc *txdesc) | |||
128 | 128 | ||
129 | /* Pull buffer to correct size */ | 129 | /* Pull buffer to correct size */ |
130 | skb_pull(skb, txdesc->iv_len); | 130 | skb_pull(skb, txdesc->iv_len); |
131 | txdesc->length -= txdesc->iv_len; | ||
131 | 132 | ||
132 | /* IV/EIV data has officially been stripped */ | 133 | /* IV/EIV data has officially been stripped */ |
133 | skbdesc->flags |= SKBDESC_IV_STRIPPED; | 134 | skbdesc->flags |= SKBDESC_IV_STRIPPED; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c index 1056c92143a..5a407602ce3 100644 --- a/drivers/net/wireless/rt2x00/rt2x00ht.c +++ b/drivers/net/wireless/rt2x00/rt2x00ht.c | |||
@@ -35,6 +35,7 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, | |||
35 | { | 35 | { |
36 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 36 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
37 | struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; | 37 | struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; |
38 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; | ||
38 | 39 | ||
39 | if (tx_info->control.sta) | 40 | if (tx_info->control.sta) |
40 | txdesc->mpdu_density = | 41 | txdesc->mpdu_density = |
@@ -66,4 +67,20 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, | |||
66 | __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags); | 67 | __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags); |
67 | if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) | 68 | if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) |
68 | __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags); | 69 | __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags); |
70 | |||
71 | /* | ||
72 | * Determine IFS values | ||
73 | * - Use TXOP_BACKOFF for management frames | ||
74 | * - Use TXOP_SIFS for fragment bursts | ||
75 | * - Use TXOP_HTTXOP for everything else | ||
76 | * | ||
77 | * Note: rt2800 devices won't use CTS protection (if used) | ||
78 | * for frames not transmitted with TXOP_HTTXOP | ||
79 | */ | ||
80 | if (ieee80211_is_mgmt(hdr->frame_control)) | ||
81 | txdesc->txop = TXOP_BACKOFF; | ||
82 | else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) | ||
83 | txdesc->txop = TXOP_SIFS; | ||
84 | else | ||
85 | txdesc->txop = TXOP_HTTXOP; | ||
69 | } | 86 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index e22029fcf41..089a12c7b90 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -429,20 +429,23 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, | |||
429 | * it is now ready to be dumped to userspace through debugfs. | 429 | * it is now ready to be dumped to userspace through debugfs. |
430 | */ | 430 | */ |
431 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); | 431 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); |
432 | } | ||
433 | |||
434 | static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, | ||
435 | struct txentry_desc *txdesc) | ||
436 | { | ||
437 | struct data_queue *queue = entry->queue; | ||
438 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
432 | 439 | ||
433 | /* | 440 | /* |
434 | * Check if we need to kick the queue, there are however a few rules | 441 | * Check if we need to kick the queue, there are however a few rules |
435 | * 1) Don't kick beacon queue | 442 | * 1) Don't kick unless this is the last in frame in a burst. |
436 | * 2) Don't kick unless this is the last in frame in a burst. | ||
437 | * When the burst flag is set, this frame is always followed | 443 | * When the burst flag is set, this frame is always followed |
438 | * by another frame which in some way are related to eachother. | 444 | * by another frame which in some way are related to eachother. |
439 | * This is true for fragments, RTS or CTS-to-self frames. | 445 | * This is true for fragments, RTS or CTS-to-self frames. |
440 | * 3) Rule 2 can be broken when the available entries | 446 | * 2) Rule 1 can be broken when the available entries |
441 | * in the queue are less then a certain threshold. | 447 | * in the queue are less then a certain threshold. |
442 | */ | 448 | */ |
443 | if (entry->queue->qid == QID_BEACON) | ||
444 | return; | ||
445 | |||
446 | if (rt2x00queue_threshold(queue) || | 449 | if (rt2x00queue_threshold(queue) || |
447 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) | 450 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) |
448 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); | 451 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); |
@@ -538,6 +541,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | |||
538 | 541 | ||
539 | rt2x00queue_index_inc(queue, Q_INDEX); | 542 | rt2x00queue_index_inc(queue, Q_INDEX); |
540 | rt2x00queue_write_tx_descriptor(entry, &txdesc); | 543 | rt2x00queue_write_tx_descriptor(entry, &txdesc); |
544 | rt2x00queue_kick_tx_queue(entry, &txdesc); | ||
541 | 545 | ||
542 | return 0; | 546 | return 0; |
543 | } | 547 | } |
@@ -603,12 +607,9 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
603 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); | 607 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); |
604 | 608 | ||
605 | /* | 609 | /* |
606 | * Send beacon to hardware. | 610 | * Send beacon to hardware and enable beacon genaration.. |
607 | * Also enable beacon generation, which might have been disabled | ||
608 | * by the driver during the config_beacon() callback function. | ||
609 | */ | 611 | */ |
610 | rt2x00dev->ops->lib->write_beacon(intf->beacon); | 612 | rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc); |
611 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); | ||
612 | 613 | ||
613 | mutex_unlock(&intf->beacon_skb_mutex); | 614 | mutex_unlock(&intf->beacon_skb_mutex); |
614 | 615 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 94a48c174d6..36a957adc1f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -299,6 +299,7 @@ enum txentry_desc_flags { | |||
299 | * @retry_limit: Max number of retries. | 299 | * @retry_limit: Max number of retries. |
300 | * @aifs: AIFS value. | 300 | * @aifs: AIFS value. |
301 | * @ifs: IFS value. | 301 | * @ifs: IFS value. |
302 | * @txop: IFS value for 11n capable chips. | ||
302 | * @cw_min: cwmin value. | 303 | * @cw_min: cwmin value. |
303 | * @cw_max: cwmax value. | 304 | * @cw_max: cwmax value. |
304 | * @cipher: Cipher type used for encryption. | 305 | * @cipher: Cipher type used for encryption. |
@@ -328,6 +329,7 @@ struct txentry_desc { | |||
328 | short retry_limit; | 329 | short retry_limit; |
329 | short aifs; | 330 | short aifs; |
330 | short ifs; | 331 | short ifs; |
332 | short txop; | ||
331 | short cw_min; | 333 | short cw_min; |
332 | short cw_max; | 334 | short cw_max; |
333 | 335 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h index 603bfc0adaa..b9fe94873ee 100644 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h | |||
@@ -101,6 +101,16 @@ enum ifs { | |||
101 | }; | 101 | }; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * IFS backoff values for HT devices | ||
105 | */ | ||
106 | enum txop { | ||
107 | TXOP_HTTXOP = 0, | ||
108 | TXOP_PIFS = 1, | ||
109 | TXOP_SIFS = 2, | ||
110 | TXOP_BACKOFF = 3, | ||
111 | }; | ||
112 | |||
113 | /* | ||
104 | * Cipher types for hardware encryption | 114 | * Cipher types for hardware encryption |
105 | */ | 115 | */ |
106 | enum cipher { | 116 | enum cipher { |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 26ee7911fba..86c75b9c3f2 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1843,7 +1843,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1843 | /* | 1843 | /* |
1844 | * TX data initialization | 1844 | * TX data initialization |
1845 | */ | 1845 | */ |
1846 | static void rt61pci_write_beacon(struct queue_entry *entry) | 1846 | static void rt61pci_write_beacon(struct queue_entry *entry, |
1847 | struct txentry_desc *txdesc) | ||
1847 | { | 1848 | { |
1848 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1849 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1849 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1850 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
@@ -1870,6 +1871,19 @@ static void rt61pci_write_beacon(struct queue_entry *entry) | |||
1870 | entry->skb->data, entry->skb->len); | 1871 | entry->skb->data, entry->skb->len); |
1871 | 1872 | ||
1872 | /* | 1873 | /* |
1874 | * Enable beaconing again. | ||
1875 | * | ||
1876 | * For Wi-Fi faily generated beacons between participating | ||
1877 | * stations. Set TBTT phase adaptive adjustment step to 8us. | ||
1878 | */ | ||
1879 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1880 | |||
1881 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1882 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1883 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1884 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1885 | |||
1886 | /* | ||
1873 | * Clean up beacon skb. | 1887 | * Clean up beacon skb. |
1874 | */ | 1888 | */ |
1875 | dev_kfree_skb_any(entry->skb); | 1889 | dev_kfree_skb_any(entry->skb); |
@@ -1881,23 +1895,6 @@ static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1881 | { | 1895 | { |
1882 | u32 reg; | 1896 | u32 reg; |
1883 | 1897 | ||
1884 | if (queue == QID_BEACON) { | ||
1885 | /* | ||
1886 | * For Wi-Fi faily generated beacons between participating | ||
1887 | * stations. Set TBTT phase adaptive adjustment step to 8us. | ||
1888 | */ | ||
1889 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1890 | |||
1891 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1892 | if (!rt2x00_get_field32(reg, TXRX_CSR9_BEACON_GEN)) { | ||
1893 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1894 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1895 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1896 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1897 | } | ||
1898 | return; | ||
1899 | } | ||
1900 | |||
1901 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | 1898 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); |
1902 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); | 1899 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); |
1903 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); | 1900 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); |
@@ -1969,12 +1966,8 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry, | |||
1969 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) | 1966 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) |
1970 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 1967 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
1971 | 1968 | ||
1972 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 1969 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); |
1973 | rxdesc->cipher = | 1970 | rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); |
1974 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); | ||
1975 | rxdesc->cipher_status = | ||
1976 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); | ||
1977 | } | ||
1978 | 1971 | ||
1979 | if (rxdesc->cipher != CIPHER_NONE) { | 1972 | if (rxdesc->cipher != CIPHER_NONE) { |
1980 | _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]); | 1973 | _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]); |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 39b3c6d04af..11c13074820 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1505,7 +1505,8 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1505 | /* | 1505 | /* |
1506 | * TX data initialization | 1506 | * TX data initialization |
1507 | */ | 1507 | */ |
1508 | static void rt73usb_write_beacon(struct queue_entry *entry) | 1508 | static void rt73usb_write_beacon(struct queue_entry *entry, |
1509 | struct txentry_desc *txdesc) | ||
1509 | { | 1510 | { |
1510 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1511 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1511 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1512 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
@@ -1537,6 +1538,19 @@ static void rt73usb_write_beacon(struct queue_entry *entry) | |||
1537 | REGISTER_TIMEOUT32(entry->skb->len)); | 1538 | REGISTER_TIMEOUT32(entry->skb->len)); |
1538 | 1539 | ||
1539 | /* | 1540 | /* |
1541 | * Enable beaconing again. | ||
1542 | * | ||
1543 | * For Wi-Fi faily generated beacons between participating stations. | ||
1544 | * Set TBTT phase adaptive adjustment step to 8us (default 16us) | ||
1545 | */ | ||
1546 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1547 | |||
1548 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1549 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1550 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1551 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1552 | |||
1553 | /* | ||
1540 | * Clean up the beacon skb. | 1554 | * Clean up the beacon skb. |
1541 | */ | 1555 | */ |
1542 | dev_kfree_skb(entry->skb); | 1556 | dev_kfree_skb(entry->skb); |
@@ -1557,31 +1571,6 @@ static int rt73usb_get_tx_data_len(struct queue_entry *entry) | |||
1557 | return length; | 1571 | return length; |
1558 | } | 1572 | } |
1559 | 1573 | ||
1560 | static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
1561 | const enum data_queue_qid queue) | ||
1562 | { | ||
1563 | u32 reg; | ||
1564 | |||
1565 | if (queue != QID_BEACON) { | ||
1566 | rt2x00usb_kick_tx_queue(rt2x00dev, queue); | ||
1567 | return; | ||
1568 | } | ||
1569 | |||
1570 | /* | ||
1571 | * For Wi-Fi faily generated beacons between participating stations. | ||
1572 | * Set TBTT phase adaptive adjustment step to 8us (default 16us) | ||
1573 | */ | ||
1574 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1575 | |||
1576 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1577 | if (!rt2x00_get_field32(reg, TXRX_CSR9_BEACON_GEN)) { | ||
1578 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1579 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1580 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1581 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1582 | } | ||
1583 | } | ||
1584 | |||
1585 | /* | 1574 | /* |
1586 | * RX control handlers | 1575 | * RX control handlers |
1587 | */ | 1576 | */ |
@@ -1645,12 +1634,8 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry, | |||
1645 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) | 1634 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) |
1646 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 1635 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
1647 | 1636 | ||
1648 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 1637 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); |
1649 | rxdesc->cipher = | 1638 | rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); |
1650 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); | ||
1651 | rxdesc->cipher_status = | ||
1652 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); | ||
1653 | } | ||
1654 | 1639 | ||
1655 | if (rxdesc->cipher != CIPHER_NONE) { | 1640 | if (rxdesc->cipher != CIPHER_NONE) { |
1656 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); | 1641 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); |
@@ -2266,7 +2251,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2266 | .write_tx_data = rt2x00usb_write_tx_data, | 2251 | .write_tx_data = rt2x00usb_write_tx_data, |
2267 | .write_beacon = rt73usb_write_beacon, | 2252 | .write_beacon = rt73usb_write_beacon, |
2268 | .get_tx_data_len = rt73usb_get_tx_data_len, | 2253 | .get_tx_data_len = rt73usb_get_tx_data_len, |
2269 | .kick_tx_queue = rt73usb_kick_tx_queue, | 2254 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
2270 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 2255 | .kill_tx_queue = rt2x00usb_kill_tx_queue, |
2271 | .fill_rxdone = rt73usb_fill_rxdone, | 2256 | .fill_rxdone = rt73usb_fill_rxdone, |
2272 | .config_shared_key = rt73usb_config_shared_key, | 2257 | .config_shared_key = rt73usb_config_shared_key, |