Bug 256255

Summary: Atheros AR9462 sometimes not recognised
Product: Base System Reporter: Daniel Cervus <danielthedeer>
Component: wirelessAssignee: Bjoern A. Zeeb <bz>
Status: Closed FIXED    
Severity: Affects Some People CC: bz, cy, drozsas, freebsd, john, jon, philip, secteam, tduck973564, tom
Priority: --- Flags: bz: mfc-stable14+
bz: mfc-stable13+
Version: 12.2-RELEASE   
Hardware: amd64   
OS: Any   

Description Daniel Cervus 2021-05-30 09:35:10 UTC
I'm using AR9462 in FreeBSD 12.2-RELEASE-p7. It was correctly recognized by dmesg, and connected to Internet properly (although "ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping" displaying frequently). But bsdconfig will show as "unknown network interface type" and could not scan any Wi-Fi and select any mode in "network options".

What's more, it was correctly recognized in bsd installer and bsdconfig in the first few times after installing. And Wi-Fis was scanned successfully. I didn't touch anything except bsdconfig and updated to p6 after that! (p7 will not solve as well)
Comment 1 tduck973564 2021-06-08 13:44:40 UTC
Similar issue here, with my ar938x on FreeBSD 13 release, I can’t associate to a carrier but I can scan and everything else works fine, a temporary fix that worked for me was to do `ifconfig wlan0 down`, wait 10 seconds, `ifconfig wlan0 up`, wait another 10 seconds then you will be connected.
Comment 2 tduck973564 2021-06-08 13:46:00 UTC
(In reply to tduck973564 from comment #1)
Talked to a bsdconfig dev, wlan0 not being recognised in it is a different issue and he said that he will get onto it.
Comment 3 tduck973564 2021-06-09 06:35:30 UTC
Found a much more permanent fix:

`sudo sh -c "echo 'ifconfig wlan0 down && ifconfig wlan0 up' >> /etc/rc.local"`
Comment 4 Daniel Cervus 2021-12-08 13:31:43 UTC
This problem is still not solved in 12.3.
In brand-new installing of 12.3 it is unable to scan my 802.11n only Wi-Fi but the others, after retrying a few times, no Wi-Fi could be found.
Comment 5 Chris Hutchinson 2021-12-10 04:10:56 UTC
I'm not proposing a fix here. But would like to suggest
that those of you experiencing this problem add the output
of the following 2 commands to this pr(1).

pciconf -lv (just post the relevant portion)

kldstat

That should help anyone with a suggestion/solution
to better address this for you. :-)
Comment 6 Daniel Cervus 2021-12-16 10:56:27 UTC
The pciconf output is here:
ath0@pci0:2:0:0: class=0x028000 card=0x020a1028 chip=0x0034168c rev=0x01 hdr=0x00
vendor = ‘Qualcomm Atheros’
device = ‘AR9462 Wireless Network Adapter’
class  = network

If there is any other information needed, I’d like to provide as well.
Comment 7 Daniel Cervus 2021-12-30 04:14:39 UTC
I reinstalled, this time, it can recognize my Wi-Fi, that’s weird.
Comment 8 Bjoern A. Zeeb freebsd_committer freebsd_triage 2022-07-30 22:44:34 UTC
I just saw this:

ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping

# pciconf -lv ath0
ath0@pci0:1:0:0:        class=0x028000 rev=0x01 hdr=0x00 vendor=0x168c device=0x0034 subvendor=0x11ad subdevice=0x6621
    vendor     = 'Qualcomm Atheros'
    device     = 'AR9462 Wireless Network Adapter'
    class      = network

Adding myself here in case I'll get a chance to look into it.
Comment 9 Devin Rozsas 2022-08-02 02:50:26 UTC
pciconf -lv:

ath0@pci0:1:0:0:        class=0x028000 rev=0x01 hdr=0x00 vendor=0x168c device=0x0034 subvendor=0x1a3b subdevice=0x2234
    vendor     = 'Qualcomm Atheros'
    device     = 'AR9462 Wireless Network Adapter'
    class      = network


kldstat:

Id Refs Address                Size Name
 1  174 0xffffffff80200000  1f30590 kernel
 2    1 0xffffffff82131000     6cf8 uplcom.ko
 3    2 0xffffffff82138000     a7a8 ucom.ko
 4    1 0xffffffff82143000     3618 if_ath.ko
 5    2 0xffffffff82147000     2e40 ath_dfs.ko
 6    2 0xffffffff8214a000     64c0 ath_rate.ko
 7    2 0xffffffff82151000    70150 ath_hal_ar9300.ko
 8    2 0xffffffff821c2000    40e98 ath_hal_ar5416.ko
 9    3 0xffffffff82203000    2d448 ath_hal_ar5212.ko
