[SOLVED] Ath9k not transmitting head scratcher

I'm hacking around getting LEDE running on a DAP-2590 (for WIP thread see this OpenWrt forum thread)

This has a single ath9k which can select between 2.5GHz or 5GHz bands.

Everything looks happy, I can scan with the phy, but there is no beacon transmitted. I've been trying various channels/settings/modparams and such, and every once in a blue moon the SSID will pop up, but then it goes away again when I tweak a setting and won't come back even when I tweak it back.

Looking through debugfs I only saw a couple things that perhaps may be questionable: sometimes some SERVICE ERR counters increment in ath9k/phy_errs, and no matter what I set the per-ap twpower to, /sys/kernel/debug/ieee80211/phy0/netdev:wlan0/ap_power_level stays -2147483648. However looks OK.

RIght now I've got hostapd deinstalled and am just making an IBSS with iw. So far I haven't seen the SSID doing this... the few times it has appeared I was using hostapd.

Any hard core ath9k hackers got any ideas? I'm out of inspiration. Maybe some GPIO fiddling to try?

Wiphy phy0
    max # scan SSIDs: 4
    max scan IEs length: 2257 bytes
    max # sched scan SSIDs: 0
    max # match sets: 0
    max # scan plans: 1
    max scan plan interval: -1
    max scan plan iterations: 0
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 0 (up to 0m)
    Device supports AP-side u-APSD.
    Device supports T-DLS.
    Available Antennas: TX 0x7 RX 0x7
    Configured Antennas: TX 0x7 RX 0x7
    Supported interface modes:
             * IBSS
             * managed
             * AP
             * AP/VLAN
             * monitor
             * mesh point
             * P2P-client
             * P2P-GO
             * outside context of a BSS
    Band 1:
            Capabilities: 0x104e
                    HT20/HT40
                    SM Power Save disabled
                    RX HT40 SGI
                    No RX STBC
                    Max AMSDU length: 3839 bytes
                    DSSS/CCK HT40
            Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
            Minimum RX AMPDU time spacing: 8 usec (0x06)
            HT TX/RX MCS rate indexes supported: 0-15
            Frequencies:
                    * 2412 MHz [1] (23.0 dBm)
                    * 2417 MHz [2] (23.0 dBm)
                    * 2422 MHz [3] (23.0 dBm)
                    * 2427 MHz [4] (23.0 dBm)
                    * 2432 MHz [5] (23.0 dBm)
                    * 2437 MHz [6] (23.0 dBm)
                    * 2442 MHz [7] (23.0 dBm)
                    * 2447 MHz [8] (23.0 dBm)
                    * 2452 MHz [9] (23.0 dBm)
                    * 2457 MHz [10] (23.0 dBm)
                    * 2462 MHz [11] (23.0 dBm)
                    * 2467 MHz [12] (disabled)
                    * 2472 MHz [13] (disabled)
                    * 2484 MHz [14] (disabled)
    Band 2:
            Capabilities: 0x104e
                    HT20/HT40
                    SM Power Save disabled
                    RX HT40 SGI
                    No RX STBC
                    Max AMSDU length: 3839 bytes
                    DSSS/CCK HT40
            Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
            Minimum RX AMPDU time spacing: 8 usec (0x06)
            HT TX/RX MCS rate indexes supported: 0-15
            Frequencies:
                    * 5180 MHz [36] (21.0 dBm)
                    * 5200 MHz [40] (21.0 dBm)
                    * 5220 MHz [44] (21.0 dBm)
                    * 5240 MHz [48] (21.0 dBm)
                    * 5260 MHz [52] (21.0 dBm) (radar detection)
                    * 5280 MHz [56] (21.0 dBm) (radar detection)
                    * 5300 MHz [60] (21.0 dBm) (radar detection)
                    * 5320 MHz [64] (21.0 dBm) (radar detection)
                    * 5500 MHz [100] (21.0 dBm) (radar detection)
                    * 5520 MHz [104] (21.0 dBm) (radar detection)
                    * 5540 MHz [108] (21.0 dBm) (radar detection)
                    * 5560 MHz [112] (21.0 dBm) (radar detection)
                    * 5580 MHz [116] (21.0 dBm) (radar detection)
                    * 5600 MHz [120] (21.0 dBm) (radar detection)
                    * 5620 MHz [124] (21.0 dBm) (radar detection)
                    * 5640 MHz [128] (21.0 dBm) (radar detection)
                    * 5660 MHz [132] (21.0 dBm) (radar detection)
                    * 5680 MHz [136] (21.0 dBm) (radar detection)
                    * 5700 MHz [140] (21.0 dBm) (radar detection)
                    * 5745 MHz [149] (21.0 dBm)
                    * 5765 MHz [153] (21.0 dBm)
                    * 5785 MHz [157] (21.0 dBm)
                    * 5805 MHz [161] (21.0 dBm)
                    * 5825 MHz [165] (21.0 dBm)
    valid interface combinations:
             * #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1, #{ IBSS } <= 1,
               total <= 2048, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz }

    HT Capability overrides:
             * MCS: ff ff ff ff ff ff ff ff ff ff
             * maximum A-MSDU length
             * supported channel width
             * short GI for 40 MHz
             * max A-MPDU length exponent
             * min MPDU start spacing

