# ath9k and gentoo

## Alienfreak

Did anyone make a working patch for the gentoo-sources 2.6.26 or 2.6.25 yet?

They seem to be a good alternative for the ath5k (especially for the macbook owners) and it even supports the draft n standard.

I tried myself but I failed miserably  :Very Happy: 

----------

## DocFX

Hi,

I didn't try it with sys-kernel/gentoo-sources, but I could compile it using the wireless-testing tree  :Wink: 

```
 cd /usr/src/

git clone git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/ath9k.git 

git clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

cd ath9k

./gen-patch.sh

cd ../wireless-testing

patch -p1 < ../ath9k/add-ath9k.patch

cp /usr/src/my-old-linux-kernel/.config .

make oldconfig

make menuconfig

make bzImage modules modules_install
```

Using ath9k, unencrypted wifi works fine for my AR5418 (macbook builtin), but I didn't manage to get WPA to work. I didn't try WEP. 

Does anybody know if ath9k is supposed to already support WPA?

cheers,

  DocFX

----------

## Alienfreak

Ah ok... but I aim at using it with the gentoo sources  :Wink: 

WEP should work out.

I think the WPA problem is more related to WPA_Supplicants not supporting this one? I guess so at least  :Smile: 

I hacked  bit and made the patch apply to 2.6.26-gentoo... but it breaks at the compilation of the kernel

 *Quote:*   

> drivers/net/wireless/ath9k/ksrc/beacon.c: In function ‘ath_beacon_alloc’:
> 
> drivers/net/wireless/ath9k/ksrc/beacon.c:426: error: too few arguments to function ‘ieee80211_beacon_get’
> 
> 

 

But the ieee80211_beacon_get is getting called correctly :/

----------

## wswartzendruber

 *Alienfreak wrote:*   

> Ah ok... but I aim at using it with the gentoo sources 
> 
> WEP should work out.
> 
> I think the WPA problem is more related to WPA_Supplicants not supporting this one? I guess so at least 
> ...

 

Look in net/mac80211/tx.c and you should see that the function there takes three parameters.  I haven't figured out how to get around that yet.

----------

## brfsa

The kernel 2.6.26 Works great

The madwifi-trunk driver also works good even wireless 802.11N at 5GHZ

The only thing is that u cannot use a Fully Preemptible kernel. 

It has to be either Voluntary Preemption or no Preemption, otherwise madwifi-ng-trunk will compile but not load at all.

use the kernel config from this guy:

http://www.odi.ch/prog/macbookpro/index.php

madwifi-trunk:

http://snapshots.madwifi.org/madwifi-trunk/

----------

## peteblack

 *brfsa wrote:*   

> The kernel 2.6.26 Works great

 

Which patches did you use? I'm seeing the same as Alienfreak when compiling:

 *Alienfreak wrote:*   

> drivers/net/wireless/ath9k/ksrc/beacon.c: In function ‘ath_beacon_alloc’:
> 
> drivers/net/wireless/ath9k/ksrc/beacon.c:426: error: too few arguments to function ‘ieee80211_beacon_get’
> 
> 

 

----------

## brfsa

I see what you mean.

NO Patches. Just use the Gentoo Kernel 2.6.26 (gentoo-sources-2.6.26) and download the latest madwifi-trunk snapshot.

You are tried to patch the kernel with the new ATH9K driver from madwifi, i got the same error.

It didn't work for me with that kernel, but there is a little patch to make it work.

I didnt try that patch, maybe you can try it and let us know?? please. 

It is supposed to be better.

https://lists.ath9k.org/pipermail/ath9k-devel/2008-July/000025.html

or

https://lists.ath9k.org/pipermail/ath9k-devel/2008-July/000012.html

What you have to do to get it working with 2.6.26-gentoo is to just get the madwifi-trunk release, it works out of the box, perfect:

1. Get the latest nightly snapshot

http://snapshots.madwifi.org/madwifi-trunk/

2. uncompress it,

3. # make 

4. # make install

5. # modprobe ath_pci

Thats it.

I hope it will be included in 2.6.27

----------

## smellyfis

the patch for ath9k is meant for kernel 2.6.27-rc1 but even that has it's problems,

xx == kernel src location

if you look at the source for xx/include/net/mac80211.h you'll notice that iee80211_beacon_get is not there but if you look at the kernel wireless-testing it is

but if you copy those lines you will still get errors there are several lines that are missing in 2.6.26 that are needed for ath9k to work

