aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/main.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-14 13:17:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:14 -0400
commit9124b07740c51cbc6e358dd0c4abc6ee8ded084d (patch)
tree5746885ca90399588f0735aa1a5511648f0be329 /drivers/net/wireless/b43legacy/main.c
parent525181891fb5ed323b6ba0f141c422f1395acfb9 (diff)
mac80211: make retry limits part of hw config
Instead of having a separate callback, use the HW config callback with a new flag to change retry limits. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy/main.c')
-rw-r--r--drivers/net/wireless/b43legacy/main.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 793cc396562..78e46365f69 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2556,6 +2556,20 @@ init_failure:
2556 return err; 2556 return err;
2557} 2557}
2558 2558
2559/* Write the short and long frame retry limit values. */
2560static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
2561 unsigned int short_retry,
2562 unsigned int long_retry)
2563{
2564 /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
2565 * the chip-internal counter. */
2566 short_retry = min(short_retry, (unsigned int)0xF);
2567 long_retry = min(long_retry, (unsigned int)0xF);
2568
2569 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
2570 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
2571}
2572
2559static int b43legacy_op_dev_config(struct ieee80211_hw *hw, 2573static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
2560 u32 changed) 2574 u32 changed)
2561{ 2575{
@@ -2577,6 +2591,14 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
2577 dev = wl->current_dev; 2591 dev = wl->current_dev;
2578 phy = &dev->phy; 2592 phy = &dev->phy;
2579 2593
2594 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
2595 b43legacy_set_retry_limits(dev,
2596 conf->short_frame_max_tx_count,
2597 conf->long_frame_max_tx_count);
2598 changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
2599 if (!changed)
2600 goto out_unlock_mutex;
2601
2580 /* Switch the PHY mode (if necessary). */ 2602 /* Switch the PHY mode (if necessary). */
2581 switch (conf->channel->band) { 2603 switch (conf->channel->band) {
2582 case IEEE80211_BAND_2GHZ: 2604 case IEEE80211_BAND_2GHZ:
@@ -2989,20 +3011,6 @@ static void b43legacy_imcfglo_timeouts_workaround(struct b43legacy_wldev *dev)
2989#endif /* CONFIG_SSB_DRIVER_PCICORE */ 3011#endif /* CONFIG_SSB_DRIVER_PCICORE */
2990} 3012}
2991 3013
2992/* Write the short and long frame retry limit values. */
2993static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
2994 unsigned int short_retry,
2995 unsigned int long_retry)
2996{
2997 /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
2998 * the chip-internal counter. */
2999 short_retry = min(short_retry, (unsigned int)0xF);
3000 long_retry = min(long_retry, (unsigned int)0xF);
3001
3002 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
3003 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
3004}
3005
3006static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev, 3014static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev,
3007 bool idle) { 3015 bool idle) {
3008 u16 pu_delay = 1050; 3016 u16 pu_delay = 1050;
@@ -3367,28 +3375,6 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw)
3367 mutex_unlock(&wl->mutex); 3375 mutex_unlock(&wl->mutex);
3368} 3376}
3369 3377
3370static int b43legacy_op_set_retry_limit(struct ieee80211_hw *hw,
3371 u32 short_retry_limit,
3372 u32 long_retry_limit)
3373{
3374 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3375 struct b43legacy_wldev *dev;
3376 int err = 0;
3377
3378 mutex_lock(&wl->mutex);
3379 dev = wl->current_dev;
3380 if (unlikely(!dev ||
3381 (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
3382 err = -ENODEV;
3383 goto out_unlock;
3384 }
3385 b43legacy_set_retry_limits(dev, short_retry_limit, long_retry_limit);
3386out_unlock:
3387 mutex_unlock(&wl->mutex);
3388
3389 return err;
3390}
3391
3392static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw, 3378static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,
3393 struct ieee80211_sta *sta, bool set) 3379 struct ieee80211_sta *sta, bool set)
3394{ 3380{
@@ -3414,7 +3400,6 @@ static const struct ieee80211_ops b43legacy_hw_ops = {
3414 .get_tx_stats = b43legacy_op_get_tx_stats, 3400 .get_tx_stats = b43legacy_op_get_tx_stats,
3415 .start = b43legacy_op_start, 3401 .start = b43legacy_op_start,
3416 .stop = b43legacy_op_stop, 3402 .stop = b43legacy_op_stop,
3417 .set_retry_limit = b43legacy_op_set_retry_limit,
3418 .set_tim = b43legacy_op_beacon_set_tim, 3403 .set_tim = b43legacy_op_beacon_set_tim,
3419}; 3404};
3420 3405