This is part of larger project for new interface driver KPI, and
it will cut away usage of superfluous struct ifnet from WiFi
All WiFi drivers create a device(9), and an ifnet(9). Then interface
cloning operation creates another ifnet(9) of wlan(4), which acts
as actual interface. All userland applications issue ioctls, read
statistics and run packet capture on the wlan(4), not on the
The patch cuts down the ifnet(9) from drivers. Right now only iwn(4)
is converted. I will seek for testers and convert other drivers.
But before I'd like to get reviewed the base concept.
Changes to the stack:
o Struct ieee80211com is the single gateway between stack and driver:
- packets are sent via new ic_transmit method, which is very much like the previous if_transmit.
- bringing parent up/down is done via new ic_parent method
- device specific ioctls (if any) are received on new ic_ioctl method
- struct ieee80211com lives in the driver softc
o ieee80211_ifattach() registers an ieee80211com on global list
o wlan cloner seeks for specified parent on the global list
o VAP interface mac address isn't a copy, but a pointer. It points either to original mac address in ieee80211com, or if wlanX address is changed, then to IF_LLADDR of own interface.
o Handling of promisc and allmulti is done by accounting number of VAPs in given state.
Changes to a driver (iwn(4) provided as tested example):
o Don't create interface: if_alloc, if_attach, if_free.
o Convert IFF_DRV_RUNNING into internal flag in softc. Use it under driver lock always.
o Convert SIOCSIFFLAGS code into ic_parent method.
o Leave if_ioctl method to ic_ioctl if there are any driver specific ioctls, otherwise delete it.
o Convert interface start/transmit method to ic_transmit method.
- As option use mbufq.
o Go through all functions and change initialization of struct ieee80211com pointer. It used to be ifp->if_l2com, now it lives in softc.
- Properly update vap packets/errors statistics if vap is known.
- If vap is unknown, increase ic_ierrors/ic_oerrors.
- TX stats are done on TX completion, in ieee80211_tx_complete()
Changes to /etc:
o Although the startup sequence didn't change: ifconfig wlan0 wlandev iwn0, wpa_supplicant, etc..., the rc.d needs extra care. The problem is that rc.d explicitly checked presence of the parent in 'ifconfig -l'. XXX: The rc.d diff needs extra polishing.