Hello, world!

Now that you’re familiar with the if* structures and their management routines, let’s go through an example. The following function, named em_setup_interface and defined in /sys/dev/e1000/if_em.c, sets up em(4)’s ifnet and ifmedia structures. (The em(4) driver is for Intel’s PCI Gigabit Ethernet adapters.)

static int
em_setup_interface(device_t dev, struct adapter *adapter)
{
        struct ifnet *ifp;

        ifp = adapter->ifp = if_alloc(IFT_ETHER); ...

Get FreeBSD Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.