LAN Driver, Qualcomm Atheros AR8171



  • Hi,

    Have been hunting around for a while now, pulling my hair out … :-(. Has anyone found a driver for an Atheros AR8171. It's on my MB, ASRock H81M-ITX.

    Thanks!!!


  • Netgate Administrator

    There is a development driver here:
    https://github.com/markjdb/alx-freebsd
    You would have to compile it yourself and add the kernel module. Not sure what it would compile against though, FreeBSD 10 probably.

    Steve



  • Thanks very much! Checked it out, compiled it … and it works.

    Much appreciated!



  • That's good news.i could have the same issue if i bypass the install issue i have.
    Can you make some performance test with this "beta" driver just to know how it goes ?
    Thx



  • You bet! I installed the driver, and tested iperf through the pfSense box … both UL (LAN to WAN), and DL (WAN to LAN). Here is what I saw ...

    • UL ~ 430 Mb/s
    • DL ~ 600 Mb/s

    This is on a GE network, that I have benchmarked before up to pretty close to 1 Gb/s. But overall, quite good it seems - feel free to disagree though.


  • Netgate Administrator

    What CPU is that throughput data using?

    Which pfSense version? Did you compile it against FreeBSD 8.3?

    Steve



  • Hi,

    This is on pfSense 2.2, compiled on FreeBSD 10.

    Sorry, do you mean the CPU load during the test? I admit, didn't monitor that (but I think this may be limiting iperf overall).

    Thanks.


  • Netgate Administrator

    I meant what actual CPU are you using. Looking at your board I would expect almost any compatible CPU to be capable of routing at >1Gbps in which case 600Mbps doesn't look that great. I guess the driver is non-optimal, still a lot better than not working at all.  ;)

    Steve



  • Hi,

    I didn't put a great processor in it - just a Pentium G3220. Was trying to build a fairly inexpensive box. But even that is a 3 GHz processor, so you may very well be right.

    I did notice that the driver is logging a lot to syslog. I can remove this, and try again … make sense? But ... I don't have a box on the WAN side anymore that runs iperf ... I can install it on the pfSense box, and have it terminate there, but - will it make a difference if I use the WAN or LAN IP address?

    Thanks!



  • FYI, recompiled, reinstalled the driver (and rebooted) … and retested. I'm now getting ~ 930 Mb/s, so life is good ... :). I'll be honest though, not sure how to tell if I'm going through the WAN port or not. I am targeting the WAN IP address (from the LAN side), but not sure if it really gets there ... :(.

    Thanks.



  • Hi arrmo.

    Congrat's on getting this working!

    I also have this board and would love to run with the single onboard nic (using VLANs).

    Can you please post the driver and some instructions (or links) to get this working?

    Thanks a heap!



  • Absolutely! More than happy to help out if I can. Is there a place to post the file? I can't attach it here (not of the allowed file types).

    Thanks.


  • Netgate Administrator

    Just re-name the file, add .png to the end. Don't use the .txt extension as that confuses some browsers and corrupts the file.

    That driver appears to still be in active development, the last commit was only 19days ago, so check back if you find any bugs.
    Edit: Nothing major changed since Dec last year though.

    Steve



  • Excellent!

    wikisend.com looks good for small files - no reg. needed.

    or as Steve suggested, rar it, then rename to .png and add it to a post here.



  • Hi,

    You bet - attached here … just remove the .png from the end (real name is if_alx.ko).

    Yes, it's active. I actually spoke to the author before building my driver, asked him to remove some of the console diagnostics (which he very graciously did - very helpful guy!). Let me know if you have any issues with this driver.

    Thanks.

    if_alx.ko.png



  • Thanks.

    Do you have a linky or pointers on how to install/use the driver?

    I am new to freebsd o/s….guess i can google but all help appreciated.

    Thanks.



  • ok, found some instructions…but get this error... :-\

    
    [2.1.4-RELEASE][root@pfSense.localdomain]/root(1): kldload /boot/kernel/if_alx.ko
    kldload: can't load /boot/kernel/if_alx.ko: Exec format error
    
    [2.1.4-RELEASE][root@pfSense.localdomain]/root(3): uname -a
    FreeBSD pfSense.localdomain 8.3-RELEASE-p16 FreeBSD 8.3-RELEASE-p16 #0: Fri Jun 20 13:19:29 EDT 2014     root@pf2_1_1_amd64.pfsense.org:/usr/obj.amd64/usr/pfSensesrc/src/sys/pfSense_SMP.8  amd64
    [2.1.4-RELEASE][root@pfSense.localdomain]/root(4):
    
    

    and this in dmesg

    KLD if_alx.ko: depends on kernel - not available or version mismatch
    linker_load_file: Unsupported file type
    
    

  • Netgate Administrator

    Because:
    @arrmo:

    This is on pfSense 2.2, compiled on FreeBSD 10.

    You can't use this module on 2.1.X because that's built on FreeBSD 8.3 as you've seen. Also it has to be the correct architecture, 32 or 64bit. I'm not sure what the module is.

    Steve



  • Bugger, missed that very important piece if information.

    Ok, soooo, what's involved in compiling on 8.3?  Can I do this from pfsense (without downloading bucketloads of extra bloat) or do I need to have a freebsd install to compile?

    Perhaps I should just cop the extra watts from my pcie Intel nic and run with that…


  • Netgate Administrator

    No, there are no build tools in pfSense and trying to add them will be a disaster. Use FreeBSD 8.3 to build things for pfSense. I have used a bsd live cd to compile simple things before.
    I imagine you would have difficulty compiling this kernel module against 8.3 though, a lot has changed between that and 10. Probably easier to take the power hit.  ;)

    Steve



  • Hi,

    Steve has it right - and this is basically what I did (created a VM in VirtualBox, built it there).

    FYI, as I missed this above (sorry!), this is an x64 driver.

    Thanks.



  • Thanks guys.

    Might park this one for the moment as time is precious for me at the moment and go with the Intel PCIe nic card for now.

    Perhaps we'll see it come standard in a later pfsense release ;)



  • Hi arrmo,

    I dad some issues with my PCI wifi card so I decided to take the plunge and move to 2.2 ALPHA.

    The driver installed without issues (just temporarily loaded it using kldload).

    I can not create a VLAN on the alx0 interface.

    Can you pls. check to see if you can create VLANs on your interface?

    EDIT: looking at the nic with ifconfig, it's not supported…ie does not show  VLAN_HWTAGGING


  • Netgate Administrator

    You don't need to have hardware tagging on the NIC to use VLANs it just offloads some work from the driver/CPU. In fact in some cases VLANs work better with it disabled. For example: https://redmine.pfsense.org/issues/2577

    The driver has to know how to handle VLANs though, perhaps this doesn't yet. It's a development driver.
    Edit: A quick glance through the code seems to show plenty of VLAN references.

    Steve



  • Hi Stephen.

    Thanks for the reply (and for trawling the code).

    Unfortunately the interface still does not show as a valid interface when defining VLAN's (em0 does, but not the alx).



  • hi there I got the asrock h81m-itx

    thx for the driver arrmo

    anyone know how to inject the driver into pfsense for install? never compile anything. anyone can point me into the right direction. plan to add a intel nic to the pci-e of the board and that will give me to two nic as I need :D


  • Netgate Administrator

    Easiest way to get this installed would be to add the Intel NIC first and use that as the only assigned interface. Then add the new driver and the Atheros NIC will be seen. You can always change the NIC assignment afterwards if you prefer. Alternatively you can probably put the driver on a USB stick, mount the stick and copy it across manually.

    Steve



  • Hi,

    It seems that alx is now officially supported in FreeBSD (see https://github.com/markjdb/alx-freebsd/commit/74500d38295e6a9c6e476ecab7be7a052b9620da).

    But this doesn't seem to be in the latest v2.2-RC … is there a reason why not?

    Thanks!


  • Netgate Administrator

    Because it didn't make it into stable before the cut-off for 10.1 unfortunately.
    You can still compile the newer kernel module from 10-stable and override the in kernel driver in 10.1 though.

    Steve



  • Hi,

    Thanks for the info! Asking more, only because I'm trying to understand - not meant to be negative at all, please don't take it that way.

    Here is the change for 10 (right?) … http://freshbsd.org/commit/freebsd/r273366. Isn't this before the 10.1 cutoff? Or perhaps not, again - trying to understand.

    I'd be more than happy to build the new module, just not sure where to get it from ... :(.

    Thanks!!!


  • Netgate Administrator

    So stable was copied to releng for 10.1 on the 3/10/14:
    https://svnweb.freebsd.org/base?view=revision&revision=272461

    A few weeks before the support was added to alc(4). It's not in 10.1:
    https://svnweb.freebsd.org/base/release/10.1.0/sys/dev/alc/if_alc.c?view=markup

    Hence it's not in pfSense 2.2.
    I imagine it would very easy to include it if some key piece of hardware was using the AR8171 but I doubt you'd be able to persuade the devs to put it into 2.2 now we're in RC.

    If there's an ISO for a 10-stable snapshot available you can just boot that up (in a VM perhaps) and build the kernel module. If not you may have to copy the more recent code into a 10.1 install and build there instead.
    Once you have the updated kernel module copy it to /boot/modules in the pfSense and add the line:

    if_alc_load="yes"
    

    To the file /boot/loader.conf.local
    That will load the module at boot time and override the in kernel driver. Hopefully!  ;)

    Steve



  • Makes sense, and thanks for taking the time to explain - much appreciated!

    I did have a VM for FreeBSD, that's how I built the "older" alx driver (earlier in this thread). I say "did" because I removed it earlier today, it was having all sorts of issues … :(. But the older driver works, not much reason to build a newer add-on, just thought I could perhaps remove the extra file (and use the driver in the kernel).

    Thanks again!



  • Hello,
    maybe i just misunderstood some point of the conversation (I'm really new to FreeBSD), but I'm really struggling with that driver. I'm using pfSense 2.1.5 so I can't take the mere driver you've attached on one of your answer (exec format error if I try to kldload it). So I installed a VM with FreeBSD 8.3 to compile it but I end with a load of errors :
    Warning: Object directory not changed from original /root/alx-freebsd-master
    cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I@ -I@/contrib/altq -finline-limit=8000 –param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -g -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone  -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow  -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -c if_alx.c
    In file included from if_alx.c:54:
    alx_hw.h:512: error: expected specifier-qualifier-list before 'bool'
    alx_hw.h:604: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:606: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:606: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:608: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:616: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:624: error: expected '=', ',', ';', 'asm' or 'attribute' before 'alx_phy_configed'
    alx_hw.h:626: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:627: error: expected declaration specifiers or '...' before 'bool'
    alx_hw.h:656: error: expected '=', ',', ';', 'asm' or 'attribute' before 'alx_get_phy_info'
    if_alx.c: In function 'alx_identify_hw':
    if_alx.c:479: error: 'struct alx_hw' has no member named 'ptrn_ofs'
    if_alx.c:480: error: 'struct alx_hw' has no member named 'max_ptrns'
    if_alx.c:482: error: 'struct alx_hw' has no member named 'ptrn_ofs'
    if_alx.c:483: error: 'struct alx_hw' has no member named 'max_ptrns'
    if_alx.c: In function 'alx_init_sw':
    if_alx.c:530: error: 'struct alx_hw' has no member named 'sleep_ctrl'
    if_alx.c:535: error: 'struct alx_hw' has no member named 'link_up'
    if_alx.c:535: error: 'false' undeclared (first use in this function)
    if_alx.c:535: error: (Each undeclared identifier is reported only once
    if_alx.c:535: error: for each function it appears in.)
    if_alx.c:536: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:537: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c:538: error: 'struct alx_hw' has no member named 'adv_cfg'
    if_alx.c:541: error: 'struct alx_hw' has no member named 'flowctrl'
    if_alx.c:550: error: 'struct alx_hw' has no member named 'is_fpga'
    if_alx.c: In function 'alx_reset':
    if_alx.c:944: error: 'bool' undeclared (first use in this function)
    if_alx.c:944: error: expected ';' before 'phy_cfged'
    if_alx.c:951: error: 'phy_cfged' undeclared (first use in this function)
    cc1: warnings being treated as errors
    if_alx.c:951: warning: implicit declaration of function 'alx_phy_configed'
    if_alx.c:951: warning: nested extern declaration of 'alx_phy_configed'
    if_alx.c:953: error: 'struct alx_hw' has no member named 'hib_patch'
    if_alx.c:953: error: too many arguments to function 'alx_reset_phy'
    if_alx.c: In function 'alx_update_link':
    if_alx.c:965: error: 'bool' undeclared (first use in this function)
    if_alx.c:965: error: expected ';' before 'link_up'
    if_alx.c:973: error: 'link_up' undeclared (first use in this function)
    if_alx.c:973: error: too many arguments to function 'alx_get_phy_link'
    if_alx.c:977: error: 'struct alx_hw' has no member named 'link_up'
    if_alx.c:981: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c:981: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:982: error: 'prev_link_up' undeclared (first use in this function)
    if_alx.c:982: error: 'struct alx_hw' has no member named 'link_up'
    if_alx.c:984: error: 'struct alx_hw' has no member named 'link_up'
    if_alx.c:989: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:990: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c:990: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:992: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c:992: error: too many arguments to function 'alx_post_phy_link'
    if_alx.c:993: error: too many arguments to function 'alx_enable_aspm'
    if_alx.c:998: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:999: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c:1010: error: too many arguments to function 'alx_configure_rss'
    if_alx.c:1011: error: 'false' undeclared (first use in this function)
    if_alx.c:1011: error: too many arguments to function 'alx_enable_aspm'
    if_alx.c:1012: error: too many arguments to function 'alx_post_phy_link'
    if_alx.c: In function 'alx_media_status':
    if_alx.c:1231: error: 'struct alx_hw' has no member named 'link_up'
    if_alx.c:1238: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:1247: error: 'struct alx_hw' has no member named 'link_duplex'
    if_alx.c:1251: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c:1263: error: 'struct alx_hw' has no member named 'link_speed'
    if_alx.c: In function 'alx_start_locked':
    if_alx.c:1388: error: 'struct alx_hw' has no member named 'link_up'
    if_alx.c: In function 'alx_attach':
    if_alx.c:1437: error: 'bool' undeclared (first use in this function)
    if_alx.c:1437: error: expected ';' before 'phy_cfged'
    if_alx.c:1478: error: 'phy_cfged' undeclared (first use in this function)
    if_alx.c:1480: error: 'struct alx_hw' has no member named 'hib_patch'
    if_alx.c:1480: error: too many arguments to function 'alx_reset_phy'
    if_alx.c:1490: error: 'struct alx_hw' has no member named 'adv_cfg'
    if_alx.c:1490: error: 'struct alx_hw' has no member named 'flowctrl'
    if_alx.c:1514: warning: implicit declaration of function 'alx_get_phy_info'
    if_alx.c:1514: warning: nested extern declaration of 'alx_get_phy_info'
    *** Error code 1

    Stop in /root/alx-freebsd-master.

    I alos tried to recompile the kernel of the VM adding "device miibus" and "device alc" in the kernel config, but when I try to load the generated driver in pfSense, it tells me that it is already existing (which is true after verifying with kldstat -v). So I tried to stop it to be able to put the new driver (kldunload), the fact is it merely freeze the system and I can't do anything ecept reloading my ssh connection to the pfSense machine (it freezes the system even if I work on it with a keyboard and a screen). I'm quite sure I'm doing something wrong, but I can't figure what. Any suggestion ?



  • Hi,

    The VM that I used to build it was PC-BSD … a completely separate machine (with all the needed build tools, those don't come with pfSense).

    Hope that helps!



  • Hi arrmo,
    thx for your help, I tried to compile the driver under PC-BSD, it compiled but when I try to load the module on pfSense I have a Exec Format Error.
    Edit : my fault, I do not have taken the PC BSD release corresponding to FRee BSD 8.3 but the latest. I will try again tomorrow.



  • Hi,
    I finally suceeded compiling the driver under FreebSD 8.3 on VM, including stdbool.h in alx_hw.h. My Atheros AR8171 is now recognized by pfSense. Thanks for your help :)



  • Excellent, glad to hear it. Have fun!



  • Well, maybe I've spoken too fast… The ethernet interface is recognized, but trying to connect it, I see "statuts : no carrier" when I do a ifconfig on alx0, even if it's directly plugged to a SFRBox with a ethernet wire. I will continue to search why I have this issue


  • Netgate Administrator

    Hmm, disappointing. Do you see link leds at either end?



  • Yes, leds are ON on the box and the pfSense, blinking from time to time.


Log in to reply