You are not logged in.

#1 2013-03-01 06:56:02

vyu223
Member
Registered: 2013-02-18
Posts: 24

[SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

Wireless card: TP-LINK TL-WN951N. lspci says that it is an Atheros AR5416 adapter [AR5008].

Some background: I'm having the same issues as the OP in this thread, which references this bug report. The problem is that I get a 2000 ms ping every 30 seconds. So 2 seconds of inactivity every 30 seconds. I have the same wireless PCI card, as well. I need to fix this, because it's making online gaming impossible. I should also note that the card is working just fine in Windows 8, however. I am using net-auto-wireless. I have tried using wicd, enabling ath9k's nohwcrypt option, toggling the card's power save, installing the latest compat-drivers-patched from the AUR, toggling different settings in my motherboard's BIOS, and removing the antennae from the card. But nothing has made a significant difference.

I think I'm really close now. I just have to disable ANI. But in order to do that, it seems that I need to enable debugging for ath9k. But this means that I need to either recompile a custom kernel, or somehow enable debug for ath9k in compat-drivers-patched from the AUR. I'd prefer the latter, as that means that I will have a more bleeding-edge driver. That, and I won't have to touch the kernel as much. What I want is described on this page. But it seems too complicated to me. Please let me explain.

I've installed things from the AUR before, as mentioned above, and have properly configured my makepkg.conf for my system. So I'd like to use the CFLAGS and such that I've set. I don't understand how everything works in the PKGBUILD; I don't have much experience with sed and awk and regular expressions, and haven't done much shell scripting at all. It seems that at some point in the PKGBUILD, I need to enable debugging for ath9k before it is compiled. Apparently on the last page I linked to, I need to add:

export CONFIG_ATH_DEBUG=y
export CONFIG_ATH9K_DEBUG=y
export CONFIG_ATH9K_DEBUGFS=y

to some config.mk file. I can only get access to the config.mk file after I install the package with pacman. I've tried adding those lines to my /etc/profile file, and checked, after a reboot, with "set", that those variables are indeed set. But the thing is, with these variables set in /etc/profile, when I run makepkg, makepkg fails with an error 2. I tried again and got the same error. I removed those lines from my /etc/profile, rebooted, tried makepkg again, and everything worked. So putting those lines in my /etc/profile is not the solution, and I feel like I'm doing something very stupid. What am I doing wrong?

I should also note that I've tried to read the wiki page on compiling a custom kernel using ABS, but it seems to just say "get your custom configuration files" and then just continue (so it assumes that I should already be familiar with the configuration part). The PKGBUILD and Creating Packages wiki pages also seem to be a little... too advanced for me at this point in time.

So how do I enable debugging for ath9k in compat-drivers-patched from the AUR? I'd prefer to stick with only editing the PKGBUILD and using makepkg, if possible.

I've really tried to search the web and the arch forums on how to fix this problem myself, but alas, it seems that I need help this time. I greatly appreciate your time for reading my long post.

UPDATE:

I've made a lot of progress. I ended up removing the AUR package with pacman by invoking "pacman -Rsn compat-drivers-patched".

Instructions for [almost] success: First, download compat-drivers-patched from AUR. Then move it to the "builds" directory (or "local", if using ABS). Extract the tarball. After the new directory is created, cd into it. Now here's the important part: run

$ makepkg -so

Then cd into src, cd into the directory inside src, then edit the config.mk file. Make sure these lines are uncommented (or created, if not already there):

export CONFIG_CFG80211_DEBUGFS=y
export CONFIG_MAC80211_DEBUGFS=y
export CONFIG_ATH_DEBUG=y
export CONFIG_ATH9K_DEBUG=y
export CONFIG_ATH9K_DEBUGFS=y

(source)

Now run "cd ../.." to go back up two directories. Now run:

$ makepkg -e

# pacman -U <file that was produced>

And I ran "mkinitcpio -p linux" just in case, but I'm not sure if that is necessary at all. I'm... not touching the kernel, right?

Now I ran:

echo 1 > /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani

But bash would say that the file or directory doesn't exist. Even if I prepend it with "sudo", I get the same results. I was only able to get the command to work if I logged in as root. I even put the line in my /etc/profile. The 2000 ms ping every 30 seconds is now GONE. HOWEVER! If I reboot and log in as a normal user, the problem is there again. If I reboot and log in as root, the problem is gone. If I then log out and then log back in as a normal user, the problem does not come back.

So really, I can avoid the problem if I first log in as root, log out, and then log back in as a normal user. But this is a great inconvenience. I would much prefer if I could just log in as a normal user right after boot, and have everything working.

Now, how do I get the command to automatically run at boot as root (without me having to log in as root), and work?

UPDATE 2:

I got it working. Putting the line in /etc/profile is not the solution. I created a custom systemd .service file.

Put this into /etc/systemd/service (name it "disable_ani.service"):
EDIT: Wow. I made a glaring typo here. It should be /etc/systemd/system/disable_ani.service

[Unit]
Description=disable_ani

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo 1 > /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani"

[Install]
WantedBy=multi-user.target

Then make sure to "sudo chmod 755 /etc/systemd/service/disable_ani.service", since root owns this file.

Then run "sudo systemctl enable disable_ani.service".

EDIT: It has been brought to my attention that there is a much simpler way than creating a custom service.

Using a tmpfile:
/etc/tmpfiles.d/disable_ani.conf

w /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani - - - - 1

Done.

Now ANI is persistently disabled between boots, even if I log in as a normal user right after boot.

Thanks for reading.

Last edited by vyu223 (2013-03-12 10:20:19)

Offline

#2 2013-03-08 16:39:24

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 104

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

I made it so far:

echo 1 > /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani

and no success, the lags still persist...

 ⚡ root@acer-laptop ⮀ /sys/kernel/debug/ieee80211/phy0 ⮀ echo 1 > /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani
zsh: no such file or directory: /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani

Offline

#3 2013-03-08 19:37:18

vyu223
Member
Registered: 2013-02-18
Posts: 24

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

So zsh is telling you that the command didn't work, since it claims that there is no such file or directory. I had a lot of trouble with getting the echo command to work, as well. I found that if out of these lines:

export CONFIG_CFG80211_DEBUGFS=y
export CONFIG_MAC80211_DEBUGFS=y
export CONFIG_ATH_DEBUG=y
export CONFIG_ATH9K_DEBUG=y
export CONFIG_ATH9K_DEBUGFS=y

If the first and second line above were not uncommented in the config.mk file, I couldn't leave the last line above uncommented as well, or else makepkg would fail and give me an error. So originally I had only the 3rd and 4th lines above uncommented/inserted in my config.mk. With that configuration, I could not get the echo command to work, no matter what. Have you uncommented or inserted all of the above 5 lines into your config.mk?

After making sure all of the above 5 lines were in my config.mk, the echo command still didn't work, even if I preceded the command with sudo, or entered a su session. Bash would tell me that there was no such file or directory. I found that if I actually logged out of my normal user, and then logged back into the computer as root, the command would work. If your shell does not give you any feedback (particularly, "no such file or directory"), then the command worked. In order to get the command to run every time the computer boots, I used a systemd service, so that the command is issued as root. For some reason, it doesn't work if you put the command into /etc/profile.

Oh, and it would probably be helpful to mention that for the compat-drivers-patched package from the AUR, the PKGBUILD checks to see what your _selected_drivers variable is before compilation. If you set _selected_drivers=ath9k, your compile times will be much shorter.

Offline

#4 2013-03-08 22:46:51

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 104

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

Thanks for your reply! Well I'll try it again, but I think I copied (inserted, I didn't check if they exist anywhere else in that file) all 5 lines in config.mk. I tried creating that file and adding "1" to it with sudo and using su session. So for example if I login using tty2 as root it will work? Or I should login as root into my desktop environment? Well I'll try it out later and then report.
Yeah and I did already set _selected_drivers to ath9k.

