# Weird behaviour of Atheros card - ath5k? [SOLVED]

## selig

Hello, just a few days ago I have created a home wifi network. I have this in my PC which acts as an AP

```

00:07.0 Ethernet controller: Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)

```

I am using madwifi-ng-0.9.4 drivers and hostapd-0.6.9 configured for WPA-1. The AP runs in 54M 802.11g mode.

Then there is my laptop which uses this:

```

08:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)

```

With the in-kernel ath5k driver (gentoo-sources-2.6.29-r5) and wpa_supplicant-0.6.4.

The problem is this: Trying different speed settings on the laptop, it seems that I get the best throughput (e.g. FTP transfer) by using 18M. 24M is a bit slower, 36M hardly puts any ping packet through and 48 or 54M are utterly unusable. When I tried lowering the speed on the AP to match the laptop's speed, the transfer rate became just a bit slower, it did not help.

I suspect the problem to be in the ath5k driver... are there any users with similar issues? I cannot test the laptop with madwifi-ng because when I tried it, I just got an error message that this card was not supported. I do not mind transfer speeds about 2 MB/s, my internet connection is not faster anyway and when I need to transfer something big I can just plug in a cable. However, I would like to know if the behaviour is common and will get fixed in later kernels or if there is a problem somewhere in my configuration.Last edited by selig on Tue Jul 07, 2009 5:56 pm; edited 1 time in total

----------

## d2_racing

Hi, can you post this, just to see the status of your AP.

```

# iwlist scan

```

----------

## timeBandit

 *selig wrote:*   

> Trying different speed settings on the laptop, it seems that I get the best throughput (e.g. FTP transfer) by using 18M. 24M is a bit slower, 36M hardly puts any ping packet through and 48 or 54M are utterly unusable. When I tried lowering the speed on the AP to match the laptop's speed, the transfer rate became just a bit slower, it did not help.

 Have you tried switching the AP to different channels? This sounds much like the behavior I would expect with radio interference on the channel.

Make sure you chose a different channel from any neighboring wifi networks. Check for any other potential sources of interference (e.g., some older cordless telephones) and disable them if you can--even if only temporarily, to confirm a problem.

----------

## selig

Yes, I have tried channels 1, 2 and 10... there is not much interference, there are just maybe 3-4 weak APs running on different channels. However, the antenna is places in the worst possible location - I am going to pick up a better one with a cable so that I can put it somewhere else.

I will also post the status of my AP if merely changin the antenna and its location does not help.

----------

## selig

It looks like the new, better antenna did not help... the behaviour is exactly the same.

This is what I get from iwlist scanning:

