Jump to content

Updated Atheros AR81(31/32/51/52) Driver for 10.7/10.8


Shailua
 Share

56 posts in this topic

Recommended Posts

Hi everybody, I'm a first time poster but I've been lurking for a while. Somewhat recently I bought a GA-Z77X-UD5H motherboard with two built-in ethernet ports: one Intel and one Atheros (AR8151 v2.0 gigabit ethernet, specifically). While the AppleIntelE1000e driver is being actively worked on, I noticed there hadn't been any recent progress I could see on the AtherosL1cEthernet driver from this thread:

http://www.insanelym...s-ar8131ar8132/

and this site:

https://code.google.com/p/iats/

 

Anyway, the driver in question wraps around the Atheros/Attansic L1c Linux kernel driver so I thought I'd try my hand at updating it all to the latest version. I have no previous experience writing kernel/driver code though, so the whole process has been a interesting learning experience. Full credit goes to the great work of the folks in the above two links that worked on this in the first place. I'm still messing with the code, but I figured if I didn't release something publicly now then I'd spend forever procrastinating and worrying that it wouldn't work for anyone else.

 

While everything seems to be working fine on my own particular machine, it may HORRIBLY BREAK yours. I haven't tested it ANYWHERE else. Please please please make sure you back up everything essential if you want to try this driver.

 

I have only tested it in Mountain Lion. The kext is compiled with the Lion SDK so it should hopefully work on there too. I have no idea if 32-bit works. I haven't even considered Snow Leopard; if you need support for that I'd suggest the older driver in the above links. I wasn't keeping track but chances are I've used something in the code that is 10.7+ only.

 

Did I mention this kext will probably cause your machine to panic and do nothing much else? As far as I can tell, all these Atheros ethernet chips are built into motherboards and laptops and don't come as separate cards. If Mac OS X becomes unbootable, the easiest thing to do would be to switch the card off in the BIOS temporarily and then delete the kext.

 

New Stuff:

- Newer Linux code should properly support AR8151 v1.0 and v2.0 as well as AR8152 v1.1/2.0, AR8131 and AR8132. This is the atl1c driver though, not the alx driver. As such, there is no support for AR8161 or AR8162 I'm afraid.

- I added Wake on LAN and Wake on Demand / Bonjour Sleep Proxy stuff. Seems to work fine, but this motherboard of mine works smoothly with UEFI and no custom DSDT stuff. Older BIOS-based machines might have some DSDT-related weirdness.

- If I remember correctly there was a bug with Bonjour/Zeroconf not showing other servers in Finder. I haven't seen it in the new code.

- The code should hopefully be 64-bit safe, even with more than 4GB of memory being used.

- VLAN was sort of working when I checked a while ago, but it might have broken again since then.

- A few minor bits and pieces I've forgotten, probably just Mac OS code related.

 

Installing:

Use your favourite method of adding kexts to /System/Library/Extensions. Personally I prefer doing it manually from the terminal.

NOTE: As of version 1.2.0, I have disabled debugging stuff in the main kext which shrinks things down and makes for quieter logging. For testing or reporting bugs, please use the kext in the "Debug" subdirectory. This will output much more info to /var/log/system.log.

 

Remove any old version:

sudo rm -rf /System/Library/Extensions/AtherosL1cEthernet.kext

 

Copy the new version from wherever you extracted it, such as Downloads:

sudo cp -r /Users/yourusername/Downloads/AtherosL1cEthernet/AtherosL1cEthernet.kext /System/Library/Extensions/

 

Clean out the kernel cache:

