# Atheros AR9280 hangs the system when creating wlanX



## xinn (Oct 7, 2010)

I have a problem with the card  TP-Link WN851N. Moreover, observed only in FreeBSD, Windows 7 everything works flawlessly.
The card is normally determined by the system, but when, according to manual I'm create device wlan0, after some random period of time system is hang.
Tried to change wlan modes: adhoc, hostap, monitor, channels: b/g/ng - the same result.
And no where no *. core files (even dumpdev = "AUTO" in rc.conf included) still do not dump. Even the /var/crash is empty. 

uname -a

```
FreeBSD bug 8.1-STABLE FreeBSD 8.1-STABLE #6: Wed Sep 22 15:18:14 EEST 2010	 xinn@bug:/usr/obj/usr/src/sys/BUGSERVER  i386
```

pciconf -lv

```
ath0@pci0:3:9:0:		class=0x028000 card=0x2091168c chip=0x0029168c rev=0x01 hdr=0x00
	vendor	 = 'Atheros Communications Inc.'
	class	  = network
```

cat /var/run/dmesg.boot | grep ath

```
ath0: <Atheros 9280> mem 0xe8100000-0xe810ffff irq 21 at device 9.0 on pci3
ath0: [ITHREAD]
ath0: AR9280 mac 128.2 RF5133 phy 13.0
```

rc.conf

```
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="inet 192.168.8.1 netmask 255.255.255.0 ssid bugWiFi channel 6 ht"
```

ifconfig ath0

```
ath0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
		ether 94:0c:6d:b3:6c:aa
		media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
		status: no carrier
```
Yesterday I downloaded http://svn.freebsd.org/base/head/sys/dev/ath/ and http://svn.freebsd.org/base/head/sys/net80211/ and build kernel with the new sources - same result.

Please help me.

Sorry for english, I used Google Translate.


----------



## rhyous (Oct 15, 2010)

Sounds like a driver bug an you may have to submit a bug.

You could try that tool that makes a kernel module from the windows driver...

This months BSD magazine at BSDMag.org talked about it.

The handbook has a doc on it here:
http://www.freebsd.org/doc/handbook/config-network-setup.html
see this section:
11.8.1.1 Using WindowsÂ® NDIS Drivers


----------



## xinn (Oct 15, 2010)

Thanks for the tip, but unfortunately ndis driver also causes kernel panic too x(


----------



## richardpl (Oct 16, 2010)

If you could give more useful information maybe bug will get fixed.


----------



## xinn (Oct 16, 2010)

I would like give more information but I do not know what to do to provide it.
Please, advice me, what I should do, to localize this problem.
Thanks a lot!


----------



## richardpl (Oct 16, 2010)

Does ath crash in STA mode too?

When ndis crash, does it produce useful output, like textdump in /var/crash. How you made driver module?

If you are in console, vty0 you should see panic message.


----------



## xinn (Oct 18, 2010)

richardpl said:
			
		

> Does ath crash in STA mode too?
> 
> When ndis crash, does it produce useful output, like textdump in /var/crash. How you made driver module?
> 
> If you are in console, vty0 you should see panic message.



In STA mode ath (or wlan) does'n crash, you right.
I used manual to generate ndis driver from this windows driver.

```
#ndisgen netathw.inf athw.sys
```
In vty0 console I see only kernel panic message =)
There is dumps from /var/crash
core.txt.0 and info.0 18kb
core.txt.0,info.0 and vmcore.0 16Mb


----------



## richardpl (Oct 18, 2010)

It is funny that it crash in ndis_init_nic().

Try code from http://gitorious.org/NDISulator

You just need to recompile ndis and if_ndis module.
You will need kernel and world source (you apparently already have them).
Note that if_ndis.c may not compile because it have ifqmaxlen (new feature from CURRENT), so just replace ifqmaxlen with hardcoded value (50 for example).

Alternatively look into 1d8740616d commit how to pick correct medium. (This one should also make leds working) - you will need to patch it manually. Or ask me to write patch.

Also be aware that NDISulator (at least <=5.1 NDIS API) can not support hostap.


----------



## xinn (Oct 18, 2010)

Many thanks for the detailed response
I will definitely take advantage of your advice.
Just a shame that hostap mode is the goal =)
Probably have to wait for fix this problem in his native ath driver.


----------



## xinn (Oct 20, 2010)

There some logs:

```
# ifconfig wlan0 create wlandev ath0 wlanmode hostap mode 11ng
# ifconfig wlan0 ssid my_ssid ht channel 6:ng inet 192.168.8.1/24
# /etc/rc.d/hostapd onestart
# wlandebug 0xffffffff
```
Wait for hang =(
After rebooting:

```
#cat /var/log/messages| egrep "wlan0|ath0" > mess_wlan
```
http://xinnslair.com/mess_wlan.zip


----------



## richardpl (Oct 24, 2010)

I doubt that developers of ath are reading forum posts so asking on mailing list is certainly better option.


----------

