With availability of switchdev model in linux, it is possible to capture stats for SR-IOV device with interface_type as 'hostdev' provided device supports VF represontor in switchdev mode on host.
These stats are supported by adding helper APIs for getting/verifying VF representor name based on PCI Bus:Device:Function information in domains 'hostdev' structure and querying required net sysfs directory and file entries on host according to switchdev model. These helper APIs are then used in qemu/conf to get the interface stats for VF representor of pci SR-IOV device. V4 includes changes based on feedback received for v3 patchset. Added new generic API for linux is added to fetch stats from /proc/net/dev which will be used by tap and hostdev devices. Also introduced new API to retrieve net def from given domain based on the given hostdev which supports network. [1] https://www.kernel.org/doc/Documentation/networking/switchdev.txt V3: https://www.redhat.com/archives/libvir-list/2018-April/msg00306.html Jai Singh Rana (6): util: Add helper function to clean extra spaces in string util: Add generic API to fetch network stats from procfs util: Add helper APIs to get/verify VF Representor name conf: util: Add API to find net def given its domain's hostdev qemu: Network stats support for VF Representor docs: Update news about Network stats support for VF Representor docs/news.xml | 9 ++ po/POTFILES | 1 + src/conf/domain_conf.c | 43 +++++++ src/conf/domain_conf.h | 2 + src/libvirt_private.syms | 11 ++ src/qemu/qemu_driver.c | 34 ++++- src/util/Makefile.inc.am | 2 + src/util/virhostdev.c | 4 +- src/util/virhostdev.h | 11 ++ src/util/virnetdev.c | 202 ++++++++++++++++++++++++++++- src/util/virnetdev.h | 5 + src/util/virnetdevhostdev.c | 300 ++++++++++++++++++++++++++++++++++++++++++++ src/util/virnetdevhostdev.h | 34 +++++ src/util/virnetdevtap.c | 71 +---------- src/util/virstring.c | 36 ++++++ src/util/virstring.h | 3 + 16 files changed, 691 insertions(+), 77 deletions(-) create mode 100644 src/util/virnetdevhostdev.c create mode 100644 src/util/virnetdevhostdev.h -- 2.13.7 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list