Porting Network Device Drivers from FreeBSD
This is a work in progress from my attempt to port FreeBSD's BXE driver to SmartOS.
Please feel free to add missing pieces or correct anything.
Correlations between FreeBSD to Illumos¶
| Purpose | FreeBSD | Illumos |
|---|---|---|
| Standard Interface for loading/unloading | device_if | modctl |
| Bus Interface | bus_if | ddi / devops |
| PCI Interface | pci_if | pci/pcie |
On FreeBSD¶
- bus_space_read_N (write N Bytes) -> ddi_getB (B in Bits)
- bus_space_write_N (write N Bytes) -> ddi_putB (B in Bits) ie. bus_space_read_4 -> ddi_get32\
- struct ifnet -> ?
Structures you need for Illumos GLDv3 Driver¶
cb_ops_t(ddi.h- entry points for character device)dev_ops_t(devops.h- entry points for probe, attach, detach, reset, etc...)mac_callbacks_t(frommac_provider.h)mac_register_t(frommac_provider.h)
Important types¶
ENUM mac_propid_t(mac.hincluded bymac_provider.h- MAC properties that can be read/set viadladmsuch asLinkState)ENUM mac_capab_t(mac_provider.h- MAC capabilities such asHCKSUM,LSO, etc...)