2015-06-10 13:49:46

by Grumbach, Emmanuel

[permalink] [raw]
Subject: [PATCH] mac80211: Disable U-APSD if connected to a SISO or non-HT AP

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



2015-06-11 05:29:24

by Altman, Avri

[permalink] [raw]
Subject: RE: [PATCH] mac80211: Disable U-APSD if connected to a SISO or non-HT AP

DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBKdWxpYW4gQ2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ludGVs
IENvcnBvcmF0aW9uIGdyb3VwIG9mIGNvbXBhbmllcwoKVGhpcyBlLW1haWwgYW5kIGFueSBhdHRh
Y2htZW50cyBtYXkgY29udGFpbiBjb25maWRlbnRpYWwgbWF0ZXJpYWwgZm9yCnRoZSBzb2xlIHVz
ZSBvZiB0aGUgaW50ZW5kZWQgcmVjaXBpZW50KHMpLiBBbnkgcmV2aWV3IG9yIGRpc3RyaWJ1dGlv
bgpieSBvdGhlcnMgaXMgc3RyaWN0bHkgcHJvaGliaXRlZC4gSWYgeW91IGFyZSBub3QgdGhlIGlu
dGVuZGVkCnJlY2lwaWVudCwgcGxlYXNlIGNvbnRhY3QgdGhlIHNlbmRlciBhbmQgZGVsZXRlIGFs
bCBjb3BpZXMuCg==


2015-06-11 05:34:49

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Disable U-APSD if connected to a SISO or non-HT AP

Hi Avri,

On Thu, Jun 11, 2015 at 3:29 PM, Altman, Avri <[email protected]> wrote:
>
>
> -----Original Message-----
> From: Julian Calaby [mailto:[email protected]]
> Sent: Thursday, June 11, 2015 6:55 AM
> To: Grumbach, Emmanuel
> Cc: Johannes Berg; linux-wireless; Altman, Avri
> Subject: Re: [PATCH] mac80211: Disable U-APSD if connected to a SISO or non-HT AP
>
> Hi Emmanuel / Avri,
>
> On Wed, Jun 10, 2015 at 11:49 PM, Emmanuel Grumbach
> <[email protected]> wrote:
>> 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)
>
> Would a better name for this function be something like
> is_uapsd_broken()? We're not actually working around anything here,
> just checking whether it's broken or not.
>
> [Altman, Avri] Yeah - well, originally this was not the name, but a previous reviewer asked me to changed it to "workaround something...".
> Actually it is a workaround of, among others, the iPhone 4/4s when SoftAP, they don't raise the
> TIM in its Beacon even if it has data for us, therefore traffic is stuck.
> We would prefer to identify those devices via their OUI, but currently this is not well defined.

Fair enough then.

As I see it, this isn't a workaround, it's just another test to ensure
that uapsd can be supported.

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

2015-06-11 03:55:47

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Disable U-APSD if connected to a SISO or non-HT AP

Hi Emmanuel / Avri,

On Wed, Jun 10, 2015 at 11:49 PM, Emmanuel Grumbach
<[email protected]> wrote:
> 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)

Would a better name for this function be something like
is_uapsd_broken()? We're not actually working around anything here,
just checking whether it's broken or not.

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/