# Terrible wireless performance with ath9k

## Spidey

My wireless is terribly slow for some time now. Since my last AP was defectful (even at close range the wireless signal would oscilate greatly), I'm a little biased against wireless, so it was only now that I thought of measuring how terrible it is.

Amaze yourselves:

```

$ ping 192.168.1.1

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.

64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=350 ms

64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=109 ms

64 bytes from 192.168.1.1: icmp_req=4 ttl=64 time=395 ms

64 bytes from 192.168.1.1: icmp_req=5 ttl=64 time=84.1 ms

64 bytes from 192.168.1.1: icmp_req=6 ttl=64 time=247 ms

64 bytes from 192.168.1.1: icmp_req=8 ttl=64 time=492 ms

64 bytes from 192.168.1.1: icmp_req=9 ttl=64 time=229 ms

64 bytes from 192.168.1.1: icmp_req=10 ttl=64 time=487 ms

^C

--- 192.168.1.1 ping statistics ---

10 packets transmitted, 8 received, 20% packet loss, time 9002ms

rtt min/avg/max/mdev = 84.193/299.658/492.378/147.686 ms
```

It takes way longer than this 300-500ms for the ping entry to show up on my terminal, sometimes it takes 2s and it shows 500ms.

192.168.1.1 is my router:

```
$ route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.1.1     0.0.0.0         UG    2001   0        0 wlan0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

192.168.1.0     0.0.0.0         255.255.255.0   U     2001   0        0 wlan0

$ ifconfig

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 0  (Local Loopback)

        RX packets 603  bytes 79388 (77.5 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 603  bytes 79388 (77.5 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.104  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::6aa3:c4ff:fe7a:543b  prefixlen 64  scopeid 0x20<link>

        ether 68:a3:c4:7a:54:3b  txqueuelen 1000  (Ethernet)

        RX packets 301524  bytes 67854366 (64.7 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 456183  bytes 164612070 (156.9 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

My AP/router is currently running dd-wrt, I'll measure wireless on Windows and ethernet later, but I don't think the problem is in its configuration or hardware.

Running deluge I can saturate my internet bandwith (30MBps) after some time, but still, response time is terrible. Even to surf the web it's extremely annoying.

I haven't had much luck with wireless to the day, and have even passed an ethernet cable to my room already. It's not crimped yet, I have moved in to this place recently and I'd like to have wireless set up before anything for it's easy of use. But I don't want to use it like this.

Any ideas on what is causing this terrible performance?

----------

## Jaglover

Try changing channels, wireless is susceptible to interference. Everything is wired in my home.

----------

## broken_chaos

What kernel version are you running? There was a serious bug for some ath9k chipsets in some kernels (I want to say the early 3.2 series, but I may be misremembering) which caused poor performance and significant packet loss (which you lost two of ten packets in the snip you posted). If you haven't upgraded recently (3.2.12 should be fine, which is current Gentoo stable), you should look at that. If you can't upgrade for some reason, I may be able to dig up the commit that fixed the issue again.

----------

## Spidey

I'm running ~amd64, currently at gentoo-sources-3.2.1.

The problem with 3.2.X kernels was that the adapter didn't even connect, you had to remove the modules and modprobe it again, which was impossible in my setup since I'm running with CONFIG_MODULES=n. That's why I downgraded to 3.2.1.

I'll update to 3.3.4 tomorrow and see if I can get better performance. Meanwhile, I changed the wireless channel and turbo mode (40MHz spectrum) to auto (20 or 40), and now I get 1.Xms ping time to my router, sometimes a 5ms, but no 100+ms ping times.

----------

## broken_chaos

I think this is the commit that fixes the issue: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=39141a87c717403c9dd4e0432766ea18054f86f8

----------