phy#0
    Interface wlan0
            ifindex 9
            wdev 0x3
            addr 00:00:56:00:04:fb
            ssid FOOBAR
            type IBSS
            channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
            txpower 21.00 dBm

root@AP11:~# iw reg get
global
country US: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
        (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
        (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (57240 - 63720 @ 2160), (N/A, 40), (N/A)

phy#0
country US: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
        (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
        (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (57240 - 63720 @ 2160), (N/A, 40), (N/A)


root@AP11:~# logread | grep iee
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.315771] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
Wed May 17 01:39:33 2017 kern.info kernel: [   20.328323] ieee80211 phy0: Atheros AR9160 MAC/BB Rev:1 AR5133 RF Rev:b0 mem=0x80011b00f0000000, irq=109
 root@AP11:~# logread | grep -e 'ath'
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.268195] ath: EEPROM regdomain: 0x0
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.272057] ath: EEPROM indicates default country code should be used
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.278577] ath: doing EEPROM country->regdmn map search
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.283959] ath: country maps to regdmn code: 0x3a
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.288816] ath: Country alpha2 being used: US
Wed May 17 01:39:33 2017 kern.debug kernel: [   20.293324] ath: Regpair used: 0x3a
Wed May 17 01:39:39 2017 daemon.notice netifd: radio0 (864): WARNING (wireless_add_process): executable path /usr/sbin/hostapd does not match process  path ()

root@AP11:~# cat /sys/class/ieee80211/phy0/device/enable
1
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/state
0x1
root@AP11:~# cat /sys/class/ieee80211/phy0/device/net/wlan0/operstate
up
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/power
23
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/txpower
23
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask
7
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask
7
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/ath9k/phy_err
          UNDERRUN ERR :          0
            TIMING ERR :          0
            PARITY ERR :          0
              RATE ERR :          0
            LENGTH ERR :          0
             RADAR ERR :          0
           SERVICE ERR :          0
               TOR ERR :          0
       OFDM-TIMING ERR :          0
OFDM-SIGNAL-PARITY ERR :          0
         OFDM-RATE ERR :          0
       OFDM-LENGTH ERR :          0
   OFDM-POWER-DROP ERR :          0
      OFDM-SERVICE ERR :          0
      OFDM-RESTART ERR :          1
       CCK-BLOCKER ERR :          0
        CCK-TIMING ERR :          0
    CCK-HEADER-CRC ERR :          0
          CCK-RATE ERR :          0
        CCK-LENGTH ERR :          0
    CCK-POWER-DROP ERR :          0
       CCK-SERVICE ERR :          0
       CCK-RESTART ERR :          1
            HT-CRC ERR :          0
         HT-LENGTH ERR :          0
           HT-RATE ERR :          0
            HT-ZLF ERR :          0
   FALSE-RADAR-EXT ERR :          0
       GREEN-FIELD ERR :          0
          SPECTRAL ERR :          0
root@AP11:~# cat /sys/kernel/debug/ieee80211/phy0/ath9k/xmit
                            BE         BK        VI        VO

MPDUs Queued:                0          0         0       960
MPDUs Completed:             0          0         0       960
MPDUs XRetried:              0          0         0         0
Aggregates:                  0          0         0         0
AMPDUs Queued HW:            0          0         0         0
AMPDUs Completed:            0          0         0         0
AMPDUs Retried:              0          0         0         0
AMPDUs XRetried:             0          0         0         0
TXERR Filtered:              0          0         0         0
FIFO Underrun:               0          0         0         0
TXOP Exceeded:               0          0         0         0
TXTIMER Expiry:              0          0         0         0
DESC CFG Error:              0          0         0         0
DATA Underrun:               0          0         0         0
DELIM Underrun:              0          0         0         0
TX-Pkts-All:                 0          0         0       960
TX-Bytes-All:                0          0         0     71952
HW-put-tx-buf:               0          0         0       960
HW-tx-start:                 0          0         0       960
HW-tx-proc-desc:             0          0         0         0
TX-Failed:                   0          0         0         0

Here's a potential clue:

Every time the SSID suddenly starts working, /sys/kernel/debug/ieee80211/phy0/ath9k/dump_nfcal shows readings. It never shows readings when the SSID is down.

I already have ANI turned off; didn't make a difference.

Solved: there were no IRQs. Had to teach the kernel about the PCI IRQs for this board, which end up as INTB/110 on 4.9.