mac80211: when receiving DTIM disable power-save mode only if it was enabled
authorRonald Wahl <ronald.wahl@raritan.com>
Mon, 19 Mar 2012 13:37:20 +0000 (14:37 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Apr 2012 20:12:30 +0000 (16:12 -0400)
When receiving DTIM we currently disable power save mode in the
hardware unconditionally, i.e. also when the hardware was not sleeping.
This causes trouble with at least one wireless chipset (Ralink RT3572).
When the hardware is not sleeping and we send a wakeup command (e.g.
this happens after a scan) then a significant decrease of the link
quality or a disconnect may occur.
Disabling power save mode only when it was enabled prevents this issue.

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
Reviewed-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/mlme.c

index c59bc509ed6f209210393747074f2f4510271f8b..bb7e5189e27e75829664a50f665860e113651075 100644 (file)
@@ -2471,9 +2471,11 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
        if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
                if (directed_tim) {
                        if (local->hw.conf.dynamic_ps_timeout > 0) {
-                               local->hw.conf.flags &= ~IEEE80211_CONF_PS;
-                               ieee80211_hw_config(local,
-                                                   IEEE80211_CONF_CHANGE_PS);
+                               if (local->hw.conf.flags & IEEE80211_CONF_PS) {
+                                       local->hw.conf.flags &= ~IEEE80211_CONF_PS;
+                                       ieee80211_hw_config(local,
+                                                           IEEE80211_CONF_CHANGE_PS);
+                               }
                                ieee80211_send_nullfunc(local, sdata, 0);
                        } else if (!local->pspolling && sdata->u.mgd.powersave) {
                                local->pspolling = true;