Sunday, September 11, 2011

Wireless update - 802.11n development

A few of us have been working towards 802.11n support in FreeBSD. Bernhard Schmidt and I were hoping to get 802.11n support up to scratch before 9.0-RELEASE but a combination of timing constraints and work constraints has hampered things somewhat.

But that said, we the net80211 support for 802.11n is in a lot better shape than it was in previous releases. Bernhard has been working out the kinks in the intel driver (if_iwn) and has 802.11n support mostly stable for those NICs. Someone else has been working on if_ral 802.11n support and has had quite a bit of success there. And I've been working on if_ath/ath_hal support.

(As a side-note, I've ordered some Marvell if_mwl compatible NICs to do some testing with.)

The 802.11n support in the FreeBSD atheros driver is already mostly usable for testing - 802.11n TX and RX works, but 802.11n TX aggregation doesn't work. So if you'd like to test it out in 9.0-RELEASE, you can do this:

* build a kernel with "options ATH_ENABLE_11N";
* ifconfig wlan0 -ampdutx
* associate as per normal to an 802.11n network.

Your download speeds will be good (as RX aggregation works) but as TX aggregation doesn't, you won't be getting full speed.

Now, as for the current work I'm doing. I've been porting over (and reimplementing in places) the 802.11n TX aggregation support, based on a combination of the atheros reference/carrier codebases and what's filtered through to the Linux ath9k driver.

In short - so far, so good. There's a lot to do, but basic TX aggregation is working in both station and hostap mode. My current test setup is:
  • A routerstation pro with an AR9160 NIC, running locally built firmware (FreeBSD) in hostap mode;
  • An EEEPC 701 retrofitted with an AR9280 NIC, running FreeBSD, as a station;
  • My macbook pro (broadcom 802.11n) as a station.
So far it's performing well - 200mbit TX/RX UDP in 5ghz HT/40 2x2 stream mode; and 130-140mbit TX/RX TCP.

I'm currently doing the work in a FreeBSD user svn branch. The details are in the Wiki - . I currently have exactly one tester (AR5416 STA, AR9280 hostap) who is reporting excellent success. I'd obviously like a few more. :)

There's still a lot of work to be done before this can be merged into HEAD. I'm sorry to say it won't happen before 9.0-RELEASE as there are some upcoming net80211 changes which will be rather intrusive and a bit risky to throw into the release at this late stage. It may also be difficult to backport as some changes will break kernel ABI.

But don't let anyone tell you FreeBSD doesn't support 802.11n. 9.0-RELEASE may not have much support, but all the key pieces are there. Once the release has been cut, I'll do some chasing up to get the Intel, Marvell and Ralink 802.11n support updated. (If someone would like to take charge of the broadcom NIC drivers, please drop freebsd-wireless@ a line.)

The next 6 months will be very interesting in the FreeBSD 802.11 world. :)

Finally, none of this current work would've been possible without the support of the sponsor paying me to get FreeBSD's net80211 and ath support updated - Hobnob, Inc. They contacted me a few months ago to help work out kinks in the Atheros NIC they're using in FreeBSD and seem impressed enough by my work to sponsor general net80211/ath improvements which they'll likely roll into future products. So when you're using Atheros 802.11n hardware in FreeBSD and getting that nice 140-150mbit TCP throughput, please give them thanks. :)

And finally finally, Qualcomm Atheros and the Linux ath9k developers have been instrumental in this work. The documentation, reference code and general interactive discussions have allowed me to get all of this work done in such a short period of time. (Yes, I did say "Atheros", "Documentation" and "Source Code" there, in the context of open source. Honest.)


  1. Awesome, keen to try this with my AR5008 once 9 goes stable.

  2. The 11n TX aggregation work won't be in -9, at least not yet. It'll likely land in -HEAD shortly after the -9 branch is made.

    If I ever backport it to -9, it'll be at least 6 months after it's stabilised in -HEAD. Sorry, but there's just a lot of API changes that are needed that will likely break wireless ABI/KBI in 9.

  3. Thanks for your efforts Adrian, much appreciated. Looking forward to being able to use your work, and to get it into pfSense so many thousands of others can too.

  4. Thanks Chris.

    I'm scared by the prospect of thousands of potential users when there's only me working on it.

    What FreeBSD really needs (and me, as well) is some more active developers testing and hacking on this stuff. There's plenty of things that need doing, but only me working on it.

  5. I don't see any mention of my beloved ar9170-based usb dongle. What's the likelihood of it working as well?

  6. I don't have time to try and also port the AR9170 code from openbsd/linux at the present time.

    I'm focusing on finding/fixing all the weird issues that creep up in supporting 11n on the existing atheros NICs.

    I'm happy to help out whoever would like to give it a shot though.

    I'm sorry to disappoint, but my personal view is "Fix what you have before you try to add more. Or you'll likely just keep adding half working stuff." This is in stark contrast to other projects. :)

  7. Hey, it was worth a shot. My tplink wn821n is a solid device in win and in linux, unlike the rtl 8187 (urtw) device I have to use in freebsd.. I want to be able to take this rtl8187 that I am currently using, and use it for target practice instead. heh

  8. Well, the best way to get it done is to do it yourself, or find someone who can do it with you. :)

    I'd personally love to see AR9170 support show up in FreeBSD. It's a self-contained driver (ie, it doesn't need to try and fit into ath/ath_hal) which shouldn't be too difficult to port.

    The newer stuff - AR7010 USB + (AR9280, AR9285, AR9287, AR9271) is likely a bit more difficult as it'll need to use the ath_hal code. I can do the HAL side of things but someone will have to write the USB driver side. Hence, if someone ports the AR9170 and gets familiar with how that works they can likely then help out getting the other Atheros USB NICs working. :)

  9. i want to test broadcom drivers with my bcm4313

  10. If you need one new tester for ath0 implementation please give the post under mine. For now:
    FreeBSD 9.0-CURRENT FreeBSD 9.0-CURRENT #10: Sat Mar 3 09:19:30 CET 2012 i386

    I've been trying your work, but I didn't get success ;/ My server "freezes" and doesn't print any "suspecting" errors.
    I hope you need new tester ;]