EDIT: I now successfully compiled and installed it with all 5 lines (interesting that every space [] before export lines made pkgbuild fail making the package)
Then... All files at /sys/kernel/debug/ieee80211/phy0/ath9k were now available! I changed disable_ani contents to 1. The change should be immediate right or should I reload the module (which crashes the module for me)?
Seems like the problem is different to me and as soon as I change that 0 to 1, the lags still seem to persist.

EDIT:
Finnaly seems that the problem doesnt persist if I disable NetworkManager pernamently and reboot, and connect using wifi-menu.

Last edited by kellerman (2013-03-08 23:59:50)

Offline

#5 2013-03-09 00:07:32

vyu223
Member
Registered: 2013-02-18
Posts: 24

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

Glad to hear that your problem has been fixed. But yes, once you echo 1 into the disable_ani file, the change should be immediate. That is, ANI should be disabled, without the need to reload the module.

Offline

#6 2013-03-09 12:04:06

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 104

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

Yeah, thanks for the information. I'll try figuring something up about configuring my network now. NetworkManager is such a powerful tool, but those lag spikes are just terrible.
EDIT:
moved to wicd for now... everything's fine!

Last edited by kellerman (2013-03-09 16:00:13)

Offline

#7 2013-03-09 15:44:17

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

You don't need a whole service just to write to sysfs. Use tmpfiles for this:

w /sys/kernel/debug/ieee80211/phy0/ath9k/disable_ani - - - - 1

Offline

#8 2013-03-12 10:22:47

vyu223
Member
Registered: 2013-02-18
Posts: 24

Re: [SOLVED] Enabling debug for ath9k in compat-drivers-patched from AUR

Wow, thanks so much! That is much simpler. I have edited my post to reflect the change.

Offline

Board footer

Powered by FluxBB