After some research on Intel SR-IOV, I've realized that there is no convenient way to get the VF counters while VF interface is being attached to a VM (for example to a QEMU/KVM VM with a Libvirt manager). Furthermore, I didn't find even an inconvenient way to do it, because as soon as VM is being created on a HOST and it is bound in configuration to some VF interface(this is the main use case of SRI-OV VFs), the interface is automatically being detached from the HOST and attached to the VM (I think that it is done on purpose in order to allow passthrough to bypass the kernel or something), and there is actually no way that I found yet to find the counters of the VF used by the attached VM on the HOST(I'm using Ubuntu 16.04 and I've tried looking for counters on VF ports, with ethtool -S
on the PF interface but with no avail), those counters may be actually very helpful in various situations. It would be really helpful if someone who has some experience in dealing with SRIOV could shade some light on this issue and tell me I'm wrong and that there is a simple way.
Thanks!
Update:.
Actually I found that ethtool -S
might be useful, it let you see the TX/RX queue counters of the nic, and I found that VF function driver ixgbevf uses exactly one different pair of TX/RX queues for each VF. And they are being assigned in increasing order, so it might be possible to do a mapping. But unfortunately it's an ugly and driver dependent solution.