sudo rm -rf /System/Library/Caches/com.apple.kext.caches/*

 

Then reboot to be safe.

 

Changelog:

1.2.3 - Bug fixes and more modifications to the link status check code. It should no longer slow down booting when an ethernet cable is not connected. :) The bug fixes weren't anything huge, so feel free to stick with 1.2.2 (or any other version for that matter) if you're happy with it.

 

1.2.2 - Bug fixes and some better link status checking. TSO was disabled in the latest Linux driver code from Atheros for the 8131 and 8132, so it's possible there are hardware bugs. To be safe, I disabled it by default for those cards. To re-enable it you'll have to find the corresponding card entry in Info.plist and set EnableTSO to true. Be sure to clear your kernel cache afterwards if editing the Info.plist in place.

 

1.2.1 - Hopefully fixed a buffer memory allocation bug on non-gigabit adapters. Also added a minor packet receive optimisation.

 

1.2.0 - Added TCP Segmentation Offload (TSO) support for both IPv4 and IPv6, partial checksum offloading for transmitted packets and a bunch of little bug fixes and what I hope are optimisations.

 

1.1.2 - Rewrote some of the promiscous/multicast mode setting code to hopefully make things all clean and proper and maybe help with Bonjour problems. Filtered multicast reception instead of all-multicast reception should in theory make things a bit faster on a busy network with lots of multicast packets flying around the place, too.

 

1.1.1 - Fixed a silly bug in the link status code. It was causing problems with resetting the connection status and DHCP stuff when the cable was disconnected etc. Also fixed up some other random bits and pieces for the 32-bit module.

 

1.1.0 - The somewhat arbitrarily numbered initial release.

 

Downloads:

The zip files are (hopefully) attached to this post. They contain the kext module and the GPL sourcecode. The kext in the "Debug" folder is mostly the same as the regular kext, but prints much more information to the system logs.

 

Latest:

20121110 AtherosL1cEthernet-1.2.3.zip

MD5 checksum (AtherosL1cEthernet-1.2.3.zip) = 9fb9113a573072e42e35da4e807b310a

 

Previous:

20121103 AtherosL1cEthernet-1.2.2.zip

MD5 checksum (AtherosL1cEthernet-1.2.2.zip) = ac192399f1c3035e18a5a1e3d590e2f4

 

20121020 AtherosL1cEthernet-1.2.1.zip

MD5 checksum (AtherosL1cEthernet-1.2.1.zip) = 66ca3c478ed4b4b666c11b5fbc8ae2bd

 

20121019 AtherosL1cEthernet-1.2.0.zip

WARNING: See posts further down, this one might cause a kernel panic on certain (non-gigabit?) ethernet chips.

MD5 checksum (AtherosL1cEthernet-1.2.0.zip) = 1b13bc115b89736b2d57a24ed3743efd

 

20121008 AtherosL1cEthernet-1.1.2.zip

MD5 checksum (AtherosL1cEthernet-1.1.2.zip) = c7629574c6aefc97e17fc09a3d4aab98

 

20121003 AtherosL1cEthernet-1.1.1.zip

MD5 checksum (AtherosL1cEthernet-1.1.1.zip) = 4c78da8a9bfbb02f6e4150802fa896ac

 

20120924 AtherosL1cEthernet-1.1.0.zip

MD5 checksum (AtherosL1cEthernet-1.1.0.zip) = 7bf3cb1cff665ca0cc3dc23aebf3c286

 

 

As a final caveat, I'm mostly just throwing this driver/code out there and seeing what happens. I can't provide serious help or even guarantee a reply if things don't work for anyone. Enjoy! :)

Edited by Shailua
Great way to start a first post!!!
  • Like 8
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

I fixed a couple of bugs that were annoying me and added the new version to the first post. Everything seems to be working fine on my machine currently. Torturing the driver by pulling the plug and soforth seems okay, but sometimes stuff like the AFP server can mess up. Probably something to do with IPv6 weirdness on my LAN.

 

Any problems like this seem to usually be fixable for me by selecting the device in network preferences and selecting Make Service Inactive from the gear menu and clicking Apply, followed by making it active again in a similar fashion.

Link to comment
Share on other sites

Hi, first of all, thanks for your effort to make a better driver.

 

I've just installed 1.1.1 and it works fine. The only problem I'm still facing is the lack of Bonjour functionality, with the previous driver it work partially mainly seeing other computers, but not broadcasting to other Macs, now it seems that it's not working at all, are this working for you?

 

Thanks.

Link to comment
Share on other sites

Hello, and thank you for the feedback. It's good to know it's not just causing kernel panics on other computers. If you get a chance, I was wondering if you could tell me which Atheros ethernet type you have? It should display the name in System Information under "Ethernet Cards".

 

Bonjour problems seem to be common with this driver. The only thing I could think of at the moment was a problem in the multicast code, so I've rewritten some of it and posted it as version 1.1.2 above. Hopefully that will help, otherwise it might be an issue with either the hardware itself or the messy internals of the Linux code. Sadly I don't know much about those since there don't seem to be any hardware specifications out there on the web and as far as I can tell, the Linux driver seems to have been written by Atheros staff.

 

The other possibility is that there is a different problem unrelated to the driver. The only suggestions I can think of there would be to restart Bonjour in the terminal with:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

sudo launchctl load /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Another suggestion to try would be to turn on the PXE Boot ROM or equivalent setting in the BIOS. This sometimes helps if you're lucky.

 

I hope one of these helps. :)

Link to comment
Share on other sites

It's an AR8132, internal Ethernet.

 

Tested it today, it seems that there's some dnssd functionality working, but as before it don't work too good, It shows with Bonjour Browser that's is broadcasting a list of services, like Itunes shared music, connects and worked fine, but things like detecting the computer from a Macbook seems to be broken, it's like some services are lost on connection, to be honest I don't know.

 

Shutting down and up the dnssd service broke all the functionality.

 

Looking at the logs this came:

 

 

08-10-12 20:30:49,062 Bonjour Browser: service search error: -72000

08-10-12 20:30:49,062 Bonjour Browser: dnssd_clientstub read_all(13) failed 0/28 0

08-10-12 20:30:49,063 Bonjour Browser: service search error: -72000

08-10-12 20:30:49,000 kernel: [AtherosL1cEthernet] Multicast list set to: [1:0:5e:0:0:1] [33:33:0:0:0:fb] [33:33:65:d0:d7:1e] [33:33:0:0:0:1] [33:33:ff:c4:ee:49]

08-10-12 20:30:51,000 kernel: [AtherosL1cEthernet] Multicast list set to: [1:0:5e:0:0:1] [33:33:65:d0:d7:1e] [33:33:0:0:0:1] [33:33:ff:c4:ee:49]

08-10-12 20:30:52,599 sudo: ******* : TTY=ttys000 ; PWD=/Users/***** ; USER=root ; COMMAND=/bin/launchctl load /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

08-10-12 20:30:52,658 mDNSResponder: mDNSResponder mDNSResponder-320.16 (Jul 19 2012 21:07:07) starting OSXVers 11

08-10-12 20:30:52,707 mDNSResponder: D2D_IPC: Loaded

08-10-12 20:30:52,710 iTunes: dnssd_clientstub write_all(9) failed -1/54 32 Broken pipe

08-10-12 20:30:52,710 iTunes: dnssd_clientstub write_all(9) failed -1/28 32 Broken pipe

08-10-12 20:30:52,000 kernel: [AtherosL1cEthernet] Multicast list set to: [33:33:0:0:0:fb] [1:0:5e:0:0:1] [33:33:65:d0:d7:1e] [33:33:0:0:0:1] [33:33:ff:c4:ee:49]

08-10-12 20:30:52,000 kernel: [AtherosL1cEthernet] Multicast list set to: [1:0:5e:0:0:fb] [33:33:0:0:0:fb] [1:0:5e:0:0:1] [33:33:65:d0:d7:1e] [33:33:0:0:0:1] [33:33:ff:c4:ee:49]

08-10-12 20:30:52,711 applepushserviced: dnssd_clientstub write_all(5) failed -1/65 32 Broken pipe

08-10-12 20:30:52,712 applepushserviced: dnssd_clientstub write_all(5) failed -1/28 32 Broken pipe

08-10-12 20:30:52,712 configd: network configuration changed.

08-10-12 20:30:52,712 mDNSResponder: D2DInitialize succeeded

08-10-12 20:30:52,719 configd: network configuration changed.

08-10-12 20:30:57,721 configd: dnssd_clientstub write_all(13) failed -1/66 32 Broken pipe

08-10-12 20:30:57,722 configd: dnssd_clientstub write_all(13) failed -1/28 32 Broken pipe

 

 

Well, thanks anyway for your help.

Link to comment
Share on other sites

Sorry I wasn't able to help. Bonjour seems fine on my machine when it comes to both connecting to it from other Macs and connecting to other Macs, so it might be a quirk of the 8132. The multicast list in your logs shows [1:0:5e:0:0:fb] which is the important one for Bonjour mDNS stuff as I understand it. I'll attach to this post a version of the driver that should set itself up to receive any multicast data by setting every bit in the multicast hash table. It's a bit messy and probably won't make a difference, but it's all I can think of currently. For now I'll keep trying to clean up the code as best I can and with a little luck things may fix themselves eventually.

 

 

If you feel like rummaging through a long log file, you could follow the steps here:

https://discussions....090153#10090153

and see if you can find anything unusual.

 

Here's the modified kext:

AtherosL1cEthernet-multicast.zip

MD5 (AtherosL1cEthernet-multicast.zip) = 1138f606cdfd5da38534f8fc3ae8602d

Link to comment
Share on other sites

  • 2 weeks later...

wow, i've been waiting for updates for this kext for damn long

the previous version has a severe bug :

if I boot with the cable plugged , everything is fine

if i boot without plugging my cable, kp happened.

gonna test whether this kext work it out or not

 

Mine is AR8252 1.1

Link to comment
Share on other sites

here's the feedback.

I'm too excited to type.

Although I've found out a way to solve the problem, it's not deep down for the kext itself.

With your newly made kext, I can boot nicely without cable connected.

 

One more thing to comment, the kext is showing a lot during booting. I think that's for debug purposes.

Maybe you can add a flag in plist file to switch this function on or off.

Maybe you already have one :) haven't checked it out though. Too excited ~~~

Thanks from deep in my heart~

  • Like 1
Link to comment
Share on other sites

Thank you for the feedback! Glad to hear it's all working well. :) Yes up until now I've had debugging turned on in the kext by default. It's added with a flag passed at compile time. I've just released version 1.2.0 with debugging disabled in the main kext with a debug version still available in a subdirectory. Hopefully it still works all okay since it also adds compiler optimisations. It seemed fine for me though. In future I hope to implement a debug log system that can be toggled through the Info.plist.

 

 

 

As mentioned in the changelog, TSO and transmitted packet checksum offloading are the main changes in the new version. These should allow for transmitting files with much less strain on the CPU. Sadly from what I've read in comments in the Linux and BSD code, checksum offloading for received packets is broken at the hardware level in at least some of the chipsets. I'll have to investigate it some more to see if it is the case with all of these chipsets or just the older ones. Anyway, enjoy!

  • Like 1
Link to comment
Share on other sites

Thank you for the feedback! Glad to hear it's all working well. :) Yes up until now I've had debugging turned on in the kext by default. It's added with a flag passed at compile time. I've just released version 1.2.0 with debugging disabled in the main kext with a debug version still available in a subdirectory. Hopefully it still works all okay since it also adds compiler optimisations. It seemed fine for me though. In future I hope to implement a debug log system that can be toggled through the Info.plist.

 

 

 

As mentioned in the changelog, TSO and transmitted packet checksum offloading are the main changes in the new version. These should allow for transmitting files with much less strain on the CPU. Sadly from what I've read in comments in the Linux and BSD code, checksum offloading for received packets is broken at the hardware level in at least some of the chipsets. I'll have to investigate it some more to see if it is the case with all of these chipsets or just the older ones. Anyway, enjoy!

I appreciate you dedication for the great work!

BTW, another question. Guys are reporting they can make their AR8161 work under ubuntu.

And the code for AR8161 in linux has also released. Is it possible to make it a new kext that support AR8161 ?

 

Links : http://www.linuxfoundation.org/collaborate/workgroups/networking/alx

http://free.windows9download.net/download/atheros-ar8161-linux-driver.html

 

Thank you for the feedback! Glad to hear it's all working well. :) Yes up until now I've had debugging turned on in the kext by default. It's added with a flag passed at compile time. I've just released version 1.2.0 with debugging disabled in the main kext with a debug version still available in a subdirectory. Hopefully it still works all okay since it also adds compiler optimisations. It seemed fine for me though. In future I hope to implement a debug log system that can be toggled through the Info.plist.

 

 

 

As mentioned in the changelog, TSO and transmitted packet checksum offloading are the main changes in the new version. These should allow for transmitting files with much less strain on the CPU. Sadly from what I've read in comments in the Linux and BSD code, checksum offloading for received packets is broken at the hardware level in at least some of the chipsets. I'll have to investigate it some more to see if it is the case with all of these chipsets or just the older ones. Anyway, enjoy!

:(

tested with the 1.2.0 version

kp happened. :(

Link to comment
Share on other sites

Alas, as I mentioned here:

http://www.insanelymac.com/forum/topic/282364-need-driver-for-atheros-ar8161/page__st__20

 

There is the Linux alx driver for these chipsets but it's quite different from the atl1c driver that this kext is based on. Unfortunately I don't have any of these newer ethernet chipsets.

 

Sorry to hear about the kernel panic in the new version. I haven't had any issues myself, but I will try to hunt down the problem. If you get a chance, could you check if the debug version also causes a panic? Sometimes weird things can happen from compiler optimisations in the non-debug version. Otherwise I suspect it may be a problem in some of the data structures I shifted from the stack to the heap. I'll go over the code for any silly errors I can see when I get a chance.

 

Oh, actually I have a good idea what could be causing the issue. I added some code to save memory with the non-gigabit chips that don't support jumbo frames, but I forgot that they still receive packets larger than the standard 1500 MTU when TSO is enabled. This would cause a kernel panic from writing beyond the buffer. I'll attach another version to this post that doesn't use this space saving. Hopefully this will fix the issue for you!

 

AtherosL1cEthernet-1.2.0-test.zip

MD5 (AtherosL1cEthernet-1.2.0-test.zip) = 07726107e574c51353ef7665c30c793d

Link to comment
Share on other sites

Thanks this drivers did wonders for me! Bonjour is working perfectly. Screen sharing is work too!

how to test screen sharing ?

Do we have to install some apps to test ?

I can share but it's depending on some 3rd-party apps.

Link to comment
Share on other sites

how to test screen sharing ?

Do we have to install some apps to test ?

I can share but it's depending on some 3rd-party apps.

 

I was a bit early to celebrate, it does work from time to time. The old driver never worked, except right after restart, but this seems to work more often, but it's not reliable it seems.

 

I used the built in screen share in osx.

 

If it fails, my hack disappears from the sidebar on my MBA, but waiting a minute and retry it does connect.

Link to comment
Share on other sites

I was a bit early to celebrate, it does work from time to time. The old driver never worked, except right after restart, but this seems to work more often, but it's not reliable it seems.

 

I used the built in screen share in osx.

 

If it fails, my hack disappears from the sidebar on my MBA, but waiting a minute and retry it does connect.

 

how do you connect your MBA and hack ?

under same LAN ?

Link to comment
Share on other sites

The driver reports it as an AR8151. It's the on-board port on a GA-Z77-DS3H v1.0.

 

To date, I've had no issues. And Bonjour keeps working post-sleep, which makes Time Machine usable again.

congrats.

What version are you using ?

Link to comment
Share on other sites

Thank you for the further feedback, everybody. It's definitely useful for me to know what specific cards are working and what aren't. I've uploaded a new version that should hopefully keep a better eye on the link status and changes to it. It might help with some oddities when the card goes up/down during sleep/wake.

Link to comment
Share on other sites

Version 1.2.1, although I'll probably give the shiny new 1.2.2 a go this weekend.

I will try it too.

 

Thank you for the further feedback, everybody. It's definitely useful for me to know what specific cards are working and what aren't. I've uploaded a new version that should hopefully keep a better eye on the link status and changes to it. It might help with some oddities when the card goes up/down during sleep/wake.

two kexts inside the folder.

one in Debug one not.

Which should I use ? The one not in debug folder ?

Link to comment
Share on other sites

two kexts inside the folder.

one in Debug one not.

Which should I use ? The one not in debug folder ?

 

Provided it works okay for you, the one not in the Debug folder. The debug version is the same thing but it just prints more log information. The regular one should only print major errors if they occur.

Link to comment
Share on other sites

Provided it works okay for you, the one not in the Debug folder. The debug version is the same thing but it just prints more log information. The regular one should only print major errors if they occur.

Yep, i tested it yesterday.

My hack boots much slower after using this version. Maybe I'll compare it with previous time. Will send feed back.

Link to comment
Share on other sites

 Share

×
×
  • Create New...