Before diving into the specifics of what you need to be do to write a network driver, it may be helpful to see the basic functions which you need to override. These descriptions are meant to give you an idea of what is entailed in creating a very simple network driver.
startThe start function should initialize the device to a working state. It also needs to create a network object and make it visible to the networking stack as an interface.
stopThe stop function must free anything allocated in start and also release the network object created in start.
enableAs mentioned in “Tips on Bringing Up a UNIX Network Driver,” the enable function is run when the system sets the driver’s status to up. This function is also responsible for starting the hardware’s transmit and receive capabilities. It should inform the system about the link status of the hardware.
disableThe disable function releases anything allocated, and stops any functions started in enable.
getHardwareAddressThe getHardwareAddress function returns the MAC address of the network device.
outputPacketThe outputPacket function sends the packet to the hardware for transmission. It will be called from multiple threads, so it needs to be thread-safe.
Each of these functions are described in more depth further in this chapter.
Last updated: 2008-03-11