Bug 207445

Summary: net80211 Atheros AR938x: non-working WiFi hostap since ~ January
Product: Base System Reporter: O. Hartmann <ohartmann>
Component: wirelessAssignee: freebsd-wireless (Nobody) <wireless>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: adrian, avos, ohartmann
Priority: --- Keywords: regression
Version: CURRENT   
Hardware: amd64   
OS: Any   

Description O. Hartmann 2016-02-23 19:55:48 UTC
Running CURRENT (FreeBSD 11.0-CURRENT #15 r295926: Tue Feb 23 17:20:59 CET 2016) with a TP-Link PCIe WiFi adaptor TP-Link TL-WDN4800 N900 based on Qualcomm Atheros AR938x chipset. I used this adaptor as AccessPoint with CURRENT successfully over Christmas 2015 using both laptops and smartphone WiFi. This doesn't work anymore since ~ mid-January after updating the system's world and kernel.

I haven't found out what the exact reason is, but as far as I can describe is that the client still receives its IP via DHCP (isc-dhcp43-server-4.3.3P1_1    net/isc-dhcp43-server). Then authetication (via hostapd) fails.

root@gkommadoluch [~] dmesg|grep ath0
ath0: <Atheros AR938x> mem 0xf7e00000-0xf7e1ffff irq 16 at device 0.0 on pci1
ath0: [HT] enabling HT modes
ath0: [HT] enabling short-GI in 20MHz mode
ath0: [HT] 1 stream STBC receive enabled
ath0: [HT] 1 stream STBC transmit enabled
ath0: [HT] 3 RX streams; 3 TX streams
ath0: AR9380 mac 448.3 RF5110 phy 0.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0000
ath0: stuck beacon; resetting (bmiss count 4)


pciconf -lvbce
[...]
ath0@pci0:1:0:0:        class=0x028000 card=0x3112168c chip=0x0030168c rev=0x01 hdr=0x00
    vendor     = 'Qualcomm Atheros'
    device     = 'AR93xx Wireless Network Adapter'
    class      = network
    bar   [10] = type Memory, range 64, base rxf7e00000, size 131072, enabled
    cap 01[40] = powerspec 3  supports D0 D1 D3  current D0
    cap 05[50] = MSI supports 4 messages, 64 bit, vector masks 
    cap 10[70] = PCI-Express 2 endpoint max data 128(128) link x1(x1)
                 speed 2.5(2.5) ASPM disabled(L0s/L1)
    ecap 0001[100] = AER 1 0 fatal 0 non-fatal 0 corrected
    ecap 0002[140] = VC 1 max VC0
    ecap 0003[300] = Serial 1 0000000000000000
Comment 1 Adrian Chadd freebsd_committer freebsd_triage 2016-02-24 03:09:39 UTC
hi,

can you narrow down when it happened? A bunch of wifi infrastructure changed then and i have been too preoccupied with life(tm) lately to be able to keep on top of things and regularly test things.

(Which will change Very Soon Now, thankfully..)
Comment 2 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-02-24 09:28:26 UTC
(In reply to ohartman from comment #0)
Hi,

Can you add 'wlandebug_wlan0="auth+assoc+state"' into rc.conf (and attach resulting log file)? This may give more info about what happens with AP.
Comment 3 O. Hartmann 2016-02-24 16:03:34 UTC
After applying the wlandebug_wlan0 line, I read this from the console/logs:

arpresolve: can't allocate llinfo for XXX.XXX.XXX.XXX on wlan0

with XXX.XXX.XXX.XXX the IP delivered by DHCP to the host connecting.
Comment 4 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-02-24 19:52:22 UTC
(In reply to ohartman from comment #3)

Ok, sorry (this doesn't work with hostap mode) - just apply that manually & restart the interface:

1) wlandebug -i wlan0 auth+assoc+state
2) killall -HUP hostapd

(wlandebug_wlan0 record can be removed).
Comment 5 O. Hartmann 2016-02-24 20:22:33 UTC
I receive this on the console:

wlan0: promiscuous mode enabled
ath0: stuck beacon; resetting (bmiss count 4)
wlan0: [fx:fx:fx:fx:fx:fx] station deauth via MLME (reason 3)
wlan0: [fx:fx:fx:fx:fx:fx] send station deauthenticate (reason 3)
wlan0: [fx:fx:fx:fx:fx:fx] station with aid 1 leaves
wlan0: ieee80211_init
wlan0: start running, 1 vaps running
wlan0: ieee80211_new_state_locked: RUN -> SCAN (nrunning 0 nscanning 0)
wlan0: ieee80211_newstate_cb: RUN -> INIT arg 0
wlan0: hostap_newstate: RUN -> INIT (0)
wlan0: ieee80211_newstate_cb: INIT -> SCAN arg 0
wlan0: hostap_newstate: INIT -> SCAN (0)
wlan0: ieee80211_new_state_locked: SCAN -> RUN (nrunning 0 nscanning 0)
wlan0: ieee80211_init
wlan0: start running, 1 vaps running
wlan0: ieee80211_new_state_locked: SCAN -> SCAN (nrunning 0 nscanning 0)
wlan0: ieee80211_init
wlan0: start running, 1 vaps running
wlan0: ieee80211_new_state_locked: SCAN -> SCAN (nrunning 0 nscanning 0)
wlan0: ieee80211_newstate_cb: SCAN -> INIT arg 0
wlan0: hostap_newstate: SCAN -> INIT (0)
wlan0: ieee80211_newstate_cb: INIT -> SCAN arg 0
wlan0: hostap_newstate: INIT -> SCAN (0)
wlan0: ieee80211_new_state_locked: SCAN -> RUN (nrunning 0 nscanning 0)
wlan0: ieee80211_newstate_cb: SCAN -> RUN arg -1
wlan0: hostap_newstate: SCAN -> RUN (-1)
wlan0: [fx:fx:fx:fx:fx:fx] send station deauthenticate (reason 6)
wlan0: [fx:fx:fx:fx:fx:fx] send station deauthenticate (reason 6)
wlan0: [fx:fx:fx:fx:fx:fx] recv auth frame with algorithm 0 seq 1
wlan0: [fx:fx:fx:fx:fx:fx] station authenticated (open)
wlan0: [fx:fx:fx:fx:fx:fx] RSN ie: mc 3/0 uc 3/0 key 2 caps 0x0
wlan0: [fx:fx:fx:fx:fx:fx] station associated at aid 1: short preamble, short slot time, QoS
wlan0: [fx:fx:fx:fx:fx:fx] station unauthorize via MLME
wlan0: [fx:fx:fx:fx:fx:fx] station authorize via MLME
wlan0: [fx:fx:fx:fx:fx:fx] recv disassoc (reason 1)
wlan0: [fx:fx:fx:fx:fx:fx] station with aid 1 leaves
wlan0: [fx:fx:fx:fx:fx:fx] recv auth frame with algorithm 0 seq 1
wlan0: [fx:fx:fx:fx:fx:fx] station authenticated (open)
wlan0: [fx:fx:fx:fx:fx:fx] RSN ie: mc 3/0 uc 3/0 key 2 caps 0x0
wlan0: [fx:fx:fx:fx:fx:fx] station associated at aid 1: short preamble, short slot time, QoS
wlan0: [fx:fx:fx:fx:fx:fx] station unauthorize via MLME
wlan0: [fx:fx:fx:fx:fx:fx] station authorize via MLME
Comment 6 O. Hartmann 2016-02-24 20:25:41 UTC
ifconfig presents me with this information:

wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether [deleted]
        inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255 
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        ssid SOMETHING channel 10 (2457 MHz 11g) bssid [deleted]
        regdomain ETSI country DE indoor ecm authmode WPA2/802.11i
        privacy MIXED deftxkey 3 AES-CCM 2:128-bit AES-CCM 3:128-bit
        txpower 30 scanvalid 60 protmode CTS wme burst dtimperiod 1 -dfs
        groups: wlan
Comment 7 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-02-24 21:06:04 UTC
How much time has gone since

wlan0: [fx:fx:fx:fx:fx:fx] station authorize via MLME

to

wlan0: [fx:fx:fx:fx:fx:fx] recv disassoc (reason 1)
Comment 8 O. Hartmann 2016-03-01 21:50:07 UTC
Hope this helps: I ran the WiFi of the Smartphone as long as it changed connection status. 

I haven't tested with the notebook (running FreeBSD CURRENT, most recent as the server/hostapd does, notebook has intel ac 7260 wifi adaptor (smartphone unknown):

Mar  1 22:37:50 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] recv auth frame with algorithm 0 seq 1
Mar  1 22:37:50 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] station authenticated (open)
Mar  1 22:37:50 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] RSN ie: mc 3/0 uc 3/0 key 2 caps 0x0
Mar  1 22:37:50 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] station associated at aid 1: short preamble, short slot time, QoS
Mar  1 22:37:50 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] station unauthorize via MLME
Mar  1 22:37:50 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] station authorize via MLME
[...]
Mar  1 22:41:15 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] recv disassoc (reason 1)
Mar  1 22:41:15 <0.2> gate kernel: wlan0: [fx:fx:fx:fx:fx] station with aid 1 leaves
Comment 9 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-03-01 23:20:58 UTC
> as far as I can describe is that the client still receives its IP via DHCP
so, traffic can flow? because
> station associated at aid 1: short preamble, short slot time, QoS
means that association was successful. Is there any problems with other clients?

