# System freezes with Atheros AR5416



## Day_JJ (Mar 7, 2011)

I am trying to do a new installation of FreeBSD with a Belkin N-1 PCI card. After the installation I did a cvsup and built a new kernel with ath & wlan support, built & installed world, etc. This is the first time I have tried WiFi on FreeBSD but I have everything set up correct as far as I can tell.

uname output:

```
FreeBSD sys-h2.test.int 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Mon Feb 14 08:24:54 MST 2011     
[email]root@sys-h2.test.int[/email]:/usr/obj/usr/src/sys/TEST1  i386
```

rc.conf:

```
wlans_ath0="wlan0"
ifconfig_wlan0="wlanmode STA authmode WPA ht country US DHCP"
```

So, after checking the pci bus:

```
ath0@pci0:1:2:0:	class=0x028000 card=0x80011799 chip=0x0023168c rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = '802.11a/b/g/n Wireless PCI Adapter (AR5416)'
    class      = network
    bar   [10] = type Memory, range 32, base 0xf9000000, size 65536, enabled
    cap 80[40] = unknown
```

checking *ifconfig*:

```
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 00:11:50:f7:e8:31
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
	status: associated
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:11:50:f7:e8:31
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	ssid "" channel 10 (2457 MHz 11g)
	regdomain FCC indoor ecm authmode OPEN privacy OFF txpower 27 bmiss 7
	scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7
	roam:rate 5 protmode CTS wme burst bintval 0
```

and listing the scan results from the card:

```
SSID/MESH ID    BSSID         CHAN RATE   S:N     INT CAPS
Fuller          00:22:75:d4:4a:bc    1   54M -92:-96  100 EP   MESHCONF MESHCONF HTCAP WME
ROBERT          00:22:3f:09:f2:ae    9   54M -88:-96  100 EPS  WME ATH
<my AP>         00:1e:c2:f5:b6:b9    9   54M -68:-96  100 EPS  RSN HTCAP WME
qwest2224       00:22:10:7f:d9:50    1   54M -90:-96  100 EP  
krycho          00:24:7b:fd:7a:e4   11   54M -93:-96  100 EP   RSN WPS WPA WME
Candelaria      00:22:6b:3f:0b:e0    6   54M -92:-96   50 EP   WPS WPA
```
everything looks as I expect it to.

I generated a simple wpa_supplicant.conf file:

```
network={
scan_ssid=1
ssid="my AP"
proto=WPA2
key_mgmt=WPA-PSK
psk="my p/w"
}
```
and executed *wpa_supplicant*. The card connects, a DHCP address is assigned, and everything looks fine - for about a minute. And then the system freezes. A power off is required to clear the lockup.

Three questions:
1 - Is there some way to tell what causes the lockup?
2 - Did I make an error or is there some problem with the ATH(4) driver?
3 - Can someone explain cap 80[40] = unknown from the pciconf scan?


----------



## Bax (Apr 24, 2011)

I have the same problem. With 8.1-RELEASE. everything was ok with my Atheros 9280, but 8.2-RELEASE freezes the system after a few minuses when wlan0 is UP and nothing is logged. I tried AP and Ad-hoc modes, results are the same.


```
ath0@pci0:2:0:0:	class=0x028000 card=0x3a781186 chip=0x0029168c rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    class      = network
    bar   [10] = type Memory, range 32, base 0xfeaf0000, size 65536, enabled
```


----------



## caesius (Apr 24, 2011)

I had the same issue. See http://forums.freebsd.org/showthread.php?t=23282

I "fixed" it by installing 9-CURRENT.

Check to see if your dmesg full of messages like:

```
ath0: bad series0 hwrate 0x1b, tries 1 ts_status 0x0
ath0: bad series0 hwrate 0x1b, tries 1 ts_status 0x0
ath0: bad series0 hwrate 0x1b, tries 1 ts_status 0x0
```

I'm interested to hear if it is. The bug has been reported: http://forums.freebsd.org/showthread.php?t=23282


----------



## mantic (May 11, 2011)

@Day_JJ

The same thing for me. I have a TP_Link TL-wn951N based on the AR5416 Atheros card. FreeBSD 9.0 Current does not fix it. I have 8.2 and 9.0 running here and the card freezes both versions.

I have tried playing around with the TX/RX ifconfig values and that makes no difference. I know it's not the machine as I can use a 54G Atheros card in there and it's rock solid.

Any known workarounds?


----------



## NicoM (May 11, 2011)

Same thing for me with a D-LINK DWA-547 (Atheros AR5416 chipset) on a 8.2-RELEASE, the system freezes, I have to power-off; it can occur randomly after five minutes or one hour.


