diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-10-28 11:19:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:03:30 -0500 |
commit | 74cfdba7ce7b601559a4bcdc9054baf1bdc6948d (patch) | |
tree | 72eef3f57fbc3cf4d2170a45a179e7d89a5c5429 | |
parent | c6dfc9a8ec236957eea3a1cf4613e90c45e1475b (diff) |
b43: Use the retry limit parameters from mac80211
Use the limits provided by mac80211.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/b43/main.c | 80 | ||||
-rw-r--r-- | drivers/net/wireless/b43/xmit.c | 3 |
2 files changed, 53 insertions, 30 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 9568ab17fe71..178ad9120107 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -75,14 +75,6 @@ module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); | |||
75 | MODULE_PARM_DESC(bad_frames_preempt, | 75 | MODULE_PARM_DESC(bad_frames_preempt, |
76 | "enable(1) / disable(0) Bad Frames Preemption"); | 76 | "enable(1) / disable(0) Bad Frames Preemption"); |
77 | 77 | ||
78 | static int modparam_short_retry = B43_DEFAULT_SHORT_RETRY_LIMIT; | ||
79 | module_param_named(short_retry, modparam_short_retry, int, 0444); | ||
80 | MODULE_PARM_DESC(short_retry, "Short-Retry-Limit (0 - 15)"); | ||
81 | |||
82 | static int modparam_long_retry = B43_DEFAULT_LONG_RETRY_LIMIT; | ||
83 | module_param_named(long_retry, modparam_long_retry, int, 0444); | ||
84 | MODULE_PARM_DESC(long_retry, "Long-Retry-Limit (0 - 15)"); | ||
85 | |||
86 | static char modparam_fwpostfix[16]; | 78 | static char modparam_fwpostfix[16]; |
87 | module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); | 79 | module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); |
88 | MODULE_PARM_DESC(fwpostfix, "Postfix for the .fw files to load."); | 80 | MODULE_PARM_DESC(fwpostfix, "Postfix for the .fw files to load."); |
@@ -3257,6 +3249,22 @@ static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) | |||
3257 | #endif /* CONFIG_SSB_DRIVER_PCICORE */ | 3249 | #endif /* CONFIG_SSB_DRIVER_PCICORE */ |
3258 | } | 3250 | } |
3259 | 3251 | ||
3252 | /* Write the short and long frame retry limit values. */ | ||
3253 | static void b43_set_retry_limits(struct b43_wldev *dev, | ||
3254 | unsigned int short_retry, | ||
3255 | unsigned int long_retry) | ||
3256 | { | ||
3257 | /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing | ||
3258 | * the chip-internal counter. */ | ||
3259 | short_retry = min(short_retry, (unsigned int)0xF); | ||
3260 | long_retry = min(long_retry, (unsigned int)0xF); | ||
3261 | |||
3262 | b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT, | ||
3263 | short_retry); | ||
3264 | b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT, | ||
3265 | long_retry); | ||
3266 | } | ||
3267 | |||
3260 | /* Shutdown a wireless core */ | 3268 | /* Shutdown a wireless core */ |
3261 | /* Locking: wl->mutex */ | 3269 | /* Locking: wl->mutex */ |
3262 | static void b43_wireless_core_exit(struct b43_wldev *dev) | 3270 | static void b43_wireless_core_exit(struct b43_wldev *dev) |
@@ -3342,15 +3350,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
3342 | } | 3350 | } |
3343 | b43_hf_write(dev, hf); | 3351 | b43_hf_write(dev, hf); |
3344 | 3352 | ||
3345 | /* Short/Long Retry Limit. | 3353 | b43_set_retry_limits(dev, B43_DEFAULT_SHORT_RETRY_LIMIT, |
3346 | * The retry-limit is a 4-bit counter. Enforce this to avoid overflowing | 3354 | B43_DEFAULT_LONG_RETRY_LIMIT); |
3347 | * the chip-internal counter. | ||
3348 | */ | ||
3349 | tmp = limit_value(modparam_short_retry, 0, 0xF); | ||
3350 | b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT, tmp); | ||
3351 | tmp = limit_value(modparam_long_retry, 0, 0xF); | ||
3352 | b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT, tmp); | ||
3353 | |||
3354 | b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_SFFBLIM, 3); | 3355 | b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_SFFBLIM, 3); |
3355 | b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_LFFBLIM, 2); | 3356 | b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_LFFBLIM, 2); |
3356 | 3357 | ||
@@ -3533,19 +3534,40 @@ static void b43_stop(struct ieee80211_hw *hw) | |||
3533 | mutex_unlock(&wl->mutex); | 3534 | mutex_unlock(&wl->mutex); |
3534 | } | 3535 | } |
3535 | 3536 | ||
3537 | static int b43_op_set_retry_limit(struct ieee80211_hw *hw, | ||
3538 | u32 short_retry_limit, u32 long_retry_limit) | ||
3539 | { | ||
3540 | struct b43_wl *wl = hw_to_b43_wl(hw); | ||
3541 | struct b43_wldev *dev; | ||
3542 | int err = 0; | ||
3543 | |||
3544 | mutex_lock(&wl->mutex); | ||
3545 | dev = wl->current_dev; | ||
3546 | if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) { | ||
3547 | err = -ENODEV; | ||
3548 | goto out_unlock; | ||
3549 | } | ||
3550 | b43_set_retry_limits(dev, short_retry_limit, long_retry_limit); | ||
3551 | out_unlock: | ||
3552 | mutex_unlock(&wl->mutex); | ||
3553 | |||
3554 | return err; | ||
3555 | } | ||
3556 | |||
3536 | static const struct ieee80211_ops b43_hw_ops = { | 3557 | static const struct ieee80211_ops b43_hw_ops = { |
3537 | .tx = b43_tx, | 3558 | .tx = b43_tx, |
3538 | .conf_tx = b43_conf_tx, | 3559 | .conf_tx = b43_conf_tx, |
3539 | .add_interface = b43_add_interface, | 3560 | .add_interface = b43_add_interface, |
3540 | .remove_interface = b43_remove_interface, | 3561 | .remove_interface = b43_remove_interface, |
3541 | .config = b43_dev_config, | 3562 | .config = b43_dev_config, |
3542 | .config_interface = b43_config_interface, | 3563 | .config_interface = b43_config_interface, |
3543 | .configure_filter = b43_configure_filter, | 3564 | .configure_filter = b43_configure_filter, |
3544 | .set_key = b43_dev_set_key, | 3565 | .set_key = b43_dev_set_key, |
3545 | .get_stats = b43_get_stats, | 3566 | .get_stats = b43_get_stats, |
3546 | .get_tx_stats = b43_get_tx_stats, | 3567 | .get_tx_stats = b43_get_tx_stats, |
3547 | .start = b43_start, | 3568 | .start = b43_start, |
3548 | .stop = b43_stop, | 3569 | .stop = b43_stop, |
3570 | .set_retry_limit = b43_op_set_retry_limit, | ||
3549 | }; | 3571 | }; |
3550 | 3572 | ||
3551 | /* Hard-reset the chip. Do not call this directly. | 3573 | /* Hard-reset the chip. Do not call this directly. |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index bcbb32872e85..3659438e637c 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -294,6 +294,8 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, | |||
294 | mac_ctl |= B43_TX4_MAC_STMSDU; | 294 | mac_ctl |= B43_TX4_MAC_STMSDU; |
295 | if (phy->type == B43_PHYTYPE_A) | 295 | if (phy->type == B43_PHYTYPE_A) |
296 | mac_ctl |= B43_TX4_MAC_5GHZ; | 296 | mac_ctl |= B43_TX4_MAC_5GHZ; |
297 | if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) | ||
298 | mac_ctl |= B43_TX4_MAC_LONGFRAME; | ||
297 | 299 | ||
298 | /* Generate the RTS or CTS-to-self frame */ | 300 | /* Generate the RTS or CTS-to-self frame */ |
299 | if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || | 301 | if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || |
@@ -342,7 +344,6 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, | |||
342 | b43_plcp_get_ratecode_cck(rts_rate); | 344 | b43_plcp_get_ratecode_cck(rts_rate); |
343 | if (rts_rate_fb_ofdm) | 345 | if (rts_rate_fb_ofdm) |
344 | extra_ft |= B43_TX4_EFT_RTSFBOFDM; | 346 | extra_ft |= B43_TX4_EFT_RTSFBOFDM; |
345 | mac_ctl |= B43_TX4_MAC_LONGFRAME; | ||
346 | } | 347 | } |
347 | 348 | ||
348 | /* Magic cookie */ | 349 | /* Magic cookie */ |