10    2 0xffffffff82231000    12050 ath_hal_ar5211.ko
11    2 0xffffffff82244000     d080 ath_hal_ar5210.ko
12    1 0xffffffff82252000    1ae68 geom_eli.ko
13    1 0xffffffff8226d000     9430 acpi_video.ko
14    1 0xffffffff82277000     a320 ng_ubt.ko
15    3 0xffffffff82282000    12e90 ng_hci.ko
16    5 0xffffffff82295000     4250 ng_bluetooth.ko
17    7 0xffffffff8229a000    16d68 netgraph.ko
18    1 0xffffffff82918000     3530 fdescfs.ko
19    1 0xffffffff8291c000     639c linprocfs.ko
20    4 0xffffffff82923000    10ab0 linux_common.ko
21    1 0xffffffff82934000     3284 linsysfs.ko
22    1 0xffffffff82938000   158438 i915kms.ko
23    1 0xffffffff82a91000    7f020 drm.ko
24    2 0xffffffff82b11000     cbc8 linuxkpi_gplv2.ko
25    1 0xffffffff82b1e000    11cd8 fusefs.ko
26    1 0xffffffff82b30000     21e8 acpi_dock.ko
27    1 0xffffffff82b33000     3378 acpi_wmi.ko
28    1 0xffffffff82b37000     3250 ichsmb.ko
29    1 0xffffffff82b3b000     2180 smbus.ko
30    1 0xffffffff82b3e000     5e7c ig4.ko
31    2 0xffffffff82b44000     433c iicbus.ko
32    1 0xffffffff82b49000     2110 pchtherm.ko
33    1 0xffffffff82b4c000     e000 if_rtwn_usb.ko
34    1 0xffffffff82b5a000    19130 rtwn.ko
35    1 0xffffffff82b74000     e250 ng_l2cap.ko
36    1 0xffffffff82b83000    1bee8 ng_btsocket.ko
37    1 0xffffffff82b9f000     39c0 ng_socket.ko
38    1 0xffffffff82ba3000     2340 uhid.ko
39    1 0xffffffff82ba6000     3380 usbhid.ko
40    6 0xffffffff82baa000     31f8 hidbus.ko
41    1 0xffffffff82bae000     3320 wmt.ko
42    1 0xffffffff82bb2000     3240 iichid.ko
43    1 0xffffffff82bb6000     21e8 hms.ko
44    1 0xffffffff82bb9000     30a8 hidmap.ko
45    1 0xffffffff82bbd000     3328 hmt.ko
46    1 0xffffffff82bc1000     22b0 hconf.ko
47    1 0xffffffff82bc4000    38070 linux.ko
48    1 0xffffffff82bfd000    32208 linux64.ko
49    1 0xffffffff82c30000     2260 pty.ko
50    1 0xffffffff82c33000     5af8 autofs.ko
51    1 0xffffffff82c39000     2a08 mac_ntpd.ko
Comment 10 Devin Rozsas 2022-08-02 02:54:09 UTC
The down and up trick works (thank you!), but it only sees and connects to 2GHz networks despite the card supporting 5GHz as well. I tried adding "mode 11a" to force it to work on 5GHz but it failed.
Comment 11 Graham Perrin freebsd_committer freebsd_triage 2022-10-16 07:25:50 UTC
(In reply to tduck973564 from comment #2)

> Talked to a bsdconfig dev, wlan0 not being recognised in it is 
> a different issue …

Thank you; summary line edited accordingly.
Comment 12 Jon H 2023-07-29 14:49:54 UTC
Same problem, ifconfig down and up fixes it. Perhaps the driver needs to be initialized earlier or later?

FreeBSD l14 13.2-STABLE FreeBSD 13.2-STABLE #0 stable/13-n255472-cf3a76018cad-dirty: Tue May 30 20:37:23 EDT 2023 

# pciconf -lv ath0
ath0@pci0:1:0:0:	class=0x028000 rev=0x01 hdr=0x00 vendor=0x168c device=0x0034 subvendor=0x1028 subdevice=0x0300
    vendor     = 'Qualcomm Atheros'
    device     = 'AR9462 Wireless Network Adapter'
    class      = network

ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
Comment 13 Jon H 2023-07-31 00:51:57 UTC
More info, this is the boot dmesg before the repeating error.


ath0: <Atheros AR946x/AR948x> mem 0x9f800000-0x9f87ffff 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] LDPC transmit/receive enabled
ath0: [HT] 2 RX streams; 2 TX streams
ath0: AR9460 mac 640.3 RF5110 phy 0.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0000
ath0: ath_edma_recv_tasklet: sc_inreset_cnt > 0; skipping
Comment 14 Tom 2023-08-21 00:49:43 UTC
I've identified one cause of this issue as commit https://cgit.freebsd.org/src/commit/?id=116679b39cb94fdb94c02dceb1c2cae719bd3f42 which was cherry-picked into the releng/13.* tree in commit fddbdafd2d112e65c61800edca087992e5b80abc . This commit happened chronologically after the initial report, so it can't be the only cause, but I have the same symptoms and the same work-arounds.

Methodology:

I can reproduce this issue with 100% success rate with only the base system by having my laptop (framework tigerlake) plugged into my dock (lenovo 40B00135US) when it boots. The issue doesn't happen on FreeBSD 13.1 but it happens on FreeBSD 13.2.

