From: Avri Altman <[email protected]>

There are a few APs our there that advertise U-APSD
capabilities but don't implement it right which leads to
poor traffic. These APs don't support MIMO or don't even
support HT. Use this heuristic to detect them and disable
U-APSD accordingly.

Signed-off-by: Avri Altman <[email protected]>
Signed-off-by: Emmanuel Grumbach <[email protected]>
---
 net/mac80211/scan.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 7bb6a93..3791c8a 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -39,6 +39,28 @@ void ieee80211_rx_bss_put(struct ieee80211_local *local,
                         container_of((void *)bss, struct cfg80211_bss, priv));
 }
 
+/*
+ * An incompatible AP workaround:
+ * if the AP does not advertise MIMO capabilities disable U-APSD.
+ * iPhones, among others, advertise themselves as U-APSD capable when
+ * they aren't. Avoid connecting to those devices in U-APSD enabled.
+ */
+static bool broken_uapsd_workarounds(struct ieee802_11_elems *elems)
+{
+       int i;
+
+       /* iPhone 4/4s with this problem doesn't have ht_capa */
+       if (!elems->ht_cap_elem)
+               return true;
+
+       for (i = 1; i < 4; i++) {
+               if (elems->ht_cap_elem->mcs.rx_mask[i])
+                       return false;
+       }
+
+       return true;
+}
+
 static bool is_uapsd_supported(struct ieee802_11_elems *elems)
 {
        u8 qos_info;
@@ -53,6 +75,9 @@ static bool is_uapsd_supported(struct ieee802_11_elems *elems)
                /* no valid wmm information or parameter element found */
                return false;
 
+       if (broken_uapsd_workarounds(elems))
+               return false;
+
        return qos_info & IEEE80211_WMM_IE_AP_QOSINFO_UAPSD;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to