]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: support device stats collection for <interface type='hostdev'>
authorzhenwei pi <pizhenwei@bytedance.com>
Thu, 15 Oct 2020 11:21:14 +0000 (19:21 +0800)
committerLaine Stump <laine@redhat.com>
Tue, 20 Oct 2020 21:29:29 +0000 (17:29 -0400)
commitb295f06da496aa8d8c8f660d4f02946d25203861
treeca7a2f3550344e731f621aa9e228353409420f0b
parentb79abf9c3cdab8bcecfa8769629a4cdf4bf0b6c3
util: support device stats collection for <interface type='hostdev'>

libvirt can retrieve traffic stats for emulated interfaces that are
backed by tap or macvtap devices, but this information wasn't
available for hostdev interfaces (those that are implemented by
assigning an SR-IOV VF device to a guest using vfio):

  #virsh domifstat instance --interface=52:54:00:2d:b2:35
  error: Failed to get interface stats instance 52:54:00:2d:b2:35
  error: internal error: Interface name not provided

For some SR-IOV VF devices this information is available via the
netlink VFINFO_LIST request/response, and that is what this patch uses
to implement stats retrieval for VF. Not that this is dependent on
support in the PF driver - for example, the Mellanox ConnectX-4 Lx
(mlx5) driver reports usable stats, while Intel 82599 (ixgbe) and
82576 (igb) just report all stats as 0.  (this is the same result as
"ip -s link show").

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/libvirt_private.syms
src/qemu/qemu_driver.c
src/util/virnetdev.c
src/util/virnetdev.h