my suggestio is if you really need 802.11n or ath9k you need to go with wireless-testing kernel (this is not supported by gentoo)(also see docfx's post for this)

otherwise be patient it will be patched into the kernel when it doesn't have as many bugs

(i tried with linux-2.6.26 patched to 2.6.27-rc1 had to change some things in mac80211.h booted up fine modprobed fine but /etc/init.d/wlan0 caused a kernel panic any help?)

----------

## peteblack

 *brfsa wrote:*   

> ...
> 
> I didnt try that patch, maybe you can try it and let us know?? please. 
> 
> ...
> ...

 

Thanks for the info and the walk-through. Unfortunately I can't use madwifi-ng as I need support for the newer AR928x series. To my understanding ath9k is my only hope.

On a side note; there is a live ebuild, net-wireless/madwifi-ng-9999, in the arcon overlay that grabs the madwifi trunk. Just remember to keyword/unmask it and net-wireless/madwifi-ng-tools-9999.

This suggests that something other (newer) then 2.6.26 is needed for atk9k as the kernel wireless part is not fully functional.

I tried patching and compiling ath9k against the wireless-testing.git, but with no luck. I'm getting:

```

drivers/net/wireless/ath9k/xmit.c: In function ‘fill_min_rates’:

drivers/net/wireless/ath9k/xmit.c:251: error: ‘IEEE80211_TX_CTL_EAPOL_FRAME’ undeclared (first use in this function)

drivers/net/wireless/ath9k/xmit.c:251: error: (Each undeclared identifier is reported only once

drivers/net/wireless/ath9k/xmit.c:251: error: for each function it appears in.)

drivers/net/wireless/ath9k/xmit.c: In function ‘ath_tx_prepare’:

drivers/net/wireless/ath9k/xmit.c:313: error: ‘IEEE80211_TX_CTL_DO_NOT_ENCRYPT’ undeclared (first use in this function)

make[4]: *** [drivers/net/wireless/ath9k/xmit.o] Error 1

```

I haven't spent that much more time on it, and I'll give it a fresh try this weekend. It's as my general understanding (from reading the mailing list) that the ath9k driver (and the kernels wireless part) are still under development. Looks like the missing symbols might be in 2.6.27-rc1 or git, so I'm going to give that a try later. I'll post if I have any luck.

If I overlooked something please feel free to set me straight.

----------

## wswartzendruber

ath9k is in madwifi-trunk?!?!?!   :Shocked: 

----------

## brfsa

 *wswartzendruber wrote:*   

> ath9k is in madwifi-trunk?!?!?!  

 

is it?

 :Smile: 

 latest madwifi-trunk (http://snapshots.madwifi.org/madwifi-trunk/) 

works great with my atheros AR5418

WPA2 and 5GHz as well

so i guess it has the ath9k?

----------

## peteblack

 *brfsa wrote:*   

>  *wswartzendruber wrote:*   ath9k is in madwifi-trunk?!?!?!   
> 
> is it?
> 
>  latest madwifi-trunk (http://snapshots.madwifi.org/madwifi-trunk/) 
> ...

 

Just note that ath5k and ath9k are FOSS where as madwifi-ng depends on proprietary firmware/HAL. It's all well explained at madwifi.org

----------

## wswartzendruber

 *brfsa wrote:*   

>  *wswartzendruber wrote:*   ath9k is in madwifi-trunk?!?!?!   
> 
> is it?
> 
>  latest madwifi-trunk (http://snapshots.madwifi.org/madwifi-trunk/) 
> ...

 

No man, that's not what it means.  The MadWifi trunk driver has had support for about a year.  But it's heavy, depends on a binary HAL, and isn't that well written.  So some devs got together and started the ath5k project for Linux, which AFAIK, is mostly a port from the BSD version.  Well, everyone thought ath5k was eventually going support the AR5008 based chipsets, but lo and behold, Atheros themselves surprises everyone with their own completely open driver: the ath9k.

----------

## brfsa

ok, got it.

thanks for the explanation. 

hope I can get ath9k working then.

----------

## hoppel118

Hey!

I am from Germany and read this thread two days ago. I used the ath5k for my Atheros AR5008 (802.11n), but had a lot of Connection-losses. The ath9k-driver works perfectly on my system now. 

Read the following thread posting 6!

https://forums.gentoo.org/viewtopic-p-5175107.html#5175107

I have got one little Problem with wpa_supplicant, but it works!   :Cool: 

```
# /etc/init.d/net.wlan0 restart

 * Unmounting network filesystems ...                                  [ ok ]

 * Stopping wlan0

 *   Bringing down wlan0

 *     Shutting down wlan0 ...                                               [ ok ]

 *     Stopping wpa_cli on wlan0 ...                                       [ ok ]

 *     Stopping wpa_supplicant on wlan0 ...                            [ ok ]

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...

ioctl[SIOCSIWAUTH]: Operation not supported                     

      [ ok ]th param 4 value 0x0 -

 *   Starting wpa_cli on wlan0 ...                                          [ ok ]

 *     Backgrounding ... 
```

What means "ioctl[SIOCSIWAUTH]: Operation not supported [ ok ]th param 4 value 0x0"?

Greetz from Germany and thank you for the tip with ath9k

Hoppel118

----------

## peteblack

In case anyone missed it, ath9k is now in 2.6.27-rc3.

----------

## brfsa

awesome

----------

