diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2019-01-25 15:57:24 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-01-31 13:12:33 +0000 |
commit | a402b8364306b5a01c75ea4223d7d75afdea0a98 (patch) | |
tree | 23dd8463a39d5b09470daad1cbaea55a0d9f3a7f /src/vlib/linux/pci.c | |
parent | 24dcbe45209dfdbcf2f1851aa443e696fac050f2 (diff) |
pci: get the number of interrupts
Change-Id: I2cfb81b3c8809d027a3ee5f5f570668e60be08ef
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vlib/linux/pci.c')
-rw-r--r-- | src/vlib/linux/pci.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c index 28a5140f3eb..ec35adb1c37 100644 --- a/src/vlib/linux/pci.c +++ b/src/vlib/linux/pci.c @@ -173,6 +173,24 @@ vlib_pci_get_numa_node (vlib_main_t * vm, vlib_pci_dev_handle_t h) return d->numa_node; } +u32 +vlib_pci_get_num_msix_interrupts (vlib_main_t * vm, vlib_pci_dev_handle_t h) +{ + linux_pci_device_t *d = linux_pci_get_device (h); + + if (d->type == LINUX_PCI_DEVICE_TYPE_VFIO) + { + struct vfio_irq_info ii = { 0 }; + + ii.argsz = sizeof (struct vfio_irq_info); + ii.index = VFIO_PCI_MSIX_IRQ_INDEX; + if (ioctl (d->fd, VFIO_DEVICE_GET_IRQ_INFO, &ii) < 0) + return 0; + return ii.count; + } + return 0; +} + /* Call to allocate/initialize the pci subsystem. This is not an init function so that users can explicitly enable pci only when it's needed. */ |