Device State
The net_device structure includes different fields
that define the current state of the device. These include:
-
flags Bitmap used to store different flags. Most of them represent a device's capabilities. However, one of them,
IFF_UP, is used to say whether the device is enabled (up) or disabled (down). You can find the list ofIFF_XXXflags in include/linux/if.h. See also the section "Enabling and Disabling a Network Device."-
reg_state Device registration state. The section "Registration State" lists the values this field can be assigned and when its value changes.
-
state Device state with regard to its queuing discipline . See the section "Queuing Discipline State."
You may find a little bit of overlap sometimes between these variables. For example,
every time IFF_UP is set in flags, _ _LINK_STATE_START is set in
state, and vice versa. Both of them are set and
cleared, respectively, by dev_open and dev_close. However, their domains are different, and a little
bit of overlap may sometimes be introduced when writing modular code.
Queuing Discipline State
Each network device is assigned a queuing discipline, which
is used by Traffic Control to implement its QoS mechanisms. The state field of net_device is one of the
structure's fields used by Traffic Control. state is
a bitmap, and the following list shows the flags that can be set. They are defined in
include/linux/netdevice.h.
-
_ _LINK_STATE_START The device is up. This flag can be checked with
netif_running. See the section ...
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