Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
On Wed, Jan 25, 2017 at 07:48:18PM +1000, Martin Pieuchot wrote: > On 25/01/17(Wed) 10:36, Stefan Sperling wrote: > > On Tue, Jan 24, 2017 at 03:10:34PM -0500, mabi wrote: > > > Hi Stefan > > > Thanks for your input. It looks like the g2k16 modifications to the athn > > > code from awolk@ did not make it into the 6.0 release. So there is still > > > hope for 6.1 ;-) > > > > There was a rabbit hole this diff by Adam fell into. I don't know what > > the current status of this is. Adam might know more. > > The diff should go in, it doesn't make things worse. > Changes from g2k16 will not prevent the timeouts but will help by removing the need to manually kick the netstart scripts when the timeout happens. I recall the diff was put on hold as we still found it crashing in some cases, from the undeadly report: --- The fourth one was in the athn driver itself. The interface was half cleaned up (the fields of the ifp data structure were freed but not the interface itself) so when the watchdog tried to access it caused the crash. --- One of the diff from testing had this guard in place: $ cat /home/mulander/athn-watchdog.6.diff Index: if_athn_usb.c === RCS file: /cvs/src/sys/dev/usb/if_athn_usb.c,v retrieving revision 1.42 diff -u -p -r1.42 if_athn_usb.c --- if_athn_usb.c 11 Dec 2015 16:07:02 - 1.42 +++ if_athn_usb.c 4 Sep 2016 18:48:14 - @@ -2098,13 +2098,17 @@ void athn_usb_watchdog(struct ifnet *ifp) { struct athn_softc *sc = ifp->if_softc; + struct ieee80211com *ic = &sc->sc_ic; ifp->if_timer = 0; if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { printf("%s: device timeout\n", sc->sc_dev.dv_xname); - /* athn_usb_init(ifp); XXX needs a process context! */ + if (ic->ic_bss == NULL) + return; + athn_usb_stop(ifp); + athn_usb_init(ifp); ifp->if_oerrors++; return; } the ic->ic_bss being null doing stop resulted in further crashing. Though it was agreed that adding guards likes that in the watchdog is not wanted in the watchdog handler. The final diff is just a athn_usb_stop/athn_usb_init in the watchdog itself, it got mixed feedback. Don't remember who exactly took which stance but the general opinions were; - it should go in, doesn't make things worse - let's wait for other changes in the stack I decided to wait out and I guess the diff just bit rotted on my disk :) Here is the final one that just restarts the interface. I have been running it since September on most of my snapshots, stopped applying it around December when I was travelling with a different usb dongle (ural0). OK's to commit? Index: if_athn_usb.c === RCS file: /cvs/src/sys/dev/usb/if_athn_usb.c,v retrieving revision 1.45 diff -u -p -r1.45 if_athn_usb.c --- if_athn_usb.c 22 Jan 2017 10:17:39 - 1.45 +++ if_athn_usb.c 25 Jan 2017 22:52:10 - @@ -2104,7 +2104,8 @@ athn_usb_watchdog(struct ifnet *ifp) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { printf("%s: device timeout\n", sc->sc_dev.dv_xname); - /* athn_usb_init(ifp); XXX needs a process context! */ + athn_usb_stop(ifp); + athn_usb_init(ifp); ifp->if_oerrors++; return; }
Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
On 25/01/17(Wed) 10:36, Stefan Sperling wrote: > On Tue, Jan 24, 2017 at 03:10:34PM -0500, mabi wrote: > > Hi Stefan > > Thanks for your input. It looks like the g2k16 modifications to the athn > > code from awolk@ did not make it into the 6.0 release. So there is still > > hope for 6.1 ;-) > > There was a rabbit hole this diff by Adam fell into. I don't know what > the current status of this is. Adam might know more. The diff should go in, it doesn't make things worse.
Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
On Tue, Jan 24, 2017 at 03:10:34PM -0500, mabi wrote: > Hi Stefan > Thanks for your input. It looks like the g2k16 modifications to the athn code > from awolk@ did not make it into the 6.0 release. So there is still hope for > 6.1 ;-) There was a rabbit hole this diff by Adam fell into. I don't know what the current status of this is. Adam might know more. > I suppose here that running a wifi host access point from a USB key is not a > good idea. What a shame my firewall does not have any PCI or miniPCI > interfaces... Well, in general this can be made to work. But our driver has bugs with it. For example, when I last tested this, an athn(4) USB AP was not actually sending any beacons. It only answered to probe requests sent by clients. Which makes it work like it had a "hidden" SSID, but it does not work like a normal AP. Do you see beacons from your AP when you run something like this on an associated client? 'tcpdump -n -y IEEE802_11_RADIO -i iwn0' If that command does not show beacons, the athn driver is still broken.
Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
Hi Stefan Thanks for your input. It looks like the g2k16 modifications to the athn code from awolk@ did not make it into the 6.0 release. So there is still hope for 6.1 ;-) I suppose here that running a wifi host access point from a USB key is not a good idea. What a shame my firewall does not have any PCI or miniPCI interfaces... Regards M. Original Message Subject: Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap) Local Time: January 23, 2017 11:28 PM UTC Time: January 23, 2017 10:28 PM From: s...@stsp.name To: mabi , misc@openbsd.org On Mon, Jan 23, 2017 at 11:19:31PM +0100, Stefan Sperling wrote: > On Mon, Jan 23, 2017 at 04:27:32PM -0500, mabi wrote: > > Hi, > > I have an Atheros AR9271 Wifi USB 2.0 key on my OpenBSD 6.0 firewall in > > order to use as an access point. Unfortunately it happens nearly every day > > that the athn0 device times out, kernel log: > > > > athn0: device timeout > > > > and the only way to make the wireless work again is to reboot the firewall. > > I was told this would get better with 6.0 but I can't see any difference. > > Any ideas what's wrong? Below I post my hostname.athn0 and dmesg. > > > > Cheers, > > Mabi > > These are known issues with athn on USB and hostap. > I have already spent a lot of time digging into this and never got anywhere. > Eventually I decided to document this in the man page which you apparently > missed: > > [[[ > ATHN(4) Device Drivers Manual ATHN(4) > > NAME > athn Atheros IEEE 802.11a/b/g/n wireless network device > [...] > BUGS > Host AP mode does not work with USB devices. > ]]] > > Sorry. Anybody, please let me know if you find a way to fix it. I now recall that awolk@ was working on a patch for a similar problem. See http://undeadly.org/cgi?action=article&sid=20160906004915 and https://marc.info/?l=openbsd-misc&m=144895556213390&w=2 which I had already forgotten about ever having written. Not sure what happened to the patch and if it is ready by now. Also not sure if it will actually fix your problem or if Adam's problem was caused by something else. Hard to tell without actually testing things.
Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
On Mon, Jan 23, 2017 at 11:19:31PM +0100, Stefan Sperling wrote: > On Mon, Jan 23, 2017 at 04:27:32PM -0500, mabi wrote: > > Hi, > > I have an Atheros AR9271 Wifi USB 2.0 key on my OpenBSD 6.0 firewall in > > order to use as an access point. Unfortunately it happens nearly every day > > that the athn0 device times out, kernel log: > > > > athn0: device timeout > > > > and the only way to make the wireless work again is to reboot the firewall. > > I was told this would get better with 6.0 but I can't see any difference. > > Any ideas what's wrong? Below I post my hostname.athn0 and dmesg. > > > > Cheers, > > Mabi > > These are known issues with athn on USB and hostap. > I have already spent a lot of time digging into this and never got anywhere. > Eventually I decided to document this in the man page which you apparently > missed: > > [[[ > ATHN(4)Device Drivers Manual > ATHN(4) > > NAME > athn Atheros IEEE 802.11a/b/g/n wireless network device > [...] > BUGS > Host AP mode does not work with USB devices. > ]]] > > Sorry. Anybody, please let me know if you find a way to fix it. I now recall that awolk@ was working on a patch for a similar problem. See http://undeadly.org/cgi?action=article&sid=20160906004915 and https://marc.info/?l=openbsd-misc&m=144895556213390&w=2 which I had already forgotten about ever having written. Not sure what happened to the patch and if it is ready by now. Also not sure if it will actually fix your problem or if Adam's problem was caused by something else. Hard to tell without actually testing things.
Re: athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
On Mon, Jan 23, 2017 at 04:27:32PM -0500, mabi wrote: > Hi, > I have an Atheros AR9271 Wifi USB 2.0 key on my OpenBSD 6.0 firewall in order > to use as an access point. Unfortunately it happens nearly every day that the > athn0 device times out, kernel log: > > athn0: device timeout > > and the only way to make the wireless work again is to reboot the firewall. I > was told this would get better with 6.0 but I can't see any difference. Any > ideas what's wrong? Below I post my hostname.athn0 and dmesg. > > Cheers, > Mabi These are known issues with athn on USB and hostap. I have already spent a lot of time digging into this and never got anywhere. Eventually I decided to document this in the man page which you apparently missed: [[[ ATHN(4) Device Drivers Manual ATHN(4) NAME athn Atheros IEEE 802.11a/b/g/n wireless network device [...] BUGS Host AP mode does not work with USB devices. ]]] Sorry. Anybody, please let me know if you find a way to fix it.
athn0: device timeout (AR9271 USB 2.0 Wifi-key as hostap)
Hi, I have an Atheros AR9271 Wifi USB 2.0 key on my OpenBSD 6.0 firewall in order to use as an access point. Unfortunately it happens nearly every day that the athn0 device times out, kernel log: athn0: device timeout and the only way to make the wireless work again is to reboot the firewall. I was told this would get better with 6.0 but I can't see any difference. Any ideas what's wrong? Below I post my hostname.athn0 and dmesg. Cheers, Mabi hostname.athn0: inet 172.16.20.1 255.255.255.0 mediaopt hostap nwid MYWLAN chan 11 wpakey removed dmesg: Jan 14 17:24:32 fw1 /bsd: OpenBSD 6.0 (GENERIC.MP) #2319: Tue Jul 26 13:00:43 MDT 2016 Jan 14 17:24:32 fw1 /bsd: dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP Jan 14 17:24:32 fw1 /bsd: real mem = 4264185856 (4066MB) Jan 14 17:24:32 fw1 /bsd: avail mem = 4130476032 (3939MB) Jan 14 17:24:32 fw1 /bsd: mpath0 at root Jan 14 17:24:32 fw1 /bsd: scsibus0 at mpath0: 256 targets Jan 14 17:24:32 fw1 /bsd: mainbus0 at root Jan 14 17:24:32 fw1 /bsd: bios0 at mainbus0: SMBIOS rev. 2.8 @ 0x7f52c000 (52 entries) Jan 14 17:24:32 fw1 /bsd: bios0: vendor American Megatrends Inc. version "5.6.5" date 01/25/2016 Jan 14 17:24:32 fw1 /bsd: acpi0 at bios0: rev 2 Jan 14 17:24:32 fw1 /bsd: acpi0: sleep states S0 S5 Jan 14 17:24:32 fw1 /bsd: acpi0: tables DSDT FACP FPDT MCFG WDAT UEFI APIC BDAT HPET SSDT SPCR Jan 14 17:24:32 fw1 /bsd: acpi0: wakeup devices PS2K(S0) PS2M(S0) PEX1(S0) PEX2(S0) PEX3(S0) PEX4(S0) EHC1(S0) Jan 14 17:24:32 fw1 /bsd: acpitimer0 at acpi0: 3579545 Hz, 24 bits Jan 14 17:24:32 fw1 /bsd: acpimcfg0 at acpi0 addr 0xe000, bus 0-255 Jan 14 17:24:32 fw1 /bsd: acpimadt0 at acpi0 addr 0xfee0: PC-AT compat Jan 14 17:24:32 fw1 /bsd: cpu0 at mainbus0: apid 0 (boot processor) Jan 14 17:24:32 fw1 /bsd: cpu0: Intel(R) Atom(TM) CPU C2558 @ 2.40GHz, 2400.46 MHz Jan 14 17:24:32 fw1 /bsd: cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT Jan 14 17:24:32 fw1 /bsd: cpu0: 1MB 64b/line 16-way L2 cache Jan 14 17:24:32 fw1 /bsd: cpu0: smt 0, core 0, package 0 Jan 14 17:24:32 fw1 /bsd: mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges Jan 14 17:24:32 fw1 /bsd: cpu0: apic clock running at 99MHz Jan 14 17:24:32 fw1 /bsd: cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3, IBE Jan 14 17:24:32 fw1 /bsd: cpu1 at mainbus0: apid 2 (application processor) Jan 14 17:24:32 fw1 /bsd: cpu1: Intel(R) Atom(TM) CPU C2558 @ 2.40GHz, 2399.99 MHz Jan 14 17:24:32 fw1 /bsd: cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT Jan 14 17:24:32 fw1 /bsd: cpu1: 1MB 64b/line 16-way L2 cache Jan 14 17:24:32 fw1 /bsd: cpu1: smt 0, core 1, package 0 Jan 14 17:24:32 fw1 /bsd: cpu2 at mainbus0: apid 4 (application processor) Jan 14 17:24:32 fw1 /bsd: cpu2: Intel(R) Atom(TM) CPU C2558 @ 2.40GHz, 2399.99 MHz Jan 14 17:24:32 fw1 /bsd: cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT Jan 14 17:24:32 fw1 /bsd: cpu2: 1MB 64b/line 16-way L2 cache Jan 14 17:24:32 fw1 /bsd: cpu2: smt 0, core 2, package 0 Jan 14 17:24:32 fw1 /bsd: cpu3 at mainbus0: apid 6 (application processor) Jan 14 17:24:32 fw1 /bsd: cpu3: Intel(R) Atom(TM) CPU C2558 @ 2.40GHz, 2399.99 MHz Jan 14 17:24:32 fw1 /bsd: cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT Jan 14 17:24:32 fw1 /bsd: cpu3: 1MB 64b/line 16-way L2 cache Jan 14 17:24:32 fw1 /bsd: cpu3: smt 0, core 3, package 0 Jan 14 17:24:32 fw1 /bsd: ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins Jan 14 17:24:32 fw1 /bsd: acpihpet0 at acpi0: 14318179 Hz Jan 14 17:24:32 fw1 /bsd: acpiprt0 at acpi0: bus 0 (PCI0) Jan 14 17:24:32 fw1 /bsd: acpiprt1 at acpi0: bus 1 (PEX1) Jan 14 17:24:32 fw1 /bsd: acpiprt2 at acpi0: bus 2 (PEX2) Jan 14 17:24:32 fw1 /bsd: acpiprt3 at acpi0: bus 3 (PEX3) Jan 14 17:24:32 fw1 /bsd: acpiprt4 at acpi0: bus 4 (PEX4) Jan 14 17:24:32 fw1 /bsd: acpicpu0 at acpi0: C1(@1 halt!) Jan 14 17:24:32 fw1 /bsd: acpicpu1 at acpi0: C1(@1 halt!) Jan 14 17:24:32 fw1 /bsd: acpicpu2 at acpi0: C1(@1 halt!) Jan 14 17:24:32 fw1 /bsd: acpicpu3 at acpi0: C1(@1 halt!) Jan 14 17:24:32