P.S. Looks like inactivity processing (with timeout in 205 seconds and this weird reason code (1 = unspecified)).
Comment 10 O. Hartmann 2016-03-02 04:56:32 UTC
It is with all WiFi equipment! Laptops (I have two at the moment, but not tested with the most recent code due to time constraints), WiFi via smartphone, mine and others. 

As I wrote: The device gets an IP from the DHCP, then the communications stops suddenly - nothing in, nothing out. With ALL devices of which I can claim they worked before with the same settings of the host-AP server.
Comment 11 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-03-02 05:52:28 UTC
Can you find the commit which breaks hostap mode for this chip? (via bisection)
Comment 12 Adrian Chadd freebsd_committer freebsd_triage 2016-03-02 19:13:40 UTC
hiya,

ok. can you compile the ath tools (cd /usr/src/tools/tools/ath ; make ; make install) and then run 'athstats 1' for about 10 seconds?

I'd like to see whether it's doing things like sending data, beacons, etc.

Are you running the dhcp server on the laptop too? What's the bridge configuration for this box?

Thanks!

-a
Comment 13 O. Hartmann 2016-03-04 05:07:03 UTC
I tried to bisect, but the box is not the fastest, even compiling things with -DNO_CLEAN.

@A. Chadd: I'll do as requested at the weekend and report the results back as soon as possible.
Comment 14 Adrian Chadd freebsd_committer freebsd_triage 2016-03-06 00:11:38 UTC
hiya,

