Re: 802.11n hostap - latency and timeouts

2017-04-05 Thread Juan Francisco Cantero Hurtado
On Thu, Mar 23, 2017 at 09:30:43AM +0900, Stefan Sperling wrote:
> On Wed, Mar 22, 2017 at 02:42:19PM +, Kevin Chadwick wrote:
> > In case it is of any help to anyone. I tried 11n on a ar9271 a few weeks
> > ago and also an ar2133. Both would give athn0: device timeouts but the usb
> > ar9271 needed a ifconfig down up to recover whereas the card recovered by
> > itself. Using 11g made them far less likely and whilst I have hardly used
> > the 11b ssid, I haven't had any with 11b on the 9271 so far.
> > 
> > Also after using 11n and getting multiple resets I had to plug the card
> > into another laptop to get the firmware to load again without saying could
> > not read ROM, even after reboots. So maybe some state is kept on OpenBSD or
> > more likely perhaps it was unplugged for long enough to clear the cards
> > memory or something.
> 
> There is a known issue which looks like ehci(4) on some USB host controllers
> does not feed sufficient power to athn(4) devices and then they won't work
> reliably.

The problem is unrelated to the USB controllers. Some boards are not
well designed and feed the current to the USB port unfiltered. That's is
why the problem is more common in cheap ARM boards than PCs motherboards.

Olimex has this "workaround":
https://www.olimex.com/Products/USB-Modules/USB-CAP/

OK to this change in the man page?


diff --git athn.4 athn.4
index eb7b951c289..f8f20f39aca 100644
--- athn.4
+++ athn.4
@@ -215,8 +215,10 @@ The driver will turn the interface down.
 .It "athn0: error N, could not read firmware ..."
 For some reason, the driver was unable to read the firmware file from the
 filesystem.
 The file might be missing or corrupted.
+This is also a common error on systems where the power source doesn't feed
+enough current to the USB port during the initialization of the device.
 .El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr cardbus 4 ,



Re: 802.11n hostap - latency and timeouts

2017-03-23 Thread Kevin Chadwick
On 23 Mar 2017 12:30 am, "Stefan Sperling"  wrote:

On Wed, Mar 22, 2017 at 02:42:19PM +, Kevin Chadwick wrote:
> In case it is of any help to anyone. I tried 11n on a ar9271 a few weeks
> ago and also an ar2133. Both would give athn0: device timeouts but the usb
> ar9271 needed a ifconfig down up to recover whereas the card recovered by
> itself. Using 11g made them far less likely and whilst I have hardly used
> the 11b ssid, I haven't had any with 11b on the 9271 so far.
>
> Also after using 11n and getting multiple resets I had to plug the card
> into another laptop to get the firmware to load again without saying could
> not read ROM, even after reboots. So maybe some state is kept on OpenBSD
or
> more likely perhaps it was unplugged for long enough to clear the cards
> memory or something.

There is a known issue which looks like ehci(4) on some USB host controllers
does not feed sufficient power to athn(4) devices and then they won't work
reliably.



It is indeed an ehci hub, :)



Re: 802.11n hostap - latency and timeouts

2017-03-22 Thread Stefan Sperling
On Wed, Mar 22, 2017 at 02:42:19PM +, Kevin Chadwick wrote:
> In case it is of any help to anyone. I tried 11n on a ar9271 a few weeks
> ago and also an ar2133. Both would give athn0: device timeouts but the usb
> ar9271 needed a ifconfig down up to recover whereas the card recovered by
> itself. Using 11g made them far less likely and whilst I have hardly used
> the 11b ssid, I haven't had any with 11b on the 9271 so far.
> 
> Also after using 11n and getting multiple resets I had to plug the card
> into another laptop to get the firmware to load again without saying could
> not read ROM, even after reboots. So maybe some state is kept on OpenBSD or
> more likely perhaps it was unplugged for long enough to clear the cards
> memory or something.

There is a known issue which looks like ehci(4) on some USB host controllers
does not feed sufficient power to athn(4) devices and then they won't work
reliably.



Re: 802.11n hostap - latency and timeouts

2017-03-22 Thread Kevin Chadwick
In case it is of any help to anyone. I tried 11n on a ar9271 a few weeks
ago and also an ar2133. Both would give athn0: device timeouts but the usb
ar9271 needed a ifconfig down up to recover whereas the card recovered by
itself. Using 11g made them far less likely and whilst I have hardly used
the 11b ssid, I haven't had any with 11b on the 9271 so far.

Also after using 11n and getting multiple resets I had to plug the card
into another laptop to get the firmware to load again without saying could
not read ROM, even after reboots. So maybe some state is kept on OpenBSD or
more likely perhaps it was unplugged for long enough to clear the cards
memory or something.

