CHROMIUMOS: mac80211: Use different probe counts on resume
authorPaul Stewart <pstew@chromium.org>
Thu, 10 May 2012 00:40:11 +0000 (00:40 +0000)
committerOlof Johansson <olof@lixom.net>
Fri, 1 Jun 2012 07:03:18 +0000 (00:03 -0700)
We recently increased the probe retry count for beacon monitoring
in order to make challenging channel conditions less volatile.  In
doing so, we made the system slower to respond to a lost AP when the
system resumes from suspend.  Mitigate this by using a different
try-count for the resume-from-suspend case.

BUG=chromium-os:28576
TEST=Manual: Suspend, unplug AP, resume.  Observe disconnection in < 1sec

Change-Id: I206d4b2838da2ce7da00739412e5fcda63a27a2c
Signed-off-by: Paul Stewart <pstew@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/19234
Reviewed-by: Gary Morain <gmorain@chromium.org>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c

index db8fae5..4b53162 100644 (file)
@@ -378,6 +378,7 @@ enum ieee80211_sta_flags {
        IEEE80211_STA_UAPSD_ENABLED     = BIT(7),
        IEEE80211_STA_NULLFUNC_ACKED    = BIT(8),
        IEEE80211_STA_RESET_SIGNAL_AVE  = BIT(9),
+       IEEE80211_STA_RESUME_POLL       = BIT(10),
 };
 
 struct ieee80211_mgd_auth_data {
index 364dc45..d1f2e8c 100644 (file)
@@ -41,6 +41,12 @@ module_param(max_nullfunc_tries, int, 0644);
 MODULE_PARM_DESC(max_nullfunc_tries,
                 "Maximum nullfunc tx tries before disconnecting (reason 4).");
 
+static int max_nullfunc_tries_resume = 2;
+module_param(max_nullfunc_tries_resume, int, 0644);
+MODULE_PARM_DESC(max_nullfunc_tries_resume,
+                "Maximum nullfunc tx tries on resume before disconnecting "
+                "(reason 4).");
+
 static int max_probe_tries = 5;
 module_param(max_probe_tries, int, 0644);
 MODULE_PARM_DESC(max_probe_tries,
@@ -1331,7 +1337,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 
        /* just to be sure */
        sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
-                               IEEE80211_STA_BEACON_POLL);
+                               IEEE80211_STA_BEACON_POLL |
+                               IEEE80211_STA_RESUME_POLL);
 
        ieee80211_led_assoc(local, 1);
 
@@ -1495,11 +1502,13 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 
        if (!(ifmgd->flags & (IEEE80211_STA_BEACON_POLL |
-                             IEEE80211_STA_CONNECTION_POLL)))
+                             IEEE80211_STA_CONNECTION_POLL |
+                             IEEE80211_STA_RESUME_POLL)))
            return;
 
        ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
-                         IEEE80211_STA_BEACON_POLL);
+                         IEEE80211_STA_BEACON_POLL |
+                         IEEE80211_STA_RESUME_POLL);
        mutex_lock(&sdata->local->iflist_mtx);
        ieee80211_recalc_ps(sdata->local, -1);
        mutex_unlock(&sdata->local->iflist_mtx);
@@ -2639,7 +2648,8 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
        u8 frame_buf[DEAUTH_DISASSOC_LEN];
 
        ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
-                         IEEE80211_STA_BEACON_POLL);
+                         IEEE80211_STA_BEACON_POLL |
+                         IEEE80211_STA_RESUME_POLL);
 
        ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
                               false, frame_buf);
@@ -2797,16 +2807,20 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
                run_again(ifmgd, ifmgd->assoc_data->timeout);
 
        if (ifmgd->flags & (IEEE80211_STA_BEACON_POLL |
-                           IEEE80211_STA_CONNECTION_POLL) &&
+                           IEEE80211_STA_CONNECTION_POLL |
+                           IEEE80211_STA_RESUME_POLL) &&
            ifmgd->associated) {
                u8 bssid[ETH_ALEN];
                int max_tries;
 
                memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
 
-               if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
-                       max_tries = max_nullfunc_tries;
-               else
+               if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {
+                       if (ifmgd->flags & IEEE80211_STA_RESUME_POLL)
+                               max_tries = max_nullfunc_tries_resume;
+                       else
+                               max_tries = max_nullfunc_tries;
+               } else
                        max_tries = max_probe_tries;
 
                /* ACK received for nullfunc probing frame */
@@ -2918,7 +2932,8 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
 
        if (sdata->vif.type == NL80211_IFTYPE_STATION) {
                sdata->u.mgd.flags &= ~(IEEE80211_STA_BEACON_POLL |
-                                       IEEE80211_STA_CONNECTION_POLL);
+                                       IEEE80211_STA_CONNECTION_POLL |
+                                       IEEE80211_STA_RESUME_POLL);
 
                /* let's probe the connection once */
                flags = sdata->local->hw.flags;
@@ -2988,6 +3003,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
                add_timer(&ifmgd->chswitch_timer);
        ieee80211_sta_reset_beacon_monitor(sdata);
        ieee80211_restart_sta_timer(sdata);
+       ifmgd->flags |= IEEE80211_STA_RESUME_POLL;
+       ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.monitor_work);
 }
 #endif