Enabling and Disabling a Device
A device can be considered enabled when the _
_LINK_STATE_START flag is set in net_device->state. The section "Enabling and Disabling a Device" in Chapter
8 covers the details of this flag. The flag is normally set when the device is
open (dev_open) and cleared when the device is closed
(dev_close). While there is a flag that is used to
explicitly enable and disable transmission for a device (_
_LINK_STATE_XOFF), there is none to enable and disable reception. That
capability is achieved by other means—i.e., by disabling
the device, as described
in Chapter 8. The status of the _ _LINK_STATE_START flag can be checked with the netif_running function.
Several functions shown later in this chapter provide simple wrappers that check the
correct status of flags such as _ _LINK_STATE_START to
make sure the device is ready to do what is about to be asked of it.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access