Commit 0a6e1bee authored by Stefano Brivio's avatar Stefano Brivio Committed by David S. Miller

b43legacy: use the retry limits provided by mac80211

Use the retry limits provided by mac80211.

The patch to b43 by Michael Buesch <mb@bu3sch.de> has been ported to
b43legacy.
Signed-off-by: default avatarStefano Brivio <stefano.brivio@polimi.it>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 43831b15
...@@ -75,14 +75,6 @@ module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); ...@@ -75,14 +75,6 @@ module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
MODULE_PARM_DESC(bad_frames_preempt, "enable(1) / disable(0) Bad Frames" MODULE_PARM_DESC(bad_frames_preempt, "enable(1) / disable(0) Bad Frames"
" Preemption"); " Preemption");
static int modparam_short_retry = B43legacy_DEFAULT_SHORT_RETRY_LIMIT;
module_param_named(short_retry, modparam_short_retry, int, 0444);
MODULE_PARM_DESC(short_retry, "Short-Retry-Limit (0 - 15)");
static int modparam_long_retry = B43legacy_DEFAULT_LONG_RETRY_LIMIT;
module_param_named(long_retry, modparam_long_retry, int, 0444);
MODULE_PARM_DESC(long_retry, "Long-Retry-Limit (0 - 15)");
static char modparam_fwpostfix[16]; static char modparam_fwpostfix[16];
module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444);
MODULE_PARM_DESC(fwpostfix, "Postfix for the firmware files to load."); MODULE_PARM_DESC(fwpostfix, "Postfix for the firmware files to load.");
...@@ -2930,6 +2922,20 @@ static void b43legacy_imcfglo_timeouts_workaround(struct b43legacy_wldev *dev) ...@@ -2930,6 +2922,20 @@ static void b43legacy_imcfglo_timeouts_workaround(struct b43legacy_wldev *dev)
#endif /* CONFIG_SSB_DRIVER_PCICORE */ #endif /* CONFIG_SSB_DRIVER_PCICORE */
} }
/* Write the short and long frame retry limit values. */
static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
unsigned int short_retry,
unsigned int long_retry)
{
/* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
* the chip-internal counter. */
short_retry = min(short_retry, (unsigned int)0xF);
long_retry = min(long_retry, (unsigned int)0xF);
b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
}
/* Shutdown a wireless core */ /* Shutdown a wireless core */
/* Locking: wl->mutex */ /* Locking: wl->mutex */
static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
...@@ -3067,16 +3073,9 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) ...@@ -3067,16 +3073,9 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
} }
b43legacy_hf_write(dev, hf); b43legacy_hf_write(dev, hf);
/* Short/Long Retry Limit. b43legacy_set_retry_limits(dev,
* The retry-limit is a 4-bit counter. Enforce this to avoid overflowing B43legacy_DEFAULT_SHORT_RETRY_LIMIT,
* the chip-internal counter. B43legacy_DEFAULT_LONG_RETRY_LIMIT);
*/
tmp = limit_value(modparam_short_retry, 0, 0xF);
b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS,
0x0006, tmp);
tmp = limit_value(modparam_long_retry, 0, 0xF);
b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS,
0x0007, tmp);
b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, b43legacy_shm_write16(dev, B43legacy_SHM_SHARED,
0x0044, 3); 0x0044, 3);
...@@ -3253,6 +3252,27 @@ static void b43legacy_stop(struct ieee80211_hw *hw) ...@@ -3253,6 +3252,27 @@ static void b43legacy_stop(struct ieee80211_hw *hw)
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
} }
static int b43legacy_op_set_retry_limit(struct ieee80211_hw *hw,
u32 short_retry_limit,
u32 long_retry_limit)
{
struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
struct b43legacy_wldev *dev;
int err = 0;
mutex_lock(&wl->mutex);
dev = wl->current_dev;
if (unlikely(!dev ||
(b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
err = -ENODEV;
goto out_unlock;
}
b43legacy_set_retry_limits(dev, short_retry_limit, long_retry_limit);
out_unlock:
mutex_unlock(&wl->mutex);
return err;
}
static const struct ieee80211_ops b43legacy_hw_ops = { static const struct ieee80211_ops b43legacy_hw_ops = {
.tx = b43legacy_tx, .tx = b43legacy_tx,
...@@ -3266,6 +3286,7 @@ static const struct ieee80211_ops b43legacy_hw_ops = { ...@@ -3266,6 +3286,7 @@ static const struct ieee80211_ops b43legacy_hw_ops = {
.get_tx_stats = b43legacy_get_tx_stats, .get_tx_stats = b43legacy_get_tx_stats,
.start = b43legacy_start, .start = b43legacy_start,
.stop = b43legacy_stop, .stop = b43legacy_stop,
.set_retry_limit = b43legacy_op_set_retry_limit,
}; };
/* Hard-reset the chip. Do not call this directly. /* Hard-reset the chip. Do not call this directly.
......
...@@ -290,6 +290,8 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, ...@@ -290,6 +290,8 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev,
mac_ctl |= B43legacy_TX4_MAC_STMSDU; mac_ctl |= B43legacy_TX4_MAC_STMSDU;
if (rate_fb_ofdm) if (rate_fb_ofdm)
mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM; mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM;
if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT)
mac_ctl |= B43legacy_TX4_MAC_LONGFRAME;
/* Generate the RTS or CTS-to-self frame */ /* Generate the RTS or CTS-to-self frame */
if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) ||
...@@ -335,7 +337,6 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, ...@@ -335,7 +337,6 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev,
len, rts_rate_fb); len, rts_rate_fb);
hdr = (struct ieee80211_hdr *)(&txhdr->rts_frame); hdr = (struct ieee80211_hdr *)(&txhdr->rts_frame);
txhdr->rts_dur_fb = hdr->duration_id; txhdr->rts_dur_fb = hdr->duration_id;
mac_ctl |= B43legacy_TX4_MAC_LONGFRAME;
} }
/* Magic cookie */ /* Magic cookie */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment