aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/linux/pci.c11
-rw-r--r--src/vlib/pci/pci.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c
index a010e64fa13..6078be2537e 100644
--- a/src/vlib/linux/pci.c
+++ b/src/vlib/linux/pci.c
@@ -912,6 +912,17 @@ vlib_pci_enable_msix_irq (vlib_main_t * vm, vlib_pci_dev_handle_t h,
VFIO_IRQ_SET_ACTION_TRIGGER, fds);
}
+uword
+vlib_pci_get_msix_file_index (vlib_main_t * vm, vlib_pci_dev_handle_t h,
+ u16 index)
+{
+ linux_pci_device_t *p = linux_pci_get_device (h);
+ linux_pci_irq_t *irq = vec_elt_at_index (p->msix_irqs, index);
+ if (irq->fd == -1)
+ return ~0;
+ return irq->clib_file_index;
+}
+
clib_error_t *
vlib_pci_disable_msix_irq (vlib_main_t * vm, vlib_pci_dev_handle_t h,
u16 start, u16 count)
diff --git a/src/vlib/pci/pci.h b/src/vlib/pci/pci.h
index d3b43ba8d90..5aae597f825 100644
--- a/src/vlib/pci/pci.h
+++ b/src/vlib/pci/pci.h
@@ -316,6 +316,8 @@ clib_error_t *vlib_pci_disable_msix_irq (vlib_main_t * vm,
u16 count);
clib_error_t *vlib_pci_map_dma (vlib_main_t * vm, vlib_pci_dev_handle_t h,
void *ptr);
+uword vlib_pci_get_msix_file_index (vlib_main_t * vm, vlib_pci_dev_handle_t h,
+ u16 index);
int vlib_pci_supports_virtual_addr_dma (vlib_main_t * vm,
vlib_pci_dev_handle_t h);