aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-08-28 13:33:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:13 -0400
commit18c8adeb0244f823ba78a51e23f813fe68bc3c54 (patch)
tree1b294669d04c207d8e90b5807780fe4eb81778d9 /drivers/net/wireless/b43/main.c
parentef1a628d83fc0423c36e773281162be790503168 (diff)
b43: Rewrite TX power adjustment
This patch rewrites the TX power recalculation algorithms to scale better with changed enviromnent. If there's low TX traffic, the power will be checked against the desired values every 60 seconds. If there is high TX traffic, the check is redone every 2 seconds. This improves the reaction times a lot and confuses the rate control less. It will also reduce the time it initially takes to tune to a new TX power value. With the old algorithm it could take about 30 to 45 seconds to settle to a new power value. This will happen in about two to four seconds now. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index af43f03b3189..63bafc2f3f0a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2805,6 +2805,9 @@ static void b43_periodic_every60sec(struct b43_wldev *dev)
2805 2805
2806 if (ops->pwork_60sec) 2806 if (ops->pwork_60sec)
2807 ops->pwork_60sec(dev); 2807 ops->pwork_60sec(dev);
2808
2809 /* Force check the TX power emission now. */
2810 b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME);
2808} 2811}
2809 2812
2810static void b43_periodic_every30sec(struct b43_wldev *dev) 2813static void b43_periodic_every30sec(struct b43_wldev *dev)
@@ -2835,8 +2838,6 @@ static void b43_periodic_every15sec(struct b43_wldev *dev)
2835 if (phy->ops->pwork_15sec) 2838 if (phy->ops->pwork_15sec)
2836 phy->ops->pwork_15sec(dev); 2839 phy->ops->pwork_15sec(dev);
2837 2840
2838 phy->ops->xmitpower(dev);
2839
2840 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); 2841 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
2841 wmb(); 2842 wmb();
2842} 2843}
@@ -3382,10 +3383,13 @@ static int b43_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
3382 3383
3383 /* Adjust the desired TX power level. */ 3384 /* Adjust the desired TX power level. */
3384 if (conf->power_level != 0) { 3385 if (conf->power_level != 0) {
3385 if (conf->power_level != phy->power_level) { 3386 spin_lock_irqsave(&wl->irq_lock, flags);
3386 phy->power_level = conf->power_level; 3387 if (conf->power_level != phy->desired_txpower) {
3387 phy->ops->xmitpower(dev); 3388 phy->desired_txpower = conf->power_level;
3389 b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME |
3390 B43_TXPWR_IGNORE_TSSI);
3388 } 3391 }
3392 spin_unlock_irqrestore(&wl->irq_lock, flags);
3389 } 3393 }
3390 3394
3391 /* Antennas for RX and management frame TX. */ 3395 /* Antennas for RX and management frame TX. */
@@ -3785,6 +3789,7 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
3785 struct b43_phy *phy) 3789 struct b43_phy *phy)
3786{ 3790{
3787 phy->hardware_power_control = !!modparam_hwpctl; 3791 phy->hardware_power_control = !!modparam_hwpctl;
3792 phy->next_txpwr_check_time = jiffies;
3788 /* PHY TX errors counter. */ 3793 /* PHY TX errors counter. */
3789 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); 3794 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
3790} 3795}
@@ -4204,6 +4209,8 @@ static void b43_op_stop(struct ieee80211_hw *hw)
4204 b43_wireless_core_stop(dev); 4209 b43_wireless_core_stop(dev);
4205 b43_wireless_core_exit(dev); 4210 b43_wireless_core_exit(dev);
4206 mutex_unlock(&wl->mutex); 4211 mutex_unlock(&wl->mutex);
4212
4213 cancel_work_sync(&(wl->txpower_adjust_work));
4207} 4214}
4208 4215
4209static int b43_op_set_retry_limit(struct ieee80211_hw *hw, 4216static int b43_op_set_retry_limit(struct ieee80211_hw *hw,
@@ -4581,6 +4588,7 @@ static int b43_wireless_init(struct ssb_device *dev)
4581 INIT_LIST_HEAD(&wl->devlist); 4588 INIT_LIST_HEAD(&wl->devlist);
4582 INIT_WORK(&wl->qos_update_work, b43_qos_update_work); 4589 INIT_WORK(&wl->qos_update_work, b43_qos_update_work);
4583 INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work); 4590 INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work);
4591 INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
4584 4592
4585 ssb_set_devtypedata(dev, wl); 4593 ssb_set_devtypedata(dev, wl);
4586 b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id); 4594 b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id);