rt2x00: Disable link tuning while scanning
authorIvo van Doorn <ivdoorn@gmail.com>
Sun, 11 Jul 2010 10:24:47 +0000 (12:24 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 12 Jul 2010 20:05:33 +0000 (16:05 -0400)
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>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00link.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 5d5047fa0a260a66f15769ec16b3c9f4f48dd7f0..d5f1fabe9faf453aa30184295af4772bd71d3eb6 100644 (file)
@@ -1567,6 +1567,8 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
        .config                 = rt2x00mac_config,
        .configure_filter       = rt2x00mac_configure_filter,
        .set_tim                = rt2x00mac_set_tim,
+       .sw_scan_start          = rt2x00mac_sw_scan_start,
+       .sw_scan_complete       = rt2x00mac_sw_scan_complete,
        .get_stats              = rt2x00mac_get_stats,
        .bss_info_changed       = rt2x00mac_bss_info_changed,
        .conf_tx                = rt2400pci_conf_tx,
index 1d4758ac131102485bf92afcba700361b46b6b95..096d6dbc83052bb520e3cafc4aeacec93dbd0ffb 100644 (file)
@@ -1864,6 +1864,8 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
        .config                 = rt2x00mac_config,
        .configure_filter       = rt2x00mac_configure_filter,
        .set_tim                = rt2x00mac_set_tim,
+       .sw_scan_start          = rt2x00mac_sw_scan_start,
+       .sw_scan_complete       = rt2x00mac_sw_scan_complete,
        .get_stats              = rt2x00mac_get_stats,
        .bss_info_changed       = rt2x00mac_bss_info_changed,
        .conf_tx                = rt2x00mac_conf_tx,
index 6e48a15af4c5bb3fb07fcab439e3f0224716166a..0b7888d43f37952e2647aace8b0dd8030a08bde3 100644 (file)
@@ -1755,6 +1755,8 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = {
        .configure_filter       = rt2x00mac_configure_filter,
        .set_tim                = rt2x00mac_set_tim,
        .set_key                = rt2x00mac_set_key,
+       .sw_scan_start          = rt2x00mac_sw_scan_start,
+       .sw_scan_complete       = rt2x00mac_sw_scan_complete,
        .get_stats              = rt2x00mac_get_stats,
        .bss_info_changed       = rt2x00mac_bss_info_changed,
        .conf_tx                = rt2x00mac_conf_tx,
index 255d089e87ea9732c4b41142771ccf8310a33355..bcf50fc7921528c5330ba81ee32edfe57fe56df8 100644 (file)
@@ -2896,6 +2896,8 @@ const struct ieee80211_ops rt2800_mac80211_ops = {
        .configure_filter       = rt2x00mac_configure_filter,
        .set_tim                = rt2x00mac_set_tim,
        .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_tkip_seq           = rt2800_get_tkip_seq,
        .set_rts_threshold      = rt2800_set_rts_threshold,
index 42f4661632786ba7604c37100bc9155e7ce3dea2..bf5e3f37e7052721c17468bbee9874ee42517a8b 100644 (file)
@@ -628,6 +628,7 @@ enum rt2x00_flags {
        DEVICE_STATE_INITIALIZED,
        DEVICE_STATE_STARTED,
        DEVICE_STATE_ENABLED_RADIO,
+       DEVICE_STATE_SCANNING,
 
        /*
         * Driver requirements
@@ -1081,6 +1082,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 #else
 #define rt2x00mac_set_key      NULL
 #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,
                        struct ieee80211_low_level_stats *stats);
 void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
index 801925bb157f76c5e4ab80b1a254dd489a7b1d0f..14f1d51262892d66e377e3484e8617989052ea01 100644 (file)
@@ -278,6 +278,15 @@ void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
        if (!rt2x00dev->intf_sta_count)
                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);
 
        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
         * 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;
 
        /*
index 3b838c0bf59f21d21f2a08f926edf0b1e4b3b06a..bbce496bc1826e444c9ebcfe8f96d669cc5dd17f 100644 (file)
@@ -347,9 +347,11 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
        /*
         * Some configuration parameters (e.g. channel and antenna values) can
         * 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
@@ -367,7 +369,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
        rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant);
 
        /* Turn RX back on */
-       rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+       rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
 
        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);
 #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,
                        struct ieee80211_low_level_stats *stats)
 {
index ee84536fb9f00eea90e27be3e3ce93abec77f1fe..fe7bce7c05de0f394fbe9bf2d232fbeffc13f7b8 100644 (file)
@@ -2784,6 +2784,8 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
        .configure_filter       = rt2x00mac_configure_filter,
        .set_tim                = rt2x00mac_set_tim,
        .set_key                = rt2x00mac_set_key,
+       .sw_scan_start          = rt2x00mac_sw_scan_start,
+       .sw_scan_complete       = rt2x00mac_sw_scan_complete,
        .get_stats              = rt2x00mac_get_stats,
        .bss_info_changed       = rt2x00mac_bss_info_changed,
        .conf_tx                = rt61pci_conf_tx,
index 156f5d3660137720bd80049bff7cf9d44824e042..9ea6a672d4e22283a573970023984c3481c89ac4 100644 (file)
@@ -2229,6 +2229,8 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
        .configure_filter       = rt2x00mac_configure_filter,
        .set_tim                = rt2x00mac_set_tim,
        .set_key                = rt2x00mac_set_key,
+       .sw_scan_start          = rt2x00mac_sw_scan_start,
+       .sw_scan_complete       = rt2x00mac_sw_scan_complete,
        .get_stats              = rt2x00mac_get_stats,
        .bss_info_changed       = rt2x00mac_bss_info_changed,
        .conf_tx                = rt73usb_conf_tx,