```

wlan0     Scan completed :

          Cell 01 - Address: 00:15:F2:6A:E0:B1

                    ESSID:"Aviko"

                    Mode:Master

                    Channel:1

                    Frequency:2.412 GHz (Channel 1)

                    Quality=14/100  Signal level:-98 dBm  Noise level=-103 dBm

                    Encryption key:on

                    IE: Unknown: 00054176696B6F

                    IE: Unknown: 010882848B962430486C

                    IE: Unknown: 030101

                    IE: Unknown: 050400010000

                    IE: Unknown: 2A0100

                    IE: Unknown: 2F0100

                    IE: IEEE 802.11i/WPA2 Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (1) : TKIP

                        Authentication Suites (1) : PSK

                    IE: Unknown: 32040C121860

                    IE: Unknown: DD06001018020000

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (1) : TKIP

                        Authentication Suites (1) : PSK

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s

                              24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s

                              12 Mb/s; 48 Mb/s

                    Extra:tsf=00000007afbb118e

                    Extra: Last beacon: 2706ms ago

          Cell 02 - Address: 00:90:4B:CA:34:1F

                    ESSID:"upc22"

                    Mode:Master

                    Channel:4

                    Frequency:2.427 GHz (Channel 4)

                    Quality=8/100  Signal level:-101 dBm  Noise level=-104 dBm

                    Encryption key:off

                    IE: Unknown: 00057570633232

                    IE: Unknown: 010382848B

                    IE: Unknown: 030104

                    IE: Unknown: 050400010000

                    IE: Unknown: DF20011E000000000A660902FF0F736D6572205A5000000000000000000000000000

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s

                    Extra:tsf=0000012a84c9e181

                    Extra: Last beacon: 1914ms ago

          Cell 03 - Address: 02:90:4B:CA:32:43

                    ESSID:"http://wimax.dkm.cz"

                    Mode:Master

                    Channel:4

                    Frequency:2.427 GHz (Channel 4)

                    Quality=2/100  Signal level:-103 dBm  Noise level=-104 dBm

                    Encryption key:off

                    IE: Unknown: 0013687474703A2F2F77696D61782E646B6D2E637A

                    IE: Unknown: 010382848B

                    IE: Unknown: 030104

                    IE: Unknown: 050400010000

                    IE: Unknown: DF20011E000000000A660902FF0F736D6572205A5000000000000000000000000000

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s

                    Extra:tsf=0000012a84c9e56d

                    Extra: Last beacon: 1913ms ago

          Cell 04 - Address: 00:13:D3:7F:98:CD

                    ESSID:"MSI"

                    Mode:Master

                    Channel:11

                    Frequency:2.462 GHz (Channel 11)

                    Quality=22/100  Signal level:-96 dBm  Noise level=-104 dBm

                    Encryption key:on

                    IE: Unknown: 00034D5349

                    IE: Unknown: 010482848B96

                    IE: Unknown: 03010B

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (1) : TKIP

                        Authentication Suites (1) : PSK

                    IE: Unknown: 050402030002

                    IE: Unknown: 2A0100

                    IE: Unknown: 32080C1218243048606C

                    IE: Unknown: DD07000C4301000000

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s

                              48 Mb/s; 54 Mb/s

                    Extra:tsf=000000015fd97281

                    Extra: Last beacon: 84ms ago

          Cell 05 - Address: 00:0C:20:03:1E:5E

                    ESSID:"Matrix"

                    Mode:Master

                    Channel:3

                    Frequency:2.422 GHz (Channel 3)

                    Quality=0/100  Signal level:-103 dBm  Noise level=-103 dBm

                    Encryption key:on

                    IE: Unknown: 00064D6174726978

                    IE: Unknown: 010882848B960C18306C

                    IE: Unknown: 030103

                    IE: Unknown: 050400010000

                    IE: Unknown: 2A0100

                    IE: Unknown: 320412244860

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (1) : TKIP

                        Authentication Suites (1) : PSK

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

                              12 Mb/s; 24 Mb/s; 54 Mb/s; 9 Mb/s; 18 Mb/s

                              36 Mb/s; 48 Mb/s

                    Extra:tsf=0000000e61ad618d

                    Extra: Last beacon: 2186ms ago

          Cell 06 - Address: 00:19:E0:6D:E2:CF

                    ESSID:"Chloe"

                    Mode:Master

                    Channel:11

                    Frequency:2.462 GHz (Channel 11)

                    Quality=100/100  Signal level:-68 dBm  Noise level=-104 dBm

                    Encryption key:on

                    IE: Unknown: 000543686C6F65

                    IE: Unknown: 010882848B0C12961824

                    IE: Unknown: 03010B

                    IE: Unknown: 07064E4149010D14

                    IE: Unknown: 200100

                    IE: Unknown: 2A0100

                    IE: Unknown: 32043048606C

                    IE: Unknown: DD180050F2020101840002A3400027A4000042435E0062322F00

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : CCMP TKIP

                        Authentication Suites (1) : PSK

                    IE: Unknown: DD0900037F01010020FF7F

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s

                              48 Mb/s; 54 Mb/s

                    Extra:tsf=00000000780ba581

                    Extra: Last beacon: 18ms ago

          Cell 07 - Address: 00:22:15:7A:FB:52

                    ESSID:"default"

                    Mode:Master

                    Channel:6

                    Frequency:2.437 GHz (Channel 6)

                    Quality=100/100  Signal level:-67 dBm  Noise level=-103 dBm

                    Encryption key:off

                    IE: Unknown: 000764656661756C74

                    IE: Unknown: 010882848B962430486C

                    IE: Unknown: 030106

                    IE: Unknown: 050400010000

                    IE: Unknown: 2A0100

                    IE: Unknown: 2F0100

                    IE: Unknown: 32040C121860

                    IE: Unknown: DD090010180200F0000000

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s

                              24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s

                              12 Mb/s; 48 Mb/s

                    Extra:tsf=000004ff97c67183

                    Extra: Last beacon: 1131ms ago

```

I do not see any considerable interference... There seems to be another AP on channel 11 but I tried also channel 1, 2 and 10 with the same results. My AP is Cell 06.

----------

## d2_racing

Are you sure that your actual AP is working properly, because I can tell that your wireless card can find 2 AP that has a quality of 100/100.

Can you connect to one of these 2 just to test your connection properly ?

----------

## selig

I will bring another laptop from my workplace tomorrow and try it... it might be my AP configuration - in case it does not work fine on the other laptop either I will post my configs from the AP (PC).

----------

## selig

I have just tried it with my work laptop. The behaviour is very similar, it must be a problem with my AP. When I am about 2m away from the antenna, the signal is ~-60dBm. When I go to the next room, the signal drops to ~-75dBm. What is strange is that the signal strength is fluctuating rapidly, it can be even better seen while transferring data. It can drop down by -15dBm (making it -75 near the AP and -90 in the next room). I cannot set the wifi speed on the work laptop but while transferring data it changes between 36, 48 an 54 depending on the signal level (which changes very rapidly, several times per second).