I created a pristine boot environment by extracting base.txz and kernel.txz from 13.1 into a zfs dataset. I never installed any additional software on it (no packages or ports, just the base system. To change the git revision in /usr/src I'd mount the boot environment from my linux install to use git from there since its not in the base system). I put in the following configs:

/boot/loader.conf:
    zfs_load="YES"

/etc/rc.conf
    wlans_ath0="wlan0"
    ifconfig_wlan0="WPA DHCP"

/etc/src.conf
    WITHOUT_LLVM_TARGET_ALL=YES

/etc/wpa_supplicant.conf
    ctrl_interface=/var/run/wpa_supplicant
    eapol_version=2
    ap_scan=1
    fast_reauth=1
    
    network={
        ssid="MyRealSSIDHere"
        psk="MyRealPasswordHere"
        priority=5
    }

I then used git bisect between 8824cbace389c440394bb9ea6c127d0f8f85538b (git merge-base releng/13.1 releng/13.2) and 4341433a673fde3e1c1554b9daa15d4db71f6edb (releng/13.2). At each step I would:

- compile FreeBSD from source and install it in-place over the  pristine binary install (make buildworld buildkernel && make installkernel && reboot && make installworld && etcupdate -B && reboot)
- reboot into the new system, and attempt to ping 8.8.4.4 and ifconfig.co .
- boot into my linux boot environment, zfs rollback to the pristine binary 13.1 state from before compiling FreeBSD, and update /usr/src to the next revision in the git bisect
- rinse and repeat for a day and half until reaching the "bad" commit
Comment 15 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-08-21 01:03:55 UTC
(In reply to Tom from comment #14)

Try to first apply the following change from stable/13 then (by itself)
https://cgit.freebsd.org/src/commit/libexec/rc/rc.d/wpa_supplicant?h=stable/13&id=ded53e898c7be6d610e94c1746fd22304f5c5988
and let us know if that helps.

If it doesn't you could give https://reviews.freebsd.org/D38661 a try as well which is the wrong solution to a different problem but would be interesting to know if it makes any difference?
Comment 16 Tom 2023-08-21 22:34:31 UTC
(In reply to Bjoern A. Zeeb from comment #15)

cherry-picking ded53e898c7be6d610e94c1746fd22304f5c5988 onto releng/13.2 does fix the issue for me. I'm waiting on account approval to be able to see the patch for https://reviews.freebsd.org/D38661 .
Comment 17 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-08-22 00:26:14 UTC
(In reply to Tom from comment #16)

If the commit changes fixes the problem, then the review is pointless-ish to waste time on (it is public now).

We should probably try to get an EN going for 13.2 then for that change to at least improve the situation.

If this is also Daniel's problem and the above change fixes it, the we should label this an EN candiate and I'll be happy to assist with that.
Comment 18 Tom 2023-08-24 18:30:37 UTC
(In reply to Bjoern A. Zeeb from comment #17)
Well FWIW I tested out the patch from https://reviews.freebsd.org/D38661 anyway, applied on top of 4341433a673fde3e1c1554b9daa15d4db71f6edb from releng/13.2, and it also solved the issue for me.
Comment 19 Mark Linimon freebsd_committer freebsd_triage 2024-01-19 16:14:28 UTC
^Triage: reassign to committer that resolved via D38661 Oct 9 2023, 6:16 PM.

Set possible mfc flags.
Comment 20 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-01-20 21:16:50 UTC
I would not do an errata anymore given 13.3 is around the corner;  we never heard back from the original Submitter.  Currently we are waiting on confirmation that 13.3 (or stable/13) does no longer have the problem and we can close.
Comment 21 Daniel Cervus 2024-01-20 22:30:21 UTC
(In reply to Bjoern A. Zeeb from comment #20)
Sorry, I have seen the solution, but I cannot test it because I have left the laptop on the other side of the earth. Never thought it could be solved. The best I can do is to return and get it this summer. My apologies.
Comment 22 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-01-20 22:34:06 UTC
(In reply to Daniel Cervus from comment #21)

Fair enough.  Thanks for the feedback.  Would you say we can close the PR then assuming it to be fixed -- and if anyone hits the problem (again) it can be re-opened?
Comment 23 Daniel Cervus 2024-01-20 22:39:46 UTC
(In reply to Bjoern A. Zeeb from comment #22)
No problem, glad to see it is finally fixed in 13.3!
Comment 24 Daniel Cervus 2024-01-20 22:45:11 UTC
Thanks for everyone who worked on this problem!
Comment 25 Jon H 2024-01-21 01:16:23 UTC
I suffered from this problem and it was fixed for me with 13/stable. I've since upgraded to 14.0 and it is still working.
Comment 26 Daniel Cervus 2024-07-13 01:46:26 UTC
(In reply to Bjoern A. Zeeb from comment #22)
I have got the computer back, the wireless card and bsdconfig work perfectly!
Comment 27 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-07-16 19:09:44 UTC
(In reply to Daniel Cervus from comment #26)

Thanks for the feedback.

Lots of joy!