rt2x00: Disable link tuning while scanning

While scanning the link tuner must be disabled. Otherwise
it will interfere with receiving all beacons for each channel
due to changing sensitivity levels.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Ivo van Doorn 2010-07-11 12:24:47 +02:00 committed by John W. Linville
parent 27df2a9ce9
commit d8147f9d9e
9 changed files with 47 additions and 4 deletions

View File

@ -1567,6 +1567,8 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
.config = rt2x00mac_config, .config = rt2x00mac_config,
.configure_filter = rt2x00mac_configure_filter, .configure_filter = rt2x00mac_configure_filter,
.set_tim = rt2x00mac_set_tim, .set_tim = rt2x00mac_set_tim,
.sw_scan_start = rt2x00mac_sw_scan_start,
.sw_scan_complete = rt2x00mac_sw_scan_complete,
.get_stats = rt2x00mac_get_stats, .get_stats = rt2x00mac_get_stats,
.bss_info_changed = rt2x00mac_bss_info_changed, .bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2400pci_conf_tx, .conf_tx = rt2400pci_conf_tx,

View File

@ -1864,6 +1864,8 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
.config = rt2x00mac_config, .config = rt2x00mac_config,
.configure_filter = rt2x00mac_configure_filter, .configure_filter = rt2x00mac_configure_filter,
.set_tim = rt2x00mac_set_tim, .set_tim = rt2x00mac_set_tim,
.sw_scan_start = rt2x00mac_sw_scan_start,
.sw_scan_complete = rt2x00mac_sw_scan_complete,
.get_stats = rt2x00mac_get_stats, .get_stats = rt2x00mac_get_stats,
.bss_info_changed = rt2x00mac_bss_info_changed, .bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2x00mac_conf_tx, .conf_tx = rt2x00mac_conf_tx,

View File

