# hostapd with ath9k problem

## GENKILL

Hello all,

I have a great problem with my server which randomly (usually after transfering more data with rate between 2MB/s and 11MB/s) hangs AP service based on hostapd 2.0-r1. I'm using my own, latest kernel 3.12 with ath9k driver combined with AR9485 TP-LINK PCIe card. When access point ends its work, the log shows:

```
Nov 10 19:29:00 anomalia kernel: ath: phy0: Failed to stop TX DMA, queues=0x004!

Nov 10 19:29:00 anomalia kernel: ath: phy0: DMA failed to stop in 10 ms AR_CR=0x00000024 AR_DIAG_SW=0x02000020 DMADBG_7=0x0002a800

Nov 10 19:29:00 anomalia kernel: ath: phy0: Could not stop RX, we could be confusing the DMA engine when we start RX up

Nov 10 19:29:00 anomalia kernel: ------------[ cut here ]------------

Nov 10 19:29:00 anomalia kernel: WARNING: CPU: 0 PID: 10104 at drivers/net/wireless/ath/ath9k/recv.c:489 ath_stoprecv+0x142/0x160()

Nov 10 19:29:00 anomalia kernel: Modules linked in:

Nov 10 19:29:00 anomalia kernel: CPU: 0 PID: 10104 Comm: kworker/u4:0 Not tainted 3.12.0 #1

Nov 10 19:29:00 anomalia kernel: Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H61M-DS2H, BIOS F7 04/17/2013

Nov 10 19:29:00 anomalia kernel: Workqueue: phy0 ath_reset_work

Nov 10 19:29:00 anomalia kernel: 00000000000001e9 ffff880069cc5cb8 ffffffff81762a9e 0000000000000007

Nov 10 19:29:00 anomalia kernel: 0000000000000000 ffff880069cc5cf8 ffffffff8105b757 ffffffff81a256b8

Nov 10 19:29:00 anomalia kernel: ffff88007bbfd6a0 ffff880073800028 0000000000000000 0000000000000000

Nov 10 19:29:00 anomalia kernel: Call Trace:

Nov 10 19:29:00 anomalia kernel: [<ffffffff81762a9e>] dump_stack+0x46/0x58

Nov 10 19:29:00 anomalia kernel: [<ffffffff8105b757>] warn_slowpath_common+0x87/0xb0

Nov 10 19:29:00 anomalia kernel: [<ffffffff8105b795>] warn_slowpath_null+0x15/0x20

Nov 10 19:29:00 anomalia kernel: [<ffffffff814c36e2>] ath_stoprecv+0x142/0x160

Nov 10 19:29:00 anomalia kernel: [<ffffffff814be1a2>] ath_prepare_reset+0x52/0x70

Nov 10 19:29:00 anomalia kernel: [<ffffffff814bff6a>] ath_reset_internal+0x8a/0x1e0

Nov 10 19:29:00 anomalia kernel: [<ffffffff814c0492>] ath_reset_work+0x22/0x40

Nov 10 19:29:00 anomalia kernel: [<ffffffff81073fe7>] process_one_work+0x177/0x4a0

Nov 10 19:29:00 anomalia kernel: [<ffffffff8107502b>] worker_thread+0x11b/0x370

Nov 10 19:29:00 anomalia kernel: [<ffffffff81074f10>] ? manage_workers.isra.21+0x2d0/0x2d0

Nov 10 19:29:00 anomalia kernel: [<ffffffff8107b8bb>] kthread+0xbb/0xc0

Nov 10 19:29:00 anomalia kernel: [<ffffffff8107b800>] ? flush_kthread_worker+0xa0/0xa0

Nov 10 19:29:00 anomalia kernel: [<ffffffff817723fc>] ret_from_fork+0x7c/0xb0

Nov 10 19:29:00 anomalia kernel: [<ffffffff8107b800>] ? flush_kthread_worker+0xa0/0xa0

Nov 10 19:29:00 anomalia kernel: ---[ end trace 65b95b10d19c736d ]---

Nov 10 19:32:33 anomalia kernel: ath: phy0: Failed to stop TX DMA, queues=0x004!

Nov 10 19:32:33 anomalia kernel: ath: phy0: DMA failed to stop in 10 ms AR_CR=0x00000024 AR_DIAG_SW=0x02000020 DMADBG_7=0x0002a800

Nov 10 19:32:33 anomalia kernel: ath: phy0: Could not stop RX, we could be confusing the DMA engine when we start RX up

Nov 10 19:35:03 anomalia kernel: ath: phy0: Failed to stop TX DMA, queues=0x004!

Nov 10 19:35:04 anomalia kernel: ath: phy0: DMA failed to stop in 10 ms AR_CR=0x00000024 AR_DIAG_SW=0x02000020 DMADBG_7=0x0000a400

Nov 10 19:35:04 anomalia kernel: ath: phy0: Could not stop RX, we could be confusing the DMA engine when we start RX up

Nov 10 19:38:16 anomalia kernel: ath: phy0: Failed to stop TX DMA, queues=0x004!

```

I think the root cause is comming from bad driver, ?hmm maybe from mainboard bios problem? because of DMA errors. Funny part is that everything can work perfect for few days and then suddenly even with android phone connected i have to reboot whole server.

I'm using full 150Mbit (didn't test g only spec yet). Please help, maybe someone had similar errors.

----------

## GENKILL

Ok, as propably nobody had similar issue, i had to dig on my own. Now i know that problem is rather caused by driver (I didn't leave message on devsite yet). I played with hostapd.conf settings and esecially with ht_capab option which gives me now stable working of ath9k driver. Below I give my last good config:

```
# DEVICE

interface=wlan0

driver=nl80211

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

own_ip_addr=127.0.0.1

# BASE AP INFO

ssid=SSID

ieee80211d=1

country_code=COUNTRY_CODE

# WORKING MODE

hw_mode=g

channel=9

#supported_rates=10 20 55 110 60 90 120 180 240 360 480 540

#WIFI-N MODE OPTS

wmm_enabled=1

ieee80211n=1

#ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40][TX-STCB][RX-STBC1][DSSS_CCK-40]

ht_capab=[SHORT-GI-20][TX-STCB][RX-STBC1]

#WPA/WPA2

macaddr_acl=0

auth_algs=1

ignore_broadcast_ssid=0

wpa=2

wpa_passphrase=PASSWD

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

#LOGGER

logger_syslog=-1

logger_syslog_level=0

logger_stdout=-1

logger_stdout_level=0

dump_file=/tmp/hostapd.dump
```

As everybody can see, i have set ht_capab=[SHORT-GI-20][TX-STCB][RX-STBC1] because if there is e.g. [HT40-] with [SHORT-GI-40], then AP gives of course two channels online and then up to 150Mbit, but problem shows off if i copy bigger files with max transfer. Very strange because now i have 72Mbit stable without any problem. I think i'd have to buy new card (maybe mimo) to try get 300Mbit AP and don't know which chipset to choose because atheros is not so good as i supposed  :Sad: 

----------

