[dpdk-dev,RFC,1/4] bus/pci: expose PCI API to app
Checks
Commit Message
The vDPA device driver in later patch can use the existing pci api to
set up device.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/bus/pci/linux/pci.c | 4 ++--
drivers/bus/pci/linux/pci_init.h | 8 ++++++++
drivers/bus/pci/linux/pci_vfio.c | 6 +++---
3 files changed, 13 insertions(+), 5 deletions(-)
@@ -61,7 +61,7 @@
extern struct rte_pci_bus rte_pci_bus;
-static int
+int
pci_get_kernel_driver_by_path(const char *filename, char *dri_name)
{
int count;
@@ -198,7 +198,7 @@
}
/* parse the "resource" sysfs file */
-static int
+int
pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev)
{
FILE *f;
@@ -35,6 +35,7 @@
#define EAL_PCI_INIT_H_
#include <linux/version.h>
+#include <stdbool.h>
#include <rte_vfio.h>
@@ -106,6 +107,13 @@ void pci_vfio_ioport_write(struct rte_pci_ioport *p,
int pci_vfio_is_enabled(void);
+int pci_get_kernel_driver_by_path(const char *filename, char *dri_name);
+int pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev);
+
+int pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table);
+int pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd);
+int pci_vfio_set_bus_master(int dev_fd, bool op);
+
#endif
#endif /* EAL_PCI_INIT_H_ */
@@ -89,7 +89,7 @@
}
/* get PCI BAR number where MSI-X interrupts are */
-static int
+int
pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
{
int ret;
@@ -174,7 +174,7 @@
}
/* set PCI bus mastering */
-static int
+int
pci_vfio_set_bus_master(int dev_fd, bool op)
{
uint16_t reg;
@@ -207,7 +207,7 @@
}
/* set up interrupt support (but not enable interrupts) */
-static int
+int
pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
{
int i, ret, intr_idx;