[libvirt] Support interface network stats for SR-IOV in Switchdev mode(VF representors)

Jai Singh Rana jai.rana at gmail.com
Thu Feb 8 06:16:44 UTC 2018


After deriving VF representor name on host based on BDF info in
'hostdev' and querying net sysfs entries, virNetDevTapInterfaceStats
defined in virnetdevtap.c already serves the purpose for returning
stats based on interface name.

Is it ok to define a macro as follows to avoid duplicate code or shall
I copy this  function definition as
virNetdevHostdevVFRepInterfaceStats in new file virNetdevhostdev.c to
rule out any dependency on virnetdevtap.

#define virNetdevHostdevVFRepInterfaceStats virNetDevTapInterfaceStats

Thanks,

Jai

On Wed, Jan 31, 2018 at 5:20 PM, Jai Singh Rana <jai.rana at gmail.com> wrote:
> Thanks Daniel for the feedback.
>
> On Wed, Jan 31, 2018 at 5:07 PM, Daniel P. Berrangé <berrange at redhat.com> wrote:
>> On Wed, Jan 31, 2018 at 05:02:59PM +0530, Jai Singh Rana wrote:
>>> Hi All,
>>>
>>> Currently libvirt does not support networks interface stats for
>>> <interface type='hostdev'>.
>>>
>>> With availability of switchdev model in linux, it is possible to
>>> capture stats for SR-IOV VFs on host using its VF representor
>>> interface on host for nics supporting switchdev model.
>>>
>>> https://github.com/torvalds/linux/blob/master/Documentation/networking/switchdev.txt
>>>
>>> I want to preapre a patch supporting this feature for hostdev and
>>> write some function like
>>> 'virHostdevSwitchdevVfRepresentorInterfaceStats' for returning stats.
>>> Should I include this function and supporting methods in
>>> src/util/virhostdev.c or should i include it in new file something
>>> like src/util/virswitchdev.c .
>>
>> It is probably best as  src/util/virnetdevhostdev.c
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
>> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
>> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list