[dpdk-dev,RFC,1/4] bus/pci: expose PCI API to app

Message ID 1514570702-154906-2-git-send-email-xiao.w.wang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Xiao Wang Dec. 29, 2017, 6:04 p.m. UTC
  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(-)
  

Patch

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 5da6728..6fe35bb 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -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;
diff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h
index f342c47..dbca3dd 100644
--- a/drivers/bus/pci/linux/pci_init.h
+++ b/drivers/bus/pci/linux/pci_init.h
@@ -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_ */
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 1f93fa4..f1a47b7 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -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;