aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/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/b43/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/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c60
1 files changed, 23 insertions, 37 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 2e81af1022e4..9aeeb6553a91 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3320,6 +3320,22 @@ init_failure:
3320 return err; 3320 return err;
3321} 3321}
3322 3322
3323/* Write the short and long frame retry limit values. */
3324static void b43_set_retry_limits(struct b43_wldev *dev,
3325 unsigned int short_retry,
3326 unsigned int long_retry)
3327{
3328 /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
3329 * the chip-internal counter. */
3330 short_retry = min(short_retry, (unsigned int)0xF);
3331 long_retry = min(long_retry, (unsigned int)0xF);
3332
3333 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
3334 short_retry);
3335 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
3336 long_retry);
3337}
3338
3323static int b43_op_config(struct ieee80211_hw *hw, u32 changed) 3339static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
3324{ 3340{
3325 struct b43_wl *wl = hw_to_b43_wl(hw); 3341 struct b43_wl *wl = hw_to_b43_wl(hw);
@@ -3340,6 +3356,13 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
3340 dev = wl->current_dev; 3356 dev = wl->current_dev;
3341 phy = &dev->phy; 3357 phy = &dev->phy;
3342 3358
3359 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
3360 b43_set_retry_limits(dev, conf->short_frame_max_tx_count,
3361 conf->long_frame_max_tx_count);
3362 changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
3363 if (!changed)
3364 goto out_unlock_mutex;
3365
3343 /* Disable IRQs while reconfiguring the device. 3366 /* Disable IRQs while reconfiguring the device.
3344 * This makes it possible to drop the spinlock throughout 3367 * This makes it possible to drop the spinlock throughout
3345 * the reconfiguration process. */ 3368 * the reconfiguration process. */
@@ -3859,22 +3882,6 @@ static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev)
3859#endif /* CONFIG_SSB_DRIVER_PCICORE */ 3882#endif /* CONFIG_SSB_DRIVER_PCICORE */
3860} 3883}
3861 3884
3862/* Write the short and long frame retry limit values. */
3863static void b43_set_retry_limits(struct b43_wldev *dev,
3864 unsigned int short_retry,
3865 unsigned int long_retry)
3866{
3867 /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
3868 * the chip-internal counter. */
3869 short_retry = min(short_retry, (unsigned int)0xF);
3870 long_retry = min(long_retry, (unsigned int)0xF);
3871
3872 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
3873 short_retry);
3874 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
3875 long_retry);
3876}
3877
3878static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle) 3885static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle)
3879{ 3886{
3880 u16 pu_delay; 3887 u16 pu_delay;
@@ -4195,26 +4202,6 @@ static void b43_op_stop(struct ieee80211_hw *hw)
4195 cancel_work_sync(&(wl->txpower_adjust_work)); 4202 cancel_work_sync(&(wl->txpower_adjust_work));
4196} 4203}
4197 4204
4198static int b43_op_set_retry_limit(struct ieee80211_hw *hw,
4199 u32 short_retry_limit, u32 long_retry_limit)
4200{
4201 struct b43_wl *wl = hw_to_b43_wl(hw);
4202 struct b43_wldev *dev;
4203 int err = 0;
4204
4205 mutex_lock(&wl->mutex);
4206 dev = wl->current_dev;
4207 if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
4208 err = -ENODEV;
4209 goto out_unlock;
4210 }
4211 b43_set_retry_limits(dev, short_retry_limit, long_retry_limit);
4212out_unlock:
4213 mutex_unlock(&wl->mutex);
4214
4215 return err;
4216}
4217
4218static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, 4205static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
4219 struct ieee80211_sta *sta, bool set) 4206 struct ieee80211_sta *sta, bool set)
4220{ 4207{
@@ -4251,7 +4238,6 @@ static const struct ieee80211_ops b43_hw_ops = {
4251 .get_tx_stats = b43_op_get_tx_stats, 4238 .get_tx_stats = b43_op_get_tx_stats,
4252 .start = b43_op_start, 4239 .start = b43_op_start,
4253 .stop = b43_op_stop, 4240 .stop = b43_op_stop,
4254 .set_retry_limit = b43_op_set_retry_limit,
4255 .set_tim = b43_op_beacon_set_tim, 4241 .set_tim = b43_op_beacon_set_tim,
4256 .sta_notify = b43_op_sta_notify, 4242 .sta_notify = b43_op_sta_notify,
4257}; 4243};