mac80211: improve station mode nullfunc probing
[openwrt/openwrt.git] / package / mac80211 / patches / 311-pending_work.patch
index a0d917e6a6fc6e1b49be77e00ce9903c7973a486..827f677b13e97743190713eb74cec07fc3f4d4d3 100644 (file)
        sdata->u.mgd.associated = cbss;
        memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN);
  
-@@ -1026,6 +1035,50 @@ void ieee80211_sta_rx_notify(struct ieee
+@@ -1026,6 +1035,51 @@ void ieee80211_sta_rx_notify(struct ieee
        ieee80211_sta_reset_conn_monitor(sdata);
  }
  
 +
 +      ieee80211_sta_reset_conn_monitor(sdata);
 +
-+      if (ieee80211_is_nullfunc(hdr->frame_control)) {
++      if (ieee80211_is_nullfunc(hdr->frame_control) &&
++          sdata->u.mgd.probe_send_count > 0) {
 +              sdata->u.mgd.probe_send_count = 0;
 +              ieee80211_queue_work(&sdata->local->hw, &sdata->work);
 +      }
  static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
  {
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-@@ -1041,8 +1094,19 @@ static void ieee80211_mgd_probe_ap_send(
+@@ -1041,8 +1095,19 @@ static void ieee80211_mgd_probe_ap_send(
        if (ifmgd->probe_send_count >= unicast_limit)
                dst = NULL;
  
  
        ifmgd->probe_send_count++;
        ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT;
-@@ -1509,29 +1573,8 @@ static void ieee80211_rx_mgmt_probe_resp
+@@ -1509,29 +1574,8 @@ static void ieee80211_rx_mgmt_probe_resp
        ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
  
        if (ifmgd->associated &&
  }
  
  /*
-@@ -1881,12 +1924,22 @@ void ieee80211_sta_work(struct ieee80211
+@@ -1881,12 +1925,23 @@ void ieee80211_sta_work(struct ieee80211
                            IEEE80211_STA_CONNECTION_POLL) &&
            ifmgd->associated) {
                u8 bssid[ETH_ALEN];
 +              int max_tries;
 +
-+              /* ACK received for nullfunc probing frame */
-+              if (!ifmgd->probe_send_count)
-+                      ieee80211_reset_ap_probe(sdata);
-+
 +              if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
 +                      max_tries = IEEE80211_MAX_NULLFUNC_TRIES;
 +              else
 +                      max_tries = IEEE80211_MAX_PROBE_TRIES;
  
                memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
-               if (time_is_after_jiffies(ifmgd->probe_timeout))
+-              if (time_is_after_jiffies(ifmgd->probe_timeout))
++
++              /* ACK received for nullfunc probing frame */
++              if (!ifmgd->probe_send_count)
++                      ieee80211_reset_ap_probe(sdata);
++
++              else if (time_is_after_jiffies(ifmgd->probe_timeout))
                        run_again(ifmgd, ifmgd->probe_timeout);
  
 -              else if (ifmgd->probe_send_count < IEEE80211_MAX_PROBE_TRIES) {
  #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
                        wiphy_debug(local->hw.wiphy,
                                    "%s: No probe response from AP %pM"
-@@ -2012,6 +2065,8 @@ void ieee80211_sta_restart(struct ieee80
+@@ -2012,6 +2067,8 @@ void ieee80211_sta_restart(struct ieee80
                add_timer(&ifmgd->timer);
        if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running))
                add_timer(&ifmgd->chswitch_timer);