Intro

This guide is meant to help you convert an old style NetBSD driver for a wifi device to the newer wifi stack based on FreeBSD's current version.

This is work in progress, as we are trying to create helper functions and libraries where usefull, and also the target API is a slightly moving target.

Overview

The main difference between old style and new style drivers is the VAP concept. VAP means Virtual Access Point, and it is used to split the configuration properties of a wlan (as visible on air) from the radio hardware. In many cases multiple wlans can be created using a single radio hardware, which is naturally modelled as multiple VAPs being created (by pure software) using the same physical radio device.

At the user level the radio hardware is hidden quite well - it only shows up in dmesg or sysctl net.wlan.devices. There is no network interface for the raw hardware, so ifconfig will not show them.

To create a VAP for a radio device (and that way a network interface) use a command like:

ifconfig wlan0 create wlandev run0

This split between common radio hardware and per-VAP network properties reflects on the driver and causes most of the changes needed.

After creation of the wlan0 VAP, it will also show up under

sysctl net.wlan.wlan0

and in ifconfig output.

More complete instructions for testing are here: Testing new wifi. There also is an older paper describing the initial design in FreeBSD: FreeBSD wireless BSDCan 2005

Help available!

If your device is a usb(4) device, you can use a new helper facility "usbwifi" similar to usbnet(9), which already handles a lot of new wifi stack specific details. In the following text the items not applicable for drivers using usbwifi are marked like this: [!]usbwifi{X} or // !usbwifi if appearing in code sections.

Step by Step at the driver level