@ -1755,6 +1755,8 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = {
.configure_filter = rt2x00mac_configure_filter, .configure_filter = rt2x00mac_configure_filter,
.set_tim = rt2x00mac_set_tim, .set_tim = rt2x00mac_set_tim,
.set_key = rt2x00mac_set_key, .set_key = rt2x00mac_set_key,
.sw_scan_start = rt2x00mac_sw_scan_start,
.sw_scan_complete = rt2x00mac_sw_scan_complete,
.get_stats = rt2x00mac_get_stats, .get_stats = rt2x00mac_get_stats,
.bss_info_changed = rt2x00mac_bss_info_changed, .bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2x00mac_conf_tx, .conf_tx = rt2x00mac_conf_tx,

View File

@ -2896,6 +2896,8 @@ const struct ieee80211_ops rt2800_mac80211_ops = {
.configure_filter = rt2x00mac_configure_filter, .configure_filter = rt2x00mac_configure_filter,
.set_tim = rt2x00mac_set_tim, .set_tim = rt2x00mac_set_tim,
.set_key = rt2x00mac_set_key, .set_key = rt2x00mac_set_key,
.sw_scan_start = rt2x00mac_sw_scan_start,
.sw_scan_complete = rt2x00mac_sw_scan_complete,
.get_stats = rt2x00mac_get_stats, .get_stats = rt2x00mac_get_stats,
.get_tkip_seq = rt2800_get_tkip_seq, .get_tkip_seq = rt2800_get_tkip_seq,
.set_rts_threshold = rt2800_set_rts_threshold, .set_rts_threshold = rt2800_set_rts_threshold,

View File

@ -628,6 +628,7 @@ enum rt2x00_flags {
DEVICE_STATE_INITIALIZED, DEVICE_STATE_INITIALIZED,
DEVICE_STATE_STARTED, DEVICE_STATE_STARTED,
DEVICE_STATE_ENABLED_RADIO, DEVICE_STATE_ENABLED_RADIO,
DEVICE_STATE_SCANNING,
/* /*
* Driver requirements * Driver requirements
@ -1081,6 +1082,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
#else #else
#define rt2x00mac_set_key NULL #define rt2x00mac_set_key NULL
#endif /* CONFIG_RT2X00_LIB_CRYPTO */ #endif /* CONFIG_RT2X00_LIB_CRYPTO */
void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw);
void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw);
int rt2x00mac_get_stats(struct ieee80211_hw *hw, int rt2x00mac_get_stats(struct ieee80211_hw *hw,
struct ieee80211_low_level_stats *stats); struct ieee80211_low_level_stats *stats);
void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,

View File

@ -278,6 +278,15 @@ void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
if (!rt2x00dev->intf_sta_count) if (!rt2x00dev->intf_sta_count)
return; return;
/**
* While scanning, link tuning is disabled. By default
* the most sensitive settings will be used to make sure
* that all beacons and probe responses will be recieved
* during the scan.
*/
if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
return;
rt2x00link_reset_tuner(rt2x00dev, false); rt2x00link_reset_tuner(rt2x00dev, false);
if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
@ -338,7 +347,8 @@ static void rt2x00link_tuner(struct work_struct *work)
* When the radio is shutting down we should * When the radio is shutting down we should
* immediately cease all link tuning. * immediately cease all link tuning.
*/ */
if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) ||
test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
return; return;
/* /*

View File

@ -347,9 +347,11 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
/* /*
* Some configuration parameters (e.g. channel and antenna values) can * Some configuration parameters (e.g. channel and antenna values) can
* only be set when the radio is enabled, but do require the RX to * only be set when the radio is enabled, but do require the RX to
* be off. * be off. During this period we should keep link tuning enabled,
* if for any reason the link tuner must be reset, this will be
* handled by rt2x00lib_config().
*/ */
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF); rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
/* /*
* When we've just turned on the radio, we want to reprogram * When we've just turned on the radio, we want to reprogram
@ -367,7 +369,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant); rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant);
/* Turn RX back on */ /* Turn RX back on */
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON); rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
return 0; return 0;
} }
@ -540,6 +542,22 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
EXPORT_SYMBOL_GPL(rt2x00mac_set_key); EXPORT_SYMBOL_GPL(rt2x00mac_set_key);
#endif /* CONFIG_RT2X00_LIB_CRYPTO */ #endif /* CONFIG_RT2X00_LIB_CRYPTO */
void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
__set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
rt2x00link_stop_tuner(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start);
void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
__clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
rt2x00link_start_tuner(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete);
int rt2x00mac_get_stats(struct ieee80211_hw *hw, int rt2x00mac_get_stats(struct ieee80211_hw *hw,
struct ieee80211_low_level_stats *stats) struct ieee80211_low_level_stats *stats)
{ {

View File

@ -2784,6 +2784,8 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
.configure_filter = rt2x00mac_configure_filter, .configure_filter = rt2x00mac_configure_filter,
.set_tim = rt2x00mac_set_tim, .set_tim = rt2x00mac_set_tim,
.set_key = rt2x00mac_set_key, .set_key = rt2x00mac_set_key,
.sw_scan_start = rt2x00mac_sw_scan_start,
.sw_scan_complete = rt2x00mac_sw_scan_complete,
.get_stats = rt2x00mac_get_stats, .get_stats = rt2x00mac_get_stats,
.bss_info_changed = rt2x00mac_bss_info_changed, .bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt61pci_conf_tx, .conf_tx = rt61pci_conf_tx,

View File

@ -2229,6 +2229,8 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
.configure_filter = rt2x00mac_configure_filter, .configure_filter = rt2x00mac_configure_filter,
.set_tim = rt2x00mac_set_tim, .set_tim = rt2x00mac_set_tim,
.set_key = rt2x00mac_set_key, .set_key = rt2x00mac_set_key,
.sw_scan_start = rt2x00mac_sw_scan_start,
.sw_scan_complete = rt2x00mac_sw_scan_complete,
.get_stats = rt2x00mac_get_stats, .get_stats = rt2x00mac_get_stats,
.bss_info_changed = rt2x00mac_bss_info_changed, .bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt73usb_conf_tx, .conf_tx = rt73usb_conf_tx,