The following patch fixes the bug :

-------------------
commit bda7fab54828bbef2164bb23c0f6b1a7d05cc718
Author: Jay Vosburgh <jay.vosbu...@canonical.com>
Date:   Thu Mar 22 14:42:41 2018 +0000

    virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
    
    The operstate update logic will leave an interface in the
    default UNKNOWN operstate if the interface carrier state never changes
    from the default carrier up state set at creation.  This includes the
    case of an explicit call to netif_carrier_on, as the carrier on to on
    transition has no effect on operstate.
    
            This affects virtio-net for the case that the virtio peer does
    not support VIRTIO_NET_F_STATUS (the feature that provides carrier state
    updates).  Without this feature, the virtio specification states that
    "the link should be assumed active," so, logically, the operstate should
    be UP instead of UNKNOWN.  This has impact on user space applications
    that use the operstate to make availability decisions for the interface.
    
            Resolve this by changing the virtio probe logic slightly to call
    netif_carrier_off for both the "with" and "without" VIRTIO_NET_F_STATUS
    cases, and then the existing call to netif_carrier_on for the "without"
    case will cause an operstate transition.
    
    Cc: "Michael S. Tsirkin" <m...@redhat.com>
    Cc: Jason Wang <jasow...@redhat.com>
    Cc: Ben Hutchings <b...@decadent.org.uk>
    Signed-off-by: Jay Vosburgh <jay.vosbu...@canonical.com>
    Acked-by: Michael S. Tsirkin <m...@redhat.com>
    Signed-off-by: David S. Miller <da...@davemloft.net>
-------------------

** Changed in: linux (Ubuntu)
     Assignee: (unassigned) => Eric Desrochers (slashd)

** Changed in: linux (Ubuntu)
       Status: New => In Progress

** Changed in: linux (Ubuntu)
   Importance: Undecided => Medium

** Also affects: linux (Ubuntu Bionic)
   Importance: Medium
     Assignee: Eric Desrochers (slashd)
       Status: In Progress

** Also affects: linux (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Also affects: linux (Ubuntu Artful)
   Importance: Undecided
       Status: New

** Changed in: linux (Ubuntu Artful)
     Assignee: (unassigned) => Eric Desrochers (slashd)

** Changed in: linux (Ubuntu Xenial)
     Assignee: (unassigned) => Eric Desrochers (slashd)

** Changed in: linux (Ubuntu Artful)
   Importance: Undecided => Medium

** Changed in: linux (Ubuntu Xenial)
   Importance: Undecided => Medium

** Changed in: linux (Ubuntu Artful)
       Status: New => In Progress

** Changed in: linux (Ubuntu Xenial)
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1761534

Title:
  "ip a" command on a guest VM shows UNKNOWN status

Status in linux package in Ubuntu:
  In Progress
Status in linux source package in Xenial:
  In Progress
Status in linux source package in Artful:
  In Progress
Status in linux source package in Bionic:
  In Progress

Bug description:
  It has been brought to my attention the following :

  ------------------------------------------------
  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.
  ------------------------------------------------

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1761534/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to