]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
mac80211: stop tx before doing hw config and rate update
authorRajkumar Manoharan <rmanohar@qca.qualcomm.com>
Fri, 2 Sep 2011 08:21:59 +0000 (13:51 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 Sep 2011 17:56:18 +0000 (13:56 -0400)
The assumption is that during the hw config, transmission was
already stopped by mac80211. Sometimes the AP can be switching
b/w the ht modes due to intolerant or etc where STA is in
the middle of transmission. In such scenario, buffer overflow
was observed at driver side. And also before updating the rate
control, the frames are continued to xmited with older rates.
This patch ensures that the frames are always xmitted with
updated rates and avoid buffer overflow.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c

index 5e636bc3551fd11b31424030473009cef1db67dd..21186e280ceb11e50f47446f83e203e387ba4dd5 100644 (file)
@@ -671,6 +671,7 @@ enum queue_stop_reason {
        IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
        IEEE80211_QUEUE_STOP_REASON_SUSPEND,
        IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
+       IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE,
 };
 
 #ifdef CONFIG_MAC80211_LEDS
index fb2f0f986de7419ca5b029ec4047f5e14f893df1..ca97b80b2651cce2a0ad91965484ba1ede8064c5 100644 (file)
@@ -1918,8 +1918,24 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 
                rcu_read_unlock();
 
+               /*
+                * Whenever the AP announces the HT mode change that can be
+                * 40MHz intolerant or etc., it would be safer to stop tx
+                * queues before doing hw config to avoid buffer overflow.
+                */
+               ieee80211_stop_queues_by_reason(&sdata->local->hw,
+                               IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
+
+               /* flush out all packets */
+               synchronize_net();
+
+               drv_flush(local, false);
+
                changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem,
                                               bssid, ap_ht_cap_flags);
+
+               ieee80211_wake_queues_by_reason(&sdata->local->hw,
+                               IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
        }
 
        /* Note: country IE parsing is done for us by cfg80211 */