diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00config.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00debug.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 56 |
14 files changed, 191 insertions, 80 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index aa6dfb811c71..181a146b4768 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1220,6 +1220,7 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1220 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | 1220 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); |
1221 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, | 1221 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, |
1222 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); | 1222 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); |
1223 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); | ||
1223 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE); | 1224 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE); |
1224 | rt2x00_desc_write(txd, 0, word); | 1225 | rt2x00_desc_write(txd, 0, word); |
1225 | } | 1226 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 3558cb210747..cd5af656932d 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -633,6 +633,16 @@ static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev) | |||
633 | rt2x00dev->link.vgc_level = value; | 633 | rt2x00dev->link.vgc_level = value; |
634 | } | 634 | } |
635 | 635 | ||
636 | /* | ||
637 | * NOTE: This function is directly ported from legacy driver, but | ||
638 | * despite it being declared it was never called. Although link tuning | ||
639 | * sounds like a good idea, and usually works well for the other drivers, | ||
640 | * it does _not_ work with rt2500usb. Enabling this function will result | ||
641 | * in TX capabilities only until association kicks in. Immediately | ||
642 | * after the successful association all TX frames will be kept in the | ||
643 | * hardware queue and never transmitted. | ||
644 | */ | ||
645 | #if 0 | ||
636 | static void rt2500usb_link_tuner(struct rt2x00_dev *rt2x00dev) | 646 | static void rt2500usb_link_tuner(struct rt2x00_dev *rt2x00dev) |
637 | { | 647 | { |
638 | int rssi = rt2x00_get_link_rssi(&rt2x00dev->link); | 648 | int rssi = rt2x00_get_link_rssi(&rt2x00dev->link); |
@@ -752,6 +762,9 @@ dynamic_cca_tune: | |||
752 | rt2x00dev->link.vgc_level = r17; | 762 | rt2x00dev->link.vgc_level = r17; |
753 | } | 763 | } |
754 | } | 764 | } |
765 | #else | ||
766 | #define rt2500usb_link_tuner NULL | ||
767 | #endif | ||
755 | 768 | ||
756 | /* | 769 | /* |
757 | * Initialization functions. | 770 | * Initialization functions. |
@@ -1121,6 +1134,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) | |||
1121 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 1134 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
1122 | int length; | 1135 | int length; |
1123 | u16 reg; | 1136 | u16 reg; |
1137 | u32 word, len; | ||
1124 | 1138 | ||
1125 | /* | 1139 | /* |
1126 | * Add the descriptor in front of the skb. | 1140 | * Add the descriptor in front of the skb. |
@@ -1130,6 +1144,17 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) | |||
1130 | skbdesc->desc = entry->skb->data; | 1144 | skbdesc->desc = entry->skb->data; |
1131 | 1145 | ||
1132 | /* | 1146 | /* |
1147 | * Adjust the beacon databyte count. The current number is | ||
1148 | * calculated before this function gets called, but falsely | ||
1149 | * assumes that the descriptor was already present in the SKB. | ||
1150 | */ | ||
1151 | rt2x00_desc_read(skbdesc->desc, 0, &word); | ||
1152 | len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT); | ||
1153 | len += skbdesc->desc_len; | ||
1154 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len); | ||
1155 | rt2x00_desc_write(skbdesc->desc, 0, word); | ||
1156 | |||
1157 | /* | ||
1133 | * Disable beaconing while we are reloading the beacon data, | 1158 | * Disable beaconing while we are reloading the beacon data, |
1134 | * otherwise we might be sending out invalid data. | 1159 | * otherwise we might be sending out invalid data. |
1135 | */ | 1160 | */ |
@@ -1364,6 +1389,9 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1364 | rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); | 1389 | rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); |
1365 | rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); | 1390 | rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); |
1366 | EEPROM(rt2x00dev, "BBPtune vgc: 0x%04x\n", word); | 1391 | EEPROM(rt2x00dev, "BBPtune vgc: 0x%04x\n", word); |
1392 | } else { | ||
1393 | rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); | ||
1394 | rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); | ||
1367 | } | 1395 | } |
1368 | 1396 | ||
1369 | rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R17, &word); | 1397 | rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R17, &word); |
@@ -1372,9 +1400,6 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1372 | rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_HIGH, 0x41); | 1400 | rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_HIGH, 0x41); |
1373 | rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R17, word); | 1401 | rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R17, word); |
1374 | EEPROM(rt2x00dev, "BBPtune r17: 0x%04x\n", word); | 1402 | EEPROM(rt2x00dev, "BBPtune r17: 0x%04x\n", word); |
1375 | } else { | ||
1376 | rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); | ||
1377 | rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); | ||
1378 | } | 1403 | } |
1379 | 1404 | ||
1380 | rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &word); | 1405 | rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &word); |
@@ -1650,7 +1675,6 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1650 | * Initialize all hw fields. | 1675 | * Initialize all hw fields. |
1651 | */ | 1676 | */ |
1652 | rt2x00dev->hw->flags = | 1677 | rt2x00dev->hw->flags = |
1653 | IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | | ||
1654 | IEEE80211_HW_RX_INCLUDES_FCS | | 1678 | IEEE80211_HW_RX_INCLUDES_FCS | |
1655 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 1679 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
1656 | IEEE80211_HW_SIGNAL_DBM; | 1680 | IEEE80211_HW_SIGNAL_DBM; |
@@ -1726,6 +1750,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1726 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); | 1750 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); |
1727 | __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags); | 1751 | __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags); |
1728 | __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags); | 1752 | __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags); |
1753 | __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags); | ||
1729 | 1754 | ||
1730 | /* | 1755 | /* |
1731 | * Set the rssi offset. | 1756 | * Set the rssi offset. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 07b03b3c7ef1..8b10ea41b204 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -108,7 +108,10 @@ | |||
108 | #define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME ) | 108 | #define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME ) |
109 | #define DIFS ( PIFS + SLOT_TIME ) | 109 | #define DIFS ( PIFS + SLOT_TIME ) |
110 | #define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME ) | 110 | #define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME ) |
111 | #define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) | 111 | #define EIFS ( SIFS + DIFS + \ |
112 | (8 * (IEEE80211_HEADER + ACK_SIZE)) ) | ||
113 | #define SHORT_EIFS ( SIFS + SHORT_DIFS + \ | ||
114 | (8 * (IEEE80211_HEADER + ACK_SIZE)) ) | ||
112 | 115 | ||
113 | /* | 116 | /* |
114 | * Chipset identification | 117 | * Chipset identification |
@@ -365,6 +368,12 @@ struct rt2x00_intf { | |||
365 | #define DELAYED_CONFIG_ERP 0x00000002 | 368 | #define DELAYED_CONFIG_ERP 0x00000002 |
366 | #define DELAYED_LED_ASSOC 0x00000004 | 369 | #define DELAYED_LED_ASSOC 0x00000004 |
367 | 370 | ||
371 | /* | ||
372 | * Software sequence counter, this is only required | ||
373 | * for hardware which doesn't support hardware | ||
374 | * sequence counting. | ||
375 | */ | ||
376 | spinlock_t seqlock; | ||
368 | u16 seqno; | 377 | u16 seqno; |
369 | }; | 378 | }; |
370 | 379 | ||
@@ -597,6 +606,7 @@ enum rt2x00_flags { | |||
597 | DEVICE_STARTED_SUSPEND, | 606 | DEVICE_STARTED_SUSPEND, |
598 | DEVICE_ENABLED_RADIO, | 607 | DEVICE_ENABLED_RADIO, |
599 | DEVICE_DISABLED_RADIO_HW, | 608 | DEVICE_DISABLED_RADIO_HW, |
609 | DEVICE_DIRTY_CONFIG, | ||
600 | 610 | ||
601 | /* | 611 | /* |
602 | * Driver features | 612 | * Driver features |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index f20ca712504f..d134c3be539a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -254,6 +254,8 @@ config: | |||
254 | libconf.ant.rx = default_ant->rx; | 254 | libconf.ant.rx = default_ant->rx; |
255 | else if (active_ant->rx == ANTENNA_SW_DIVERSITY) | 255 | else if (active_ant->rx == ANTENNA_SW_DIVERSITY) |
256 | libconf.ant.rx = ANTENNA_B; | 256 | libconf.ant.rx = ANTENNA_B; |
257 | else | ||
258 | libconf.ant.rx = active_ant->rx; | ||
257 | 259 | ||
258 | if (conf->antenna_sel_tx) | 260 | if (conf->antenna_sel_tx) |
259 | libconf.ant.tx = conf->antenna_sel_tx; | 261 | libconf.ant.tx = conf->antenna_sel_tx; |
@@ -261,6 +263,8 @@ config: | |||
261 | libconf.ant.tx = default_ant->tx; | 263 | libconf.ant.tx = default_ant->tx; |
262 | else if (active_ant->tx == ANTENNA_SW_DIVERSITY) | 264 | else if (active_ant->tx == ANTENNA_SW_DIVERSITY) |
263 | libconf.ant.tx = ANTENNA_B; | 265 | libconf.ant.tx = ANTENNA_B; |
266 | else | ||
267 | libconf.ant.tx = active_ant->tx; | ||
264 | } | 268 | } |
265 | 269 | ||
266 | if (flags & CONFIG_UPDATE_SLOT_TIME) { | 270 | if (flags & CONFIG_UPDATE_SLOT_TIME) { |
@@ -271,7 +275,7 @@ config: | |||
271 | libconf.sifs = SIFS; | 275 | libconf.sifs = SIFS; |
272 | libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS; | 276 | libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS; |
273 | libconf.difs = short_slot_time ? SHORT_DIFS : DIFS; | 277 | libconf.difs = short_slot_time ? SHORT_DIFS : DIFS; |
274 | libconf.eifs = EIFS; | 278 | libconf.eifs = short_slot_time ? SHORT_EIFS : EIFS; |
275 | } | 279 | } |
276 | 280 | ||
277 | libconf.conf = conf; | 281 | libconf.conf = conf; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 300cf061035f..6bee1d611bbf 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -372,9 +372,6 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ | |||
372 | if (*offset) \ | 372 | if (*offset) \ |
373 | return 0; \ | 373 | return 0; \ |
374 | \ | 374 | \ |
375 | if (!capable(CAP_NET_ADMIN)) \ | ||
376 | return -EPERM; \ | ||
377 | \ | ||
378 | if (intf->offset_##__name >= debug->__name.word_count) \ | 375 | if (intf->offset_##__name >= debug->__name.word_count) \ |
379 | return -EINVAL; \ | 376 | return -EINVAL; \ |
380 | \ | 377 | \ |
@@ -454,7 +451,7 @@ static struct dentry *rt2x00debug_create_file_driver(const char *name, | |||
454 | data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__); | 451 | data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__); |
455 | blob->size = strlen(blob->data); | 452 | blob->size = strlen(blob->data); |
456 | 453 | ||
457 | return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob); | 454 | return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); |
458 | } | 455 | } |
459 | 456 | ||
460 | static struct dentry *rt2x00debug_create_file_chipset(const char *name, | 457 | static struct dentry *rt2x00debug_create_file_chipset(const char *name, |
@@ -482,7 +479,7 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name, | |||
482 | data += sprintf(data, "rf length: %d\n", debug->rf.word_count); | 479 | data += sprintf(data, "rf length: %d\n", debug->rf.word_count); |
483 | blob->size = strlen(blob->data); | 480 | blob->size = strlen(blob->data); |
484 | 481 | ||
485 | return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob); | 482 | return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); |
486 | } | 483 | } |
487 | 484 | ||
488 | void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | 485 | void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) |
@@ -517,7 +514,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
517 | if (IS_ERR(intf->chipset_entry)) | 514 | if (IS_ERR(intf->chipset_entry)) |
518 | goto exit; | 515 | goto exit; |
519 | 516 | ||
520 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUGO, | 517 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR, |
521 | intf->driver_folder, intf, | 518 | intf->driver_folder, intf, |
522 | &rt2x00debug_fop_dev_flags); | 519 | &rt2x00debug_fop_dev_flags); |
523 | if (IS_ERR(intf->dev_flags)) | 520 | if (IS_ERR(intf->dev_flags)) |
@@ -532,7 +529,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
532 | ({ \ | 529 | ({ \ |
533 | (__intf)->__name##_off_entry = \ | 530 | (__intf)->__name##_off_entry = \ |
534 | debugfs_create_u32(__stringify(__name) "_offset", \ | 531 | debugfs_create_u32(__stringify(__name) "_offset", \ |
535 | S_IRUGO | S_IWUSR, \ | 532 | S_IRUSR | S_IWUSR, \ |
536 | (__intf)->register_folder, \ | 533 | (__intf)->register_folder, \ |
537 | &(__intf)->offset_##__name); \ | 534 | &(__intf)->offset_##__name); \ |
538 | if (IS_ERR((__intf)->__name##_off_entry)) \ | 535 | if (IS_ERR((__intf)->__name##_off_entry)) \ |
@@ -540,7 +537,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
540 | \ | 537 | \ |
541 | (__intf)->__name##_val_entry = \ | 538 | (__intf)->__name##_val_entry = \ |
542 | debugfs_create_file(__stringify(__name) "_value", \ | 539 | debugfs_create_file(__stringify(__name) "_value", \ |
543 | S_IRUGO | S_IWUSR, \ | 540 | S_IRUSR | S_IWUSR, \ |
544 | (__intf)->register_folder, \ | 541 | (__intf)->register_folder, \ |
545 | (__intf), &rt2x00debug_fop_##__name);\ | 542 | (__intf), &rt2x00debug_fop_##__name);\ |
546 | if (IS_ERR((__intf)->__name##_val_entry)) \ | 543 | if (IS_ERR((__intf)->__name##_val_entry)) \ |
@@ -560,7 +557,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
560 | goto exit; | 557 | goto exit; |
561 | 558 | ||
562 | intf->queue_frame_dump_entry = | 559 | intf->queue_frame_dump_entry = |
563 | debugfs_create_file("dump", S_IRUGO, intf->queue_folder, | 560 | debugfs_create_file("dump", S_IRUSR, intf->queue_folder, |
564 | intf, &rt2x00debug_fop_queue_dump); | 561 | intf, &rt2x00debug_fop_queue_dump); |
565 | if (IS_ERR(intf->queue_frame_dump_entry)) | 562 | if (IS_ERR(intf->queue_frame_dump_entry)) |
566 | goto exit; | 563 | goto exit; |
@@ -569,7 +566,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
569 | init_waitqueue_head(&intf->frame_dump_waitqueue); | 566 | init_waitqueue_head(&intf->frame_dump_waitqueue); |
570 | 567 | ||
571 | intf->queue_stats_entry = | 568 | intf->queue_stats_entry = |
572 | debugfs_create_file("queue", S_IRUGO, intf->queue_folder, | 569 | debugfs_create_file("queue", S_IRUSR, intf->queue_folder, |
573 | intf, &rt2x00debug_fop_queue_stats); | 570 | intf, &rt2x00debug_fop_queue_stats); |
574 | 571 | ||
575 | return; | 572 | return; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 8c93eb8353b0..f42283ad7b02 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1013,6 +1013,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) | |||
1013 | rt2x00dev->intf_associated = 0; | 1013 | rt2x00dev->intf_associated = 0; |
1014 | 1014 | ||
1015 | __set_bit(DEVICE_STARTED, &rt2x00dev->flags); | 1015 | __set_bit(DEVICE_STARTED, &rt2x00dev->flags); |
1016 | __set_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags); | ||
1016 | 1017 | ||
1017 | return 0; | 1018 | return 0; |
1018 | } | 1019 | } |
@@ -1237,9 +1238,9 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1237 | /* | 1238 | /* |
1238 | * Reconfigure device. | 1239 | * Reconfigure device. |
1239 | */ | 1240 | */ |
1240 | rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, 1); | 1241 | retval = rt2x00mac_config(rt2x00dev->hw, &rt2x00dev->hw->conf); |
1241 | if (!rt2x00dev->hw->conf.radio_enabled) | 1242 | if (retval) |
1242 | rt2x00lib_disable_radio(rt2x00dev); | 1243 | goto exit; |
1243 | 1244 | ||
1244 | /* | 1245 | /* |
1245 | * Iterator over each active interface to | 1246 | * Iterator over each active interface to |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index f2c9b0e79b5f..c5fb3a72cf37 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -125,13 +125,6 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | |||
125 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | 125 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * rt2x00queue_free_skb - free a skb | ||
129 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
130 | * @skb: The skb to free. | ||
131 | */ | ||
132 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | ||
133 | |||
134 | /** | ||
135 | * rt2x00queue_write_tx_frame - Write TX frame to hardware | 128 | * rt2x00queue_write_tx_frame - Write TX frame to hardware |
136 | * @queue: Queue over which the frame should be send | 129 | * @queue: Queue over which the frame should be send |
137 | * @skb: The skb to send | 130 | * @skb: The skb to send |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index f1dcbaa80c3c..bd422fd6a894 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -63,7 +63,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, | |||
63 | */ | 63 | */ |
64 | memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb)); | 64 | memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb)); |
65 | rts_info = IEEE80211_SKB_CB(skb); | 65 | rts_info = IEEE80211_SKB_CB(skb); |
66 | rts_info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; | 66 | rts_info->control.hw_key = NULL; |
67 | rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS; | 67 | rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS; |
68 | rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT; | 68 | rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT; |
69 | rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS; | 69 | rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS; |
@@ -83,6 +83,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, | |||
83 | (struct ieee80211_rts *)(skb->data)); | 83 | (struct ieee80211_rts *)(skb->data)); |
84 | 84 | ||
85 | if (rt2x00queue_write_tx_frame(queue, skb)) { | 85 | if (rt2x00queue_write_tx_frame(queue, skb)) { |
86 | dev_kfree_skb_any(skb); | ||
86 | WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n"); | 87 | WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n"); |
87 | return NETDEV_TX_BUSY; | 88 | return NETDEV_TX_BUSY; |
88 | } | 89 | } |
@@ -96,7 +97,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
96 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 97 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
97 | struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; | 98 | struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; |
98 | enum data_queue_qid qid = skb_get_queue_mapping(skb); | 99 | enum data_queue_qid qid = skb_get_queue_mapping(skb); |
99 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); | ||
100 | struct data_queue *queue; | 100 | struct data_queue *queue; |
101 | u16 frame_control; | 101 | u16 frame_control; |
102 | 102 | ||
@@ -152,18 +152,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | /* | ||
156 | * XXX: This is as wrong as the old mac80211 code was, | ||
157 | * due to beacons not getting sequence numbers assigned | ||
158 | * properly. | ||
159 | */ | ||
160 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | ||
161 | if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | ||
162 | intf->seqno += 0x10; | ||
163 | ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
164 | ieee80211hdr->seq_ctrl |= cpu_to_le16(intf->seqno); | ||
165 | } | ||
166 | |||
167 | if (rt2x00queue_write_tx_frame(queue, skb)) { | 155 | if (rt2x00queue_write_tx_frame(queue, skb)) { |
168 | ieee80211_stop_queue(rt2x00dev->hw, qid); | 156 | ieee80211_stop_queue(rt2x00dev->hw, qid); |
169 | return NETDEV_TX_BUSY; | 157 | return NETDEV_TX_BUSY; |
@@ -259,6 +247,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
259 | rt2x00dev->intf_sta_count++; | 247 | rt2x00dev->intf_sta_count++; |
260 | 248 | ||
261 | spin_lock_init(&intf->lock); | 249 | spin_lock_init(&intf->lock); |
250 | spin_lock_init(&intf->seqlock); | ||
262 | intf->beacon = entry; | 251 | intf->beacon = entry; |
263 | 252 | ||
264 | if (conf->type == IEEE80211_IF_TYPE_AP) | 253 | if (conf->type == IEEE80211_IF_TYPE_AP) |
@@ -322,6 +311,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface); | |||
322 | int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | 311 | int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) |
323 | { | 312 | { |
324 | struct rt2x00_dev *rt2x00dev = hw->priv; | 313 | struct rt2x00_dev *rt2x00dev = hw->priv; |
314 | int force_reconfig; | ||
325 | 315 | ||
326 | /* | 316 | /* |
327 | * Mac80211 might be calling this function while we are trying | 317 | * Mac80211 might be calling this function while we are trying |
@@ -341,7 +331,17 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | |||
341 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF); | 331 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF); |
342 | } | 332 | } |
343 | 333 | ||
344 | rt2x00lib_config(rt2x00dev, conf, 0); | 334 | /* |
335 | * When the DEVICE_DIRTY_CONFIG flag is set, the device has recently | ||
336 | * been started and the configuration must be forced upon the hardware. | ||
337 | * Otherwise registers will not be intialized correctly and could | ||
338 | * result in non-working hardware because essential registers aren't | ||
339 | * initialized. | ||
340 | */ | ||
341 | force_reconfig = | ||
342 | __test_and_clear_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags); | ||
343 | |||
344 | rt2x00lib_config(rt2x00dev, conf, force_reconfig); | ||
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Reenable RX only if the radio should be on. | 347 | * Reenable RX only if the radio should be on. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 7f442030f5ad..898cdd7f57d9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -120,6 +120,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
120 | { | 120 | { |
121 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 121 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
122 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 122 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
123 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); | ||
123 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; | 124 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; |
124 | struct ieee80211_rate *rate = | 125 | struct ieee80211_rate *rate = |
125 | ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); | 126 | ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); |
@@ -127,6 +128,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
127 | unsigned int data_length; | 128 | unsigned int data_length; |
128 | unsigned int duration; | 129 | unsigned int duration; |
129 | unsigned int residual; | 130 | unsigned int residual; |
131 | unsigned long irqflags; | ||
130 | 132 | ||
131 | memset(txdesc, 0, sizeof(*txdesc)); | 133 | memset(txdesc, 0, sizeof(*txdesc)); |
132 | 134 | ||
@@ -200,6 +202,31 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
200 | } | 202 | } |
201 | 203 | ||
202 | /* | 204 | /* |
205 | * Hardware should insert sequence counter. | ||
206 | * FIXME: We insert a software sequence counter first for | ||
207 | * hardware that doesn't support hardware sequence counting. | ||
208 | * | ||
209 | * This is wrong because beacons are not getting sequence | ||
210 | * numbers assigned properly. | ||
211 | * | ||
212 | * A secondary problem exists for drivers that cannot toggle | ||
213 | * sequence counting per-frame, since those will override the | ||
214 | * sequence counter given by mac80211. | ||
215 | */ | ||
216 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | ||
217 | spin_lock_irqsave(&intf->seqlock, irqflags); | ||
218 | |||
219 | if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) | ||
220 | intf->seqno += 0x10; | ||
221 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
222 | hdr->seq_ctrl |= cpu_to_le16(intf->seqno); | ||
223 | |||
224 | spin_unlock_irqrestore(&intf->seqlock, irqflags); | ||
225 | |||
226 | __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); | ||
227 | } | ||
228 | |||
229 | /* | ||
203 | * PLCP setup | 230 | * PLCP setup |
204 | * Length calculation depends on OFDM/CCK rate. | 231 | * Length calculation depends on OFDM/CCK rate. |
205 | */ | 232 | */ |
@@ -466,9 +493,12 @@ void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev) | |||
466 | if (!rt2x00dev->ops->lib->init_rxentry) | 493 | if (!rt2x00dev->ops->lib->init_rxentry) |
467 | return; | 494 | return; |
468 | 495 | ||
469 | for (i = 0; i < queue->limit; i++) | 496 | for (i = 0; i < queue->limit; i++) { |
497 | queue->entries[i].flags = 0; | ||
498 | |||
470 | rt2x00dev->ops->lib->init_rxentry(rt2x00dev, | 499 | rt2x00dev->ops->lib->init_rxentry(rt2x00dev, |
471 | &queue->entries[i]); | 500 | &queue->entries[i]); |
501 | } | ||
472 | } | 502 | } |
473 | 503 | ||
474 | void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev) | 504 | void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev) |
@@ -482,9 +512,12 @@ void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev) | |||
482 | if (!rt2x00dev->ops->lib->init_txentry) | 512 | if (!rt2x00dev->ops->lib->init_txentry) |
483 | continue; | 513 | continue; |
484 | 514 | ||
485 | for (i = 0; i < queue->limit; i++) | 515 | for (i = 0; i < queue->limit; i++) { |
516 | queue->entries[i].flags = 0; | ||
517 | |||
486 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, | 518 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, |
487 | &queue->entries[i]); | 519 | &queue->entries[i]); |
520 | } | ||
488 | } | 521 | } |
489 | } | 522 | } |
490 | 523 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 8945945c892e..a4a8c57004db 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -199,6 +199,7 @@ struct txdone_entry_desc { | |||
199 | * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame. | 199 | * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame. |
200 | * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame. | 200 | * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame. |
201 | * @ENTRY_TXD_OFDM_RATE: This frame is send out with an OFDM rate. | 201 | * @ENTRY_TXD_OFDM_RATE: This frame is send out with an OFDM rate. |
202 | * @ENTRY_TXD_GENERATE_SEQ: This frame requires sequence counter. | ||
202 | * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame. | 203 | * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame. |
203 | * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment. | 204 | * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment. |
204 | * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted. | 205 | * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted. |
@@ -210,6 +211,7 @@ enum txentry_desc_flags { | |||
210 | ENTRY_TXD_RTS_FRAME, | 211 | ENTRY_TXD_RTS_FRAME, |
211 | ENTRY_TXD_CTS_FRAME, | 212 | ENTRY_TXD_CTS_FRAME, |
212 | ENTRY_TXD_OFDM_RATE, | 213 | ENTRY_TXD_OFDM_RATE, |
214 | ENTRY_TXD_GENERATE_SEQ, | ||
213 | ENTRY_TXD_FIRST_FRAGMENT, | 215 | ENTRY_TXD_FIRST_FRAGMENT, |
214 | ENTRY_TXD_MORE_FRAG, | 216 | ENTRY_TXD_MORE_FRAG, |
215 | ENTRY_TXD_REQ_TIMESTAMP, | 217 | ENTRY_TXD_REQ_TIMESTAMP, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 83862e7f7aec..8d76bb2e0312 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -122,6 +122,38 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev, | |||
122 | } | 122 | } |
123 | EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff); | 123 | EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff); |
124 | 124 | ||
125 | int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, | ||
126 | const u8 request, const u8 requesttype, | ||
127 | const u16 offset, const void *buffer, | ||
128 | const u16 buffer_length, | ||
129 | const int timeout) | ||
130 | { | ||
131 | int status = 0; | ||
132 | unsigned char *tb; | ||
133 | u16 off, len, bsize; | ||
134 | |||
135 | mutex_lock(&rt2x00dev->usb_cache_mutex); | ||
136 | |||
137 | tb = (char *)buffer; | ||
138 | off = offset; | ||
139 | len = buffer_length; | ||
140 | while (len && !status) { | ||
141 | bsize = min_t(u16, CSR_CACHE_SIZE, len); | ||
142 | status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request, | ||
143 | requesttype, off, tb, | ||
144 | bsize, timeout); | ||
145 | |||
146 | tb += bsize; | ||
147 | len -= bsize; | ||
148 | off += bsize; | ||
149 | } | ||
150 | |||
151 | mutex_unlock(&rt2x00dev->usb_cache_mutex); | ||
152 | |||
153 | return status; | ||
154 | } | ||
155 | EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_large_buff); | ||
156 | |||
125 | /* | 157 | /* |
126 | * TX data handlers. | 158 | * TX data handlers. |
127 | */ | 159 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index aad794adf52c..3b4a67417f95 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -70,8 +70,7 @@ | |||
70 | /* | 70 | /* |
71 | * Cache size | 71 | * Cache size |
72 | */ | 72 | */ |
73 | #define CSR_CACHE_SIZE 8 | 73 | #define CSR_CACHE_SIZE 64 |
74 | #define CSR_CACHE_SIZE_FIRMWARE 64 | ||
75 | 74 | ||
76 | /* | 75 | /* |
77 | * USB request types. | 76 | * USB request types. |
@@ -172,6 +171,25 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev, | |||
172 | const u16 buffer_length, const int timeout); | 171 | const u16 buffer_length, const int timeout); |
173 | 172 | ||
174 | /** | 173 | /** |
174 | * rt2x00usb_vendor_request_large_buff - Send register command to device (buffered) | ||
175 | * @rt2x00dev: Pointer to &struct rt2x00_dev | ||
176 | * @request: USB vendor command (See &enum rt2x00usb_vendor_request) | ||
177 | * @requesttype: Request type &USB_VENDOR_REQUEST_* | ||
178 | * @offset: Register start offset to perform action on | ||
179 | * @buffer: Buffer where information will be read/written to by device | ||
180 | * @buffer_length: Size of &buffer | ||
181 | * @timeout: Operation timeout | ||
182 | * | ||
183 | * This function is used to transfer register data in blocks larger | ||
184 | * then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons. | ||
185 | */ | ||
186 | int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, | ||
187 | const u8 request, const u8 requesttype, | ||
188 | const u16 offset, const void *buffer, | ||
189 | const u16 buffer_length, | ||
190 | const int timeout); | ||
191 | |||
192 | /** | ||
175 | * rt2x00usb_vendor_request_sw - Send single register command to device | 193 | * rt2x00usb_vendor_request_sw - Send single register command to device |
176 | * @rt2x00dev: Pointer to &struct rt2x00_dev | 194 | * @rt2x00dev: Pointer to &struct rt2x00_dev |
177 | * @request: USB vendor command (See &enum rt2x00usb_vendor_request) | 195 | * @request: USB vendor command (See &enum rt2x00usb_vendor_request) |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index f7c1f92c1448..087e90b328cd 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1004,6 +1004,11 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data, | |||
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | /* | 1006 | /* |
1007 | * Hardware needs another millisecond before it is ready. | ||
1008 | */ | ||
1009 | msleep(1); | ||
1010 | |||
1011 | /* | ||
1007 | * Reset MAC and BBP registers. | 1012 | * Reset MAC and BBP registers. |
1008 | */ | 1013 | */ |
1009 | reg = 0; | 1014 | reg = 0; |
@@ -1544,7 +1549,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1544 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); | 1549 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); |
1545 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); | 1550 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); |
1546 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); | 1551 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); |
1547 | rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1); | 1552 | rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, |
1553 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
1548 | rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); | 1554 | rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); |
1549 | rt2x00_desc_write(txd, 1, word); | 1555 | rt2x00_desc_write(txd, 1, word); |
1550 | 1556 | ||
@@ -2278,7 +2284,6 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2278 | * Initialize all hw fields. | 2284 | * Initialize all hw fields. |
2279 | */ | 2285 | */ |
2280 | rt2x00dev->hw->flags = | 2286 | rt2x00dev->hw->flags = |
2281 | IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | | ||
2282 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 2287 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
2283 | IEEE80211_HW_SIGNAL_DBM; | 2288 | IEEE80211_HW_SIGNAL_DBM; |
2284 | rt2x00dev->hw->extra_tx_headroom = 0; | 2289 | rt2x00dev->hw->extra_tx_headroom = 0; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index d383735ab8f2..9761eaaa08be 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -890,9 +890,6 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data, | |||
890 | unsigned int i; | 890 | unsigned int i; |
891 | int status; | 891 | int status; |
892 | u32 reg; | 892 | u32 reg; |
893 | const char *ptr = data; | ||
894 | char *cache; | ||
895 | int buflen; | ||
896 | 893 | ||
897 | /* | 894 | /* |
898 | * Wait for stable hardware. | 895 | * Wait for stable hardware. |
@@ -911,31 +908,12 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data, | |||
911 | 908 | ||
912 | /* | 909 | /* |
913 | * Write firmware to device. | 910 | * Write firmware to device. |
914 | * We setup a seperate cache for this action, | ||
915 | * since we are going to write larger chunks of data | ||
916 | * then normally used cache size. | ||
917 | */ | 911 | */ |
918 | cache = kmalloc(CSR_CACHE_SIZE_FIRMWARE, GFP_KERNEL); | 912 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, |
919 | if (!cache) { | 913 | USB_VENDOR_REQUEST_OUT, |
920 | ERROR(rt2x00dev, "Failed to allocate firmware cache.\n"); | 914 | FIRMWARE_IMAGE_BASE, |
921 | return -ENOMEM; | 915 | data, len, |
922 | } | 916 | REGISTER_TIMEOUT32(len)); |
923 | |||
924 | for (i = 0; i < len; i += CSR_CACHE_SIZE_FIRMWARE) { | ||
925 | buflen = min_t(int, len - i, CSR_CACHE_SIZE_FIRMWARE); | ||
926 | |||
927 | memcpy(cache, ptr, buflen); | ||
928 | |||
929 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, | ||
930 | USB_VENDOR_REQUEST_OUT, | ||
931 | FIRMWARE_IMAGE_BASE + i, 0, | ||
932 | cache, buflen, | ||
933 | REGISTER_TIMEOUT32(buflen)); | ||
934 | |||
935 | ptr += buflen; | ||
936 | } | ||
937 | |||
938 | kfree(cache); | ||
939 | 917 | ||
940 | /* | 918 | /* |
941 | * Send firmware request to device to load firmware, | 919 | * Send firmware request to device to load firmware, |
@@ -1303,7 +1281,8 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1303 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); | 1281 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); |
1304 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); | 1282 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); |
1305 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); | 1283 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); |
1306 | rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1); | 1284 | rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, |
1285 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
1307 | rt2x00_desc_write(txd, 1, word); | 1286 | rt2x00_desc_write(txd, 1, word); |
1308 | 1287 | ||
1309 | rt2x00_desc_read(txd, 2, &word); | 1288 | rt2x00_desc_read(txd, 2, &word); |
@@ -1352,6 +1331,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry) | |||
1352 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1331 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1353 | unsigned int beacon_base; | 1332 | unsigned int beacon_base; |
1354 | u32 reg; | 1333 | u32 reg; |
1334 | u32 word, len; | ||
1355 | 1335 | ||
1356 | /* | 1336 | /* |
1357 | * Add the descriptor in front of the skb. | 1337 | * Add the descriptor in front of the skb. |
@@ -1361,6 +1341,17 @@ static void rt73usb_write_beacon(struct queue_entry *entry) | |||
1361 | skbdesc->desc = entry->skb->data; | 1341 | skbdesc->desc = entry->skb->data; |
1362 | 1342 | ||
1363 | /* | 1343 | /* |
1344 | * Adjust the beacon databyte count. The current number is | ||
1345 | * calculated before this function gets called, but falsely | ||
1346 | * assumes that the descriptor was already present in the SKB. | ||
1347 | */ | ||
1348 | rt2x00_desc_read(skbdesc->desc, 0, &word); | ||
1349 | len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT); | ||
1350 | len += skbdesc->desc_len; | ||
1351 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len); | ||
1352 | rt2x00_desc_write(skbdesc->desc, 0, word); | ||
1353 | |||
1354 | /* | ||
1364 | * Disable beaconing while we are reloading the beacon data, | 1355 | * Disable beaconing while we are reloading the beacon data, |
1365 | * otherwise we might be sending out invalid data. | 1356 | * otherwise we might be sending out invalid data. |
1366 | */ | 1357 | */ |
@@ -1374,10 +1365,10 @@ static void rt73usb_write_beacon(struct queue_entry *entry) | |||
1374 | * Write entire beacon with descriptor to register. | 1365 | * Write entire beacon with descriptor to register. |
1375 | */ | 1366 | */ |
1376 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1367 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
1377 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, | 1368 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, |
1378 | USB_VENDOR_REQUEST_OUT, beacon_base, 0, | 1369 | USB_VENDOR_REQUEST_OUT, beacon_base, |
1379 | entry->skb->data, entry->skb->len, | 1370 | entry->skb->data, entry->skb->len, |
1380 | REGISTER_TIMEOUT32(entry->skb->len)); | 1371 | REGISTER_TIMEOUT32(entry->skb->len)); |
1381 | 1372 | ||
1382 | /* | 1373 | /* |
1383 | * Clean up the beacon skb. | 1374 | * Clean up the beacon skb. |
@@ -1871,7 +1862,6 @@ static void rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1871 | * Initialize all hw fields. | 1862 | * Initialize all hw fields. |
1872 | */ | 1863 | */ |
1873 | rt2x00dev->hw->flags = | 1864 | rt2x00dev->hw->flags = |
1874 | IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | | ||
1875 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 1865 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
1876 | IEEE80211_HW_SIGNAL_DBM; | 1866 | IEEE80211_HW_SIGNAL_DBM; |
1877 | rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; | 1867 | rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; |