aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vlib/linux/pci.c18
-rw-r--r--src/vlib/pci/pci.h3
2 files changed, 21 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. */
diff --git a/src/vlib/pci/pci.h b/src/vlib/pci/pci.h
index 71d4baedd20..d3b43ba8d90 100644
--- a/src/vlib/pci/pci.h
+++ b/src/vlib/pci/pci.h
@@ -103,6 +103,9 @@ vlib_pci_addr_t *vlib_pci_get_all_dev_addrs ();
vlib_pci_addr_t *vlib_pci_get_addr (vlib_main_t * vm,
vlib_pci_dev_handle_t h);
u32 vlib_pci_get_numa_node (vlib_main_t * vm, vlib_pci_dev_handle_t h);
+u32 vlib_pci_get_num_msix_interrupts (vlib_main_t * vm,
+ vlib_pci_dev_handle_t h);
+
uword vlib_pci_get_private_data (vlib_main_t * vm, vlib_pci_dev_handle_t h);
void vlib_pci_set_private_data (vlib_main_t * vm, vlib_pci_dev_handle_t h,
uword private_data);