I have a variety of devices hanging off a QCA955x MIPS SoC + 2.4GHz 3x3 11n. So far so good.

Yeah, please share more details about your laptop setup. Bridge, what has IPs, how are you starting hostapd, etc.



-a
Comment 15 O. Hartmann 2016-03-06 12:08:25 UTC
@Adrian Chadd: My Laptop is a customised CURRENT (custimised kernel), but it is a simple "client" to the server providing WiFi access via hostapd and the mentions Atheros-based WiFi boadr (PCIe card, three antennas). I think the setup of the laptop is irrelevant, since I have the strange behaviour also with other, older laptops I used around here and, as an extra, a smartphone (Motorola Moto G) which WiFi also reject to work.

The association to the AP is on all devices successful: they obtain an IP from the isc-dhcpd residing on the AP-hosting server. But then no traffic is possible anymore. I disabled the ipwf on all sides if possible. It is even not possible to ping the address of the AP from any station.

This is the AP's kernel config portion for WLAN:

# WLAN

# Wireless NIC cards
device          wlan            # 802.11 support
options         IEEE80211_DEBUG # enable debug msgs
options         IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options         IEEE80211_SUPPORT_MESH  # enable 802.11s draft support
device          wlan_wep        # 802.11 WEP support
device          wlan_ccmp       # 802.11 CCMP support
device          wlan_tkip       # 802.11 TKIP support
device          wlan_amrr       # AMRR transmit rate control algorithm
device          wlan_xauth      # AMRR transmit rate control algorithm
#
device          ath             # Atheros NICs
device          ath_pci         # Atheros pci/cardbus glue
device          ath_hal         # pci/cardbus chip support
#device         ath_acl         # MAC access list support (can not be built into kernel!)
options         AH_SUPPORT_AR5416       # enable AR5416 tx/rx descriptors
options         AH_AR5416_INTERRUPT_MITIGATION  # AR5416 interrupt mitigation
options         ATH_ENABLE_11N  # Enable 802.11n support for AR5416 and later
#
device          ath_rate_sample # SampleRate tx rate control for ath


802.11n seems not to work on FreeBSD, although the used WiFi AP card support ist as well as the Intel WiFi chipset 7260 (if_iwm).

I compiled /usr/src/tools/tools/ath and installed as requested.

Put the AP's WiFi into debug mode via:

 [~] wlandebug -i wlan0 auth+assoc+state
net.wlan.0.debug: 0xc80000<assoc,auth,state>
[~] killall -HUP hostapd
 [~] athstats 1
   input   output altrate   short    long xretry crcerr crypt  phyerr rssi  rate
athstats: ath_driver_req_fetch_stats: ioctl: Device not configured

Something is missing.

How can I deinstall /usr/src/tools/tools/ath? A make deinstall doesn't work.
Comment 16 Adrian Chadd freebsd_committer freebsd_triage 2016-03-06 16:34:43 UTC
whats in /etc/rc.conf ?
Comment 17 O. Hartmann 2016-04-12 17:52:49 UTC
In /etc/rc.conf there are the following wlan-specific config:

[...]
wlans_ath0="wlan0"      # wlan(4) interfaces for ath0 device
ifconfig_wlan0="inet 192.168.2.1 netmask 0xffffff00"
create_args_wlan0="wlanmode hostap ssid Huette mode 11n country de"

[...]

Also, gateway (ip forwarding) is enabled - if this matters.

As of CURRENT FreeBSD 11.0-CURRENT #12 r297859: Tue Apr 12 18:06:38 CEST 2016 amd64, the hostap with this specific WiFi NIC doesn't work - still.