tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bwi(4): Broadcom AirForce BCM43xx IEEE 802.11b/g wifi driver



(I'm not sure whether this is the right list for the subject, so
please let me know whether there is a better place.  Also, I'm not
subscribed to this list, so please cc me in replies.)

A day or two ago I began what I later learned to be at least the third
independent effort to port bwi(4) from OpenBSD and DragonFlyBSD to
NetBSD.  Personally I just want wifi to work on my PowerBook G4, and I
seem to have accomplished that, without any obvious user-visible
deficiencies remaining (e.g., kernel panics on boot; I'm sure there
are bugs left, of course).  But I imagine that others might find such
a driver useful as well.

Caveat: I know very little about 802.11 or about writing NetBSD device
drivers; this is my first attempt at it, and undoubtedly I have made
many atrocious errors.  I don't know whether the AMRR support, which
was inherited from OpenBSD, makes any sense at all.  I have yet to try
it with WEP/WPA/WPA2 or anything; my probably vain hope is that
NetBSD's generic 802.11 support, with which I have naught but the
slightest passing familiarity, will manage to handle it by default in
ieee80211_input and when the driver calls ieee80211_crypto_encap, even
if the hardware has some built-in crypto functionality.  When I am
next near a private network of which I am aware I'll try it myself.

There are now exactly ninety nine XXX's, of which little over half are
mine, in a file of nearly ten thousand lines; the other half were
ported from OpenBSD and DragonFlyBSD.  Some that I added are remarks
about idioms that I have superstitiously cargo-culted from other wifi
drivers such as wi(4) and iwi(4).  Some are about splnetting -- I
don't know the intricacies of when to and when not to splnet.  Some
mark AMRR-related code, which was inherited from OpenBSD's driver, and
which was commented out because it was buggy (it didn't allocate
enough space for the AMRR data in ieee80211_node structs) and
uncommented when I think I fixed the issue.

I ported the driver to NetBSD 4.0_STABLE, since that's what my
PowerBook G4 is currently running.  I've also made some modifications
necessary to make it build in -current (to add a flags argument to
`callout_init', and to substitute void * for caddr_t), but I haven't
tested that except by briefly booting up my PowerBook in single-user
mode and sending a few ICMP packets to another machine.  Adding pmf
support may be a matter of calling `pmf_class_network_register', or it
may be more involved -- I don't know.

I've put up patches that apply cleanly to relatively recent netbsd-4
and HEAD (which is not hard since the only existing files that are
modified are sys/conf/files and sys/dev/pci/files.pci, but they
compile, too, and boot for me):

<http://mumble.net/~campbell/nbsd/nbsd4-bwi.patch>
<http://mumble.net/~campbell/nbsd/nbsd-current-bwi.patch>

(Gzip'd patches are also there if you'd like something slightly
smaller -- affix `.gz' to the ends of the URIs.)

I'd like to know whether anyone is interested in any of

- testing this with anything beyond a PowerBook G4's internal AirPort
  Extreme card,

- porting and testing the original driver's cardbus support, which I
  didn't do because I don't have any relevant hardware to test, or

- letting me know what grievous errors I have made in my attempt to
  port this driver.

Here's what one adds to one's kernel configuration after applying the
patch:

bwi*    at pci? dev ? function ?        # Broadcom AirForce BCM43xx 802.11b/g

At <http://leaf.dragonflybsd.org/~sephe/bwi/v3.tbz> one will find
firmware, which should be extracted into one of the usual firmware
directories.

It would be very nice if this hardware were supported out of the box
for the next user who comes along, but that thought is probably
far-fetched at the moment.  I'll keep using it on my PowerBook,
anyway.


Home | Main Index | Thread Index | Old Index