Thanks for working on the WIFI stack, BTW. I'm sure it is appreciated by
many.

If you want me to test any snapshots, let me know.

On 20 Mar 2017 12:36, "Stefan Sperling"  wrote:

> On Sun, Mar 19, 2017 at 03:14:05PM +, Tom Murphy wrote:
> > Hi,
> >
> >   I'm running my athn(4) device in hostap mode. I noticed, when it's set
> to
> > 802.11n, I get higher latency (pinging the OpenBSD AP) and disconnections
> > every few minutes. The Wifi clients are Linux-based (Android and Debian).
> >
> >   When I set it back to 802.11g (mode 11g) it's fine again.
> >
> >   I have athn0 using powersave on too, and when the client has powersave
> mode
> > on, the latency goes up and network performance also drops. As soon as I
> turn
> > powersave mode off on the client, it goes from being anywhere between
> > 600-1000 ms per ping, to 1-2ms per ping.
> >
> >   Is there some issue with 802.11n clients when OpenBSD is in hostap 11n
> mode?
> > Also is powersave mode a problem. Has anyone tested these and come up
> with
> > a good solution? I've tried different channels (can't try 5 GHz because
> none
> > of my devices support it except the hostap device)
>
> Thank you for documenting this. I have not tested power-save mode yet.
> The OpenBSD clients I use do not support it.
>
> It sounds like this is something that needs more work.
>
> >   Is there anything I can try to get 802.11n stable?
>
> Unless you wish to debug and fix the code yourself, it sounds like the
> best you can do for now is to disable power saving.



Re: 802.11n hostap - latency and timeouts

2017-03-20 Thread Stefan Sperling
On Sun, Mar 19, 2017 at 03:14:05PM +, Tom Murphy wrote:
> Hi,
> 
>   I'm running my athn(4) device in hostap mode. I noticed, when it's set to
> 802.11n, I get higher latency (pinging the OpenBSD AP) and disconnections
> every few minutes. The Wifi clients are Linux-based (Android and Debian). 
> 
>   When I set it back to 802.11g (mode 11g) it's fine again.
> 
>   I have athn0 using powersave on too, and when the client has powersave mode
> on, the latency goes up and network performance also drops. As soon as I turn
> powersave mode off on the client, it goes from being anywhere between
> 600-1000 ms per ping, to 1-2ms per ping.
> 
>   Is there some issue with 802.11n clients when OpenBSD is in hostap 11n mode?
> Also is powersave mode a problem. Has anyone tested these and come up with
> a good solution? I've tried different channels (can't try 5 GHz because none
> of my devices support it except the hostap device)

Thank you for documenting this. I have not tested power-save mode yet.
The OpenBSD clients I use do not support it.

It sounds like this is something that needs more work.

>   Is there anything I can try to get 802.11n stable?

Unless you wish to debug and fix the code yourself, it sounds like the
best you can do for now is to disable power saving.



802.11n hostap - latency and timeouts

2017-03-19 Thread Tom Murphy
Hi,

  I'm running my athn(4) device in hostap mode. I noticed, when it's set to
802.11n, I get higher latency (pinging the OpenBSD AP) and disconnections
every few minutes. The Wifi clients are Linux-based (Android and Debian). 

  When I set it back to 802.11g (mode 11g) it's fine again.

  I have athn0 using powersave on too, and when the client has powersave mode
on, the latency goes up and network performance also drops. As soon as I turn
powersave mode off on the client, it goes from being anywhere between
600-1000 ms per ping, to 1-2ms per ping.

  Is there some issue with 802.11n clients when OpenBSD is in hostap 11n mode?
Also is powersave mode a problem. Has anyone tested these and come up with
a good solution? I've tried different channels (can't try 5 GHz because none
of my devices support it except the hostap device)

  Relevant bits from dmesg:

athn0 at pci5 dev 0 function 0 "Atheros AR9281" rev 0x01: apic 2 int 16
athn0: AR9280 rev 2 (2T2R), ROM rev 22, address 04:f0:21:32:ef:9a


  ifconfig athn0

athn0: flags=8843 mtu 1500
lladdr 04:f0:21:32:ef:9a
description: Wifi AP
index 4 priority 4 llprio 3
groups: wlan
media: IEEE802.11 autoselect hostap (autoselect mode 11n hostap)
status: active
ieee80211: nwid OpenBSD chan 6 bssid 04:f0:21:32:ef:9a wpakey 
0x0bfuscated wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp 
powersave on (100ms sleep) inet 10.0.0.1 netmask 0xff00 broadcast 10.0.0.255

  Is there anything I can try to get 802.11n stable?

 Thanks,
  Tom