Sony computers, ath9k driver and a slow internet connection

We’ve been having some problems updating the OS’s of the computers here at home… Joao was braver than me and tried it a few months ago. Ha has a Sony and a LeNovo laptops, both running Ubuntu 11.04 at that point. When Ubuntu 11.10 was released, he updated the LeNovo without any problems, but it did not go so well with his Sony machine. Suddenly the internet connection was very slow, although the computer was able to connect to the wireless network without a problem. He was puzzled for some days with this, even trying other systems such as Linux Mint and Debian, with no success. They all presented the same slow slow connection. Then, some day, he took his computer to the university and, voilรก! The internet was at full speed again. We wondered if the problem was our router and even tried updating it, but nothing seemed to do the trick. Also, the other computers were working perfectly fine on this network, including my Ubuntu 11.04.

Well, after all this headache I decided not to update my Sony laptop so soon. But soon has passed, and this weekend I finally gathered the courage, time and patience to do it. I was on the safe side, so I made live USB’s of Ubuntu 12.04, Mint 13 and Mint LMDE (Debian based). I tested all of them, and nothing worked. The same weird behaviour happened again… It was able to connect to the wifi but surfing the internet was a torture. After some hours searching forums here and there, I finally found a solution that worked for me. It worked on the three systems I tested, and I finally installed Linux Mint LDME ๐Ÿ™‚

So I will post this here as a future reference.

Problem: The computer connects to the internet but the connection is incredibly slow (it might happen on some wifi networks, not all).
Machine: Sony VPCEA46FG (Joao’s laptop is a Sony Z series, but we still have to bring it home to test the solution)
Wifi card: Atheros AR9285
Driver: ath9k
Solution: Deactivate the hardware encryption of the driver. Here’s how:

echo “options ath9k nohwcrypt=1” | sudo tee /etc/modprobe.d/ath9k.conf
sudo modprobe -rfv ath9k
sudo modprobe -v ath9k