----------



## adrian@ (May 30, 2011)

Hi,

Please poke me directly (adrian@freebsd.org) about this sometime after mid-July as I'm currently busy finishing up studies.

I'd like to try and fix any AR5416 related issues before 9.0-RELEASE.

I'd like to especially hear if it works in a previous release but not in a later release.

As far as the 11n chipsets are concerned - AR9160, AR9280, AR9285, AR9287 should all be stable in -HEAD.


----------



## DutchDaemon (May 30, 2011)

adrian@, it's probably wise to use the forum's thread subscribe function for the topics you're interested in, and set up an email alert when someone posts in those topics.


----------



## adrian@ (May 30, 2011)

I've got enough going on at the moment and coming back to the forums to find topics that I can help out with isn't really doable.

I'll be tinkering with fixing up AR5416 support after my exams are done. But I only have a restricted set of AR5416 hardware and the issues may be very subtle. :/


----------



## NicoM (Nov 12, 2011)

Hi,

Still same issues on FreeBSD 9.0-RC1. The new bsdinstaller detects my card during installation (which is actually nice), but as soon as I try to join my access point, the system freezes.


----------



## adrian@ (Nov 21, 2011)

*PCI 11n NICs and hangs*

Hi all,

If you're using a _PCI_ 11n Atheros NIC (so AR5416, AR9160, AR9220, AR9227) please try rebooting with SMP disabled. Ie, bring up the system on a single CPU/core/thread only. It doesn't occur on the PCIe versions (ie AR5418, AR9280, AR9285, AR9287.)

There seems to be a hardware issue which requires all access to the PCI NIC to be serialised. If more than one CPU attempts concurrent access to the device, it hangs the bus and thus the system.

I've added code to FreeBSD-HEAD to fix this, but it:

* hasn't (yet) been verified - only the "boot non-SMP" fix has been verified;
* doesn't work out of the box - it only actually gets used if the kernel has been built with AH_DEBUG or AH_REGOPS_FUNC defined;
* .. and won't work if you've built the ath module, as the module (currently) overrides the HAL build options rather than listening to what users have placed in their kernel configuration file.

I won't merge this to stable/9 until I get verification from users that this has fixed the bug, as well as sort out the above issues.

If you use the latest FreeBSD-HEAD then you'll find the kernel will print out the PCI NIC numbers instead of the PCIe NIC numbers, so you can more easily identify what you have. Otherwise, the device ids are in sys/dev/ath/ath_hal/ah_devid.h and those include comments indicating which bus type they are.

Good luck! Please report any good or bad findings!


Adrian


----------



## giantlock (Nov 29, 2011)

adrian@ said:
			
		

> Hi all,
> If you're using a _PCI_ 11n Atheros NIC (so AR5416, AR9160, AR9220, AR9227) please try rebooting with SMP disabled. Ie, bring up the system on a single CPU/core/thread only. It doesn't occur on the PCIe versions (ie AR5418, AR9280, AR9285, AR9287.)
> 
> There seems to be a hardware issue which requires all access to the PCI NIC to be serialised. If more than one CPU attempts concurrent access to the device, it hangs the bus and thus the system.
> ...



Is it possible to have a patch for 8-stable?
I'm interested to test it, but I'm not ready to move to current.

Thanks, Adrian, anyway.


----------



## stig (Apr 20, 2012)

Hey all,

I have the same problem. The system freezes after some time when wlan0 (ath0) is up and running. My Atheros NIC is a AR9280. The solution with rebooting with SMP disabled is working but I was wondering if your solution Adrian is coming to 9-stable anytime soon? 

If you are still waiting for feedback I'll be happy to help by testing your solution, but I need some advice (never tested on freebsd before). As I understand it I'll need to upgrade to FREEBSD-HEAD and I do this by (1) changing the default release=cvs from tag=RELENG_9_0 to tag=FREEBSD-HEAD, (2) csup to get the latest and greatest and then (3) compile the kernel with AH_DEBUG or AH_REGOPS_FUNC defined. If that works I'll compile the kernel with SMP enabled and then report back if it works.

Is the above described proces correct? As mentioned it is my first time testing in freebsd FreeBSD so please feel free to correct any flaw or come with some advice!

`uname -a`

```
FreeBSD Neferskara 9.0-RELEASE FreeBSD 9.0-RELEASE #3: Sun Apr  8 10:08:36 CEST 2012     
sman@Neferskara:/usr/obj/usr/src/sys/NeferskaraKernel  amd64
```
By the way Free*BSD* Rocks!
Stig Nielsen


----------

