diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-04-04 15:40:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-08 16:44:43 -0400 |
commit | a82d992261f79506a0d55b9a179a211f96caf878 (patch) | |
tree | 15350b682676c34e8cd3278e1b7f3eceb4059e95 /drivers/net | |
parent | 182e2e66ca56f750845f5314708434c286edd6e4 (diff) |
b43: Beaconing fixes
These are some beaconing related fixes. Basically it prevents
the card from triggering the beacon IRQ over and over again.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 42 |
2 files changed, 37 insertions, 6 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index e478799c09cb..bf6b276d47e2 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -733,6 +733,7 @@ struct b43_wl { | |||
733 | struct sk_buff *current_beacon; | 733 | struct sk_buff *current_beacon; |
734 | bool beacon0_uploaded; | 734 | bool beacon0_uploaded; |
735 | bool beacon1_uploaded; | 735 | bool beacon1_uploaded; |
736 | struct work_struct beacon_update_trigger; | ||
736 | 737 | ||
737 | /* The current QOS parameters for the 4 queues. | 738 | /* The current QOS parameters for the 4 queues. |
738 | * This is protected by the irq_lock. */ | 739 | * This is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6ecaf84da2fc..c98337b2d687 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1337,7 +1337,8 @@ static void b43_write_beacon_template(struct b43_wldev *dev, | |||
1337 | b43warn(dev->wl, "Did not find a valid TIM IE in " | 1337 | b43warn(dev->wl, "Did not find a valid TIM IE in " |
1338 | "the beacon template packet. AP or IBSS operation " | 1338 | "the beacon template packet. AP or IBSS operation " |
1339 | "may be broken.\n"); | 1339 | "may be broken.\n"); |
1340 | } | 1340 | } else |
1341 | b43dbg(dev->wl, "Updated beacon template\n"); | ||
1341 | } | 1342 | } |
1342 | 1343 | ||
1343 | static void b43_write_probe_resp_plcp(struct b43_wldev *dev, | 1344 | static void b43_write_probe_resp_plcp(struct b43_wldev *dev, |
@@ -1447,6 +1448,27 @@ static void b43_write_probe_resp_template(struct b43_wldev *dev, | |||
1447 | kfree(probe_resp_data); | 1448 | kfree(probe_resp_data); |
1448 | } | 1449 | } |
1449 | 1450 | ||
1451 | static void b43_beacon_update_trigger_work(struct work_struct *work) | ||
1452 | { | ||
1453 | struct b43_wl *wl = container_of(work, struct b43_wl, | ||
1454 | beacon_update_trigger); | ||
1455 | struct b43_wldev *dev; | ||
1456 | |||
1457 | mutex_lock(&wl->mutex); | ||
1458 | dev = wl->current_dev; | ||
1459 | if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { | ||
1460 | /* Force the microcode to trigger the | ||
1461 | * beacon update bottom-half IRQ. */ | ||
1462 | spin_lock_irq(&wl->irq_lock); | ||
1463 | b43_write32(dev, B43_MMIO_MACCMD, | ||
1464 | b43_read32(dev, B43_MMIO_MACCMD) | ||
1465 | | B43_MACCMD_BEACON0_VALID | ||
1466 | | B43_MACCMD_BEACON1_VALID); | ||
1467 | spin_unlock_irq(&wl->irq_lock); | ||
1468 | } | ||
1469 | mutex_unlock(&wl->mutex); | ||
1470 | } | ||
1471 | |||
1450 | /* Asynchronously update the packet templates in template RAM. | 1472 | /* Asynchronously update the packet templates in template RAM. |
1451 | * Locking: Requires wl->irq_lock to be locked. */ | 1473 | * Locking: Requires wl->irq_lock to be locked. */ |
1452 | static void b43_update_templates(struct b43_wl *wl, struct sk_buff *beacon) | 1474 | static void b43_update_templates(struct b43_wl *wl, struct sk_buff *beacon) |
@@ -1462,6 +1484,7 @@ static void b43_update_templates(struct b43_wl *wl, struct sk_buff *beacon) | |||
1462 | wl->current_beacon = beacon; | 1484 | wl->current_beacon = beacon; |
1463 | wl->beacon0_uploaded = 0; | 1485 | wl->beacon0_uploaded = 0; |
1464 | wl->beacon1_uploaded = 0; | 1486 | wl->beacon1_uploaded = 0; |
1487 | queue_work(wl->hw->workqueue, &wl->beacon_update_trigger); | ||
1465 | } | 1488 | } |
1466 | 1489 | ||
1467 | static void b43_set_ssid(struct b43_wldev *dev, const u8 * ssid, u8 ssid_len) | 1490 | static void b43_set_ssid(struct b43_wldev *dev, const u8 * ssid, u8 ssid_len) |
@@ -1487,18 +1510,20 @@ static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int) | |||
1487 | { | 1510 | { |
1488 | b43_time_lock(dev); | 1511 | b43_time_lock(dev); |
1489 | if (dev->dev->id.revision >= 3) { | 1512 | if (dev->dev->id.revision >= 3) { |
1490 | b43_write32(dev, 0x188, (beacon_int << 16)); | 1513 | b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); |
1514 | b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); | ||
1491 | } else { | 1515 | } else { |
1492 | b43_write16(dev, 0x606, (beacon_int >> 6)); | 1516 | b43_write16(dev, 0x606, (beacon_int >> 6)); |
1493 | b43_write16(dev, 0x610, beacon_int); | 1517 | b43_write16(dev, 0x610, beacon_int); |
1494 | } | 1518 | } |
1495 | b43_time_unlock(dev); | 1519 | b43_time_unlock(dev); |
1520 | b43dbg(dev->wl, "Set beacon interval to %u\n", beacon_int); | ||
1496 | } | 1521 | } |
1497 | 1522 | ||
1498 | static void handle_irq_beacon(struct b43_wldev *dev) | 1523 | static void handle_irq_beacon(struct b43_wldev *dev) |
1499 | { | 1524 | { |
1500 | struct b43_wl *wl = dev->wl; | 1525 | struct b43_wl *wl = dev->wl; |
1501 | u32 cmd; | 1526 | u32 cmd, beacon0_valid, beacon1_valid; |
1502 | 1527 | ||
1503 | if (!b43_is_mode(wl, IEEE80211_IF_TYPE_AP)) | 1528 | if (!b43_is_mode(wl, IEEE80211_IF_TYPE_AP)) |
1504 | return; | 1529 | return; |
@@ -1506,7 +1531,11 @@ static void handle_irq_beacon(struct b43_wldev *dev) | |||
1506 | /* This is the bottom half of the asynchronous beacon update. */ | 1531 | /* This is the bottom half of the asynchronous beacon update. */ |
1507 | 1532 | ||
1508 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | 1533 | cmd = b43_read32(dev, B43_MMIO_MACCMD); |
1509 | if (!(cmd & B43_MACCMD_BEACON0_VALID)) { | 1534 | beacon0_valid = (cmd & B43_MACCMD_BEACON0_VALID); |
1535 | beacon1_valid = (cmd & B43_MACCMD_BEACON1_VALID); | ||
1536 | cmd &= ~(B43_MACCMD_BEACON0_VALID | B43_MACCMD_BEACON1_VALID); | ||
1537 | |||
1538 | if (!beacon0_valid) { | ||
1510 | if (!wl->beacon0_uploaded) { | 1539 | if (!wl->beacon0_uploaded) { |
1511 | b43_write_beacon_template(dev, 0x68, 0x18, | 1540 | b43_write_beacon_template(dev, 0x68, 0x18, |
1512 | B43_CCK_RATE_1MB); | 1541 | B43_CCK_RATE_1MB); |
@@ -1515,8 +1544,7 @@ static void handle_irq_beacon(struct b43_wldev *dev) | |||
1515 | wl->beacon0_uploaded = 1; | 1544 | wl->beacon0_uploaded = 1; |
1516 | } | 1545 | } |
1517 | cmd |= B43_MACCMD_BEACON0_VALID; | 1546 | cmd |= B43_MACCMD_BEACON0_VALID; |
1518 | } | 1547 | } else if (!beacon1_valid) { |
1519 | if (!(cmd & B43_MACCMD_BEACON1_VALID)) { | ||
1520 | if (!wl->beacon1_uploaded) { | 1548 | if (!wl->beacon1_uploaded) { |
1521 | b43_write_beacon_template(dev, 0x468, 0x1A, | 1549 | b43_write_beacon_template(dev, 0x468, 0x1A, |
1522 | B43_CCK_RATE_1MB); | 1550 | B43_CCK_RATE_1MB); |
@@ -4012,6 +4040,7 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
4012 | 4040 | ||
4013 | b43_rfkill_exit(dev); | 4041 | b43_rfkill_exit(dev); |
4014 | cancel_work_sync(&(wl->qos_update_work)); | 4042 | cancel_work_sync(&(wl->qos_update_work)); |
4043 | cancel_work_sync(&(wl->beacon_update_trigger)); | ||
4015 | 4044 | ||
4016 | mutex_lock(&wl->mutex); | 4045 | mutex_lock(&wl->mutex); |
4017 | if (b43_status(dev) >= B43_STAT_STARTED) | 4046 | if (b43_status(dev) >= B43_STAT_STARTED) |
@@ -4389,6 +4418,7 @@ static int b43_wireless_init(struct ssb_device *dev) | |||
4389 | mutex_init(&wl->mutex); | 4418 | mutex_init(&wl->mutex); |
4390 | INIT_LIST_HEAD(&wl->devlist); | 4419 | INIT_LIST_HEAD(&wl->devlist); |
4391 | INIT_WORK(&wl->qos_update_work, b43_qos_update_work); | 4420 | INIT_WORK(&wl->qos_update_work, b43_qos_update_work); |
4421 | INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work); | ||
4392 | 4422 | ||
4393 | ssb_set_devtypedata(dev, wl); | 4423 | ssb_set_devtypedata(dev, wl); |
4394 | b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id); | 4424 | b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id); |