Comment 0 for bug 1761534

Revision history for this message
Eric Desrochers (slashd) wrote :

Environment: The guest VM is using a canonical ubuntu image, and the eth0 is a virtio-net adaptor, running on DPDK.

Background: "ip a" command relies on the operstate variable of the net_device structure maintained by the kernel. This is based on the operational state as defined in the IF MIB (RFC 2863). Device drivers are expected to update this member. But many older drivers don’t seem to be using this. So in general, IF_OPER_UP and IF_OPER_UNKNOWN are treated as equal, in some sense, to maintain backward compatibility. Even if we look at https://elixir.free-electrons.com/linux/v4.15-rc2/source/include/linux/netdevice.h#L3468, the function to check if interface is up, is written as follows, which says that OPER_UNKNOWN is not something to be alarmed about, and just reflective of a state that some drivers don’t care to update about.

static inline bool netif_oper_up(const struct net_device *dev)
{
return (dev->operstate == IF_OPER_UP ||
dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
}

Code Ref:

1. https://elixir.free-electrons.com/linux/v4.15-rc2/source/include/linux/netdevice.h#L1739
2. https://elixir.free-electrons.com/linux/v4.15-rc2/source/include/linux/netdevice.h#L3468
3. https://www.kernel.org/doc/Documentation/networking/operstates.txt

Now, for traditional kernel mode network adapter drivers, this state is supposed to be manipulated by the driver. And we can safely assume that most current kernel model drivers do keep this updated.