This is my hostapd.conf:

```

interface=ath0

bridge=br0

driver=madwifi

logger_syslog=-1

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=1

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

ssid=Chloe

hw_mode=g

macaddr_acl=0

accept_mac_file=/etc/hostapd/hostapd.accept

deny_mac_file=/etc/hostapd/hostapd.deny

auth_algs=1

wpa=1

wpa_passphrase=somePassphrase

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP CCMP

```

```

# iwconfig ath0 

ath0      IEEE 802.11g  ESSID:"Chloe"  Nickname:""

          Mode:Master  Frequency:2.457 GHz  Access Point: 00:19:E0:6D:E2:CF   

          Bit Rate=54 Mb/s   Tx-Power:16 dBm   Sensitivity=1/1  

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:3358-4DAB-C36B-8D5B-832D-DA8D-29B8-F701 [3]   Security mode:open

          Power Management:off

          Link Quality=0/70  Signal level=-95 dBm  Noise level=-95 dBm

          Rx invalid nwid:13681  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

```

Link quality and signal level changes when a station is connected, it displays the same values as on the laptop.

I do this in my local.start:

```

iwconfig ath0 rate 54M channel 10

```

Otherwise the rate is set at 0, channel is not set at all and I am unable to connect to the AP. Is there anything wrong with my configuration?

----------

## d2_racing

Hi, did you try an another AP, can you change your wireless router just to test your current config ?

----------

## selig

What do you mean by another AP? My PC is configured as an AP/router... and my laptop connects to it. I do not have any other PC which would be capable of acting as an AP to test my config on. But from what I have seen on the internet, people are using essentially identical hostapd.conf. It looks like more of a problem in the wifi card itself... Just for the fun of it I tried to connect the card to a 19 dBi directional antenna, pointed it at the place where my notebook is located in the next room and tried it. The signal was better but the behaviour was the same.

If wifi routers with gigabit ethernet ports were cheaper I would just buy one and be done with it...

----------

## d2_racing

In fact, but maybe you should try a cheap wireless router you to test your hardware.

The more I see, I think that your wifi card can be broke.

----------

## selig

I am thinking about buying a cheap router and doing this:

```

                  PC

ROUTER--[(eth1)-bridge-(eth0)]--laptop

```

When using wifi, laptop would connect directly to router.

eth1 is 100Mbit, eth0 is 1Gbit. What I want to achieve is to be able to switch from wireless to wired gigabit connection on my laptop as needed and not having to change its IP. However, with this proposed setup I am not sure if the router will know how to send a packet to the laptop when it's connected to a bridge on the PC. Do you think it would work? If yes I can buy a cheap router and throw out the bad wifi card.  :Very Happy:  (too bad I was not using it when it was new... now the warranty is gone)

I have heard that it is possible to connect a gigabit switch to a LAN port in a cheap router - which would essentially be the same situation.

----------

## timeBandit

 *selig wrote:*   

> ... I want to ... switch from wireless to wired gigabit connection on my laptop as needed and not having to change its IP. I am not sure if the router will know how to send a packet to the laptop when it's connected to a bridge on the PC. Do you think it would work?

 It should work if you connect the PC to a LAN port on the router, not the dedicated WAN uplink port (if provided). NAT between the WAN & LAN sides would interfere with your plan. I have a similar setup--in effect, the same--with a broadband router where you will have the PC:

```
WLAN <-> [WAP/Switch] <-> [NAT Router] <-> LAN
```

WLAN and LAN are both the same IP subnet. The WAP (new device in your case) and the NAT router (your two-NIC PC) each have a unique IP but the same subnet and mask. You'll need to do the same.

There is one caveat: You will need a static IP configuration on the laptop. It will have different MAC addresses in wired and wireless connection modes. DHCP MAC reservations won't compensate because you would need to reserve the same IP for both MAC addesses.

----------

## selig

I have come across an interesting piece of information... according to this table http://common.ziffdavisinternet.com/download/0/2063/WirelessPerformance.pdf the maximum real-world speed of pure 802.11g wifi is about 20 Mb/s - which is what I am observing. (about 2,8 MB/s throughput) So maybe everything is OK and I was just expecting too much... or do you have different experience with 54Mb 802.11g? If not, I will leave it as it is and be happy.  :Smile: 

----------

## selig

I just wanted to add an observation that in 2.6.30 kernels the weird rate setting is fixed - I can now use "auto" or "54M" and it works as expected, I do not have to limit the card to 18M to get maximum transfer speed.

----------

