[libvirt] how to know if PCI device has SR-IOV PF capability

Moshe Levi moshele at mellanox.com
Sun Nov 22 11:04:28 UTC 2015


Hi,

I was looking on the output of virsh nodedev-dumpxml on a PCI to see if it has SR-IOV PF  capability.
It seem that if the virtual functions are enables the xml look like [1] but if the PCI has no VFs enabled the
output is like in [2].
As you can see for PCI which has  no VFs the <capability type='virt_functions'>  tag doen't exist.
Is this by design?
I would except that <capability type='virt_functions'/> tag with empty elements will also be include in that case.

Thanks,
            Moshe Levi.


[1] root at r-ufm152:~# virsh nodedev-dumpxml pci_0000_03_00_0
<device>
  <name>pci_0000_03_00_0</name>
  <path>/sys/devices/pci0000:00/0000:00:02.0/0000:03:00.0</path>
  <parent>pci_0000_00_02_0</parent>
  <driver>
    <name>mlx5_core</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x1013'>MT27700 Family [ConnectX-4]</product>
    <vendor id='0x15b3'>Mellanox Technologies</vendor>
    <capability type='virt_functions'>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x2'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x3'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x4'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x5'/>
    </capability>
    <iommuGroup number='15'>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </iommuGroup>
    <numa node='0'/>
    <pci-express>
      <link validity='cap' port='0' speed='8' width='16'/>
      <link validity='sta' speed='8' width='16'/>
    </pci-express>
  </capability>
</device>


[2] root at r-ufm152:~# virsh nodedev-dumpxml pci_0000_03_00_1
<device>
  <name>pci_0000_03_00_1</name>
  <path>/sys/devices/pci0000:00/0000:00:02.0/0000:03:00.1</path>
  <parent>pci_0000_00_02_0</parent>
  <driver>
    <name>mlx5_core</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>0</slot>
    <function>1</function>
    <product id='0x1013'>MT27700 Family [ConnectX-4]</product>
    <vendor id='0x15b3'>Mellanox Technologies</vendor>
    <iommuGroup number='15'>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </iommuGroup>
    <numa node='0'/>
    <pci-express>
      <link validity='cap' port='0' speed='8' width='16'/>
      <link validity='sta' speed='8' width='16'/>
    </pci-express>
  </capability>
</device>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151122/b5142717/attachment-0001.htm>


More information about the libvir-list mailing list