[v3,2/6] bus/pci: switch to private kernel driver enum
diff mbox series

Message ID 20200917112823.10534-3-david.marchand@redhat.com
State Accepted
Delegated to: David Marchand
Headers show
Series
  • 20.11 announced cleanups
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Sept. 17, 2020, 11:28 a.m. UTC
The rte_kernel_driver enum actually only pointed at PCI drivers and is
only used in the PCI subsystem.
Remove it from the generic device API and use a private enum in the PCI
code.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst    |  4 --
 doc/guides/rel_notes/release_20_11.rst  |  3 ++
 drivers/bus/pci/bsd/pci.c               | 17 ++++---
 drivers/bus/pci/linux/pci.c             | 64 ++++++++++++-------------
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/pci_common.c            | 16 +++----
 drivers/bus/pci/rte_bus_pci.h           | 11 ++++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 12 -----
 14 files changed, 72 insertions(+), 77 deletions(-)

Patch
diff mbox series

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 394b55d8ca..83ba567632 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -124,10 +124,6 @@  Deprecation Notices
   With this removal, there won't be a need for the mentioned workaround which
   will be reverted.
 
-* pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private
-  to the PCI subsystem as it is used only by the PCI bus driver and PCI
-  drivers.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 684da5157d..a76e7a2941 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@  API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
+  replaced with a private enum in the PCI subsystem.
+
 * mbuf: Removed the unioned field ``refcnt_atomic`` from
   the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
   The field ``refcnt`` is remaining from the old unions.
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 6ec27b4b5b..a07fc241fe 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -65,7 +65,7 @@  rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* map resources for devices that use uio */
 		ret = pci_uio_map_resource(dev);
 		break;
@@ -85,7 +85,7 @@  rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -255,7 +255,7 @@  pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	pci_name_set(dev);
 
 	/* FreeBSD has only one pass through driver */
-	dev->kdrv = RTE_KDRV_NIC_UIO;
+	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
 
 	/* parse resources */
 	switch (conf->pc_hdr & PCIM_HDRTYPE) {
@@ -395,8 +395,7 @@  enum rte_iova_mode
 pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
 		     const struct rte_pci_device *pdev)
 {
-	/* Supports only RTE_KDRV_NIC_UIO */
-	if (pdev->kdrv != RTE_KDRV_NIC_UIO)
+	if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO)
 		RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n");
 
 	return RTE_IOVA_PA;
@@ -548,7 +547,7 @@  rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		if (rte_eal_iopl_init() != 0) {
 			RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
 				__func__, dev->name);
@@ -606,7 +605,7 @@  rte_pci_ioport_read(struct rte_pci_ioport *p,
 		void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -648,7 +647,7 @@  rte_pci_ioport_write(struct rte_pci_ioport *p,
 		const void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -663,7 +662,7 @@  rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		ret = 0;
 		break;
 #endif
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index a2198abf43..bf275947f4 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -68,14 +68,14 @@  rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_map_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		if (rte_eal_using_phys_addrs()) {
 			/* map resources for devices that use uio */
 			ret = pci_uio_map_resource(dev);
@@ -97,14 +97,14 @@  rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			pci_vfio_unmap_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -323,15 +323,15 @@  pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 
 	if (!ret) {
 		if (!strcmp(driver, "vfio-pci"))
-			dev->kdrv = RTE_KDRV_VFIO;
+			dev->kdrv = RTE_PCI_KDRV_VFIO;
 		else if (!strcmp(driver, "igb_uio"))
-			dev->kdrv = RTE_KDRV_IGB_UIO;
+			dev->kdrv = RTE_PCI_KDRV_IGB_UIO;
 		else if (!strcmp(driver, "uio_pci_generic"))
-			dev->kdrv = RTE_KDRV_UIO_GENERIC;
+			dev->kdrv = RTE_PCI_KDRV_UIO_GENERIC;
 		else
-			dev->kdrv = RTE_KDRV_UNKNOWN;
+			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		dev->kdrv = RTE_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_NONE;
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -608,7 +608,7 @@  pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 	enum rte_iova_mode iova_mode = RTE_IOVA_DC;
 
 	switch (pdev->kdrv) {
-	case RTE_KDRV_VFIO: {
+	case RTE_PCI_KDRV_VFIO: {
 #ifdef VFIO_PRESENT
 		static int is_vfio_noiommu_enabled = -1;
 
@@ -626,8 +626,8 @@  pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 		break;
 	}
 
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		iova_mode = RTE_IOVA_PA;
 		break;
 
@@ -647,11 +647,11 @@  int rte_pci_read_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_read_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_read_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -671,11 +671,11 @@  int rte_pci_write_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_write_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_write_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -760,15 +760,15 @@  rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_map(dev, bar, p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_map(dev, bar, p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = pci_ioport_map(dev, bar, p);
 #else
@@ -791,14 +791,14 @@  rte_pci_ioport_read(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_read(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -812,14 +812,14 @@  rte_pci_ioport_write(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_write(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -834,15 +834,15 @@  rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_unmap(p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_unmap(p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = 0;
 #else
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 097dc19225..a354920d5f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -248,7 +248,7 @@  pci_uio_alloc_resource(struct rte_pci_device *dev,
 		goto error;
 	}
 
-	if (dev->kdrv == RTE_KDRV_IGB_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_IGB_UIO)
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
 	else {
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index a8e5fd52c1..dddf2b2aad 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -465,7 +465,7 @@  pci_hot_unplug_handler(struct rte_device *dev)
 
 	switch (pdev->kdrv) {
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		/*
 		 * vfio kernel module guaranty the pci device would not be
 		 * deleted until the user space release the resource, so no
@@ -476,9 +476,9 @@  pci_hot_unplug_handler(struct rte_device *dev)
 					       RTE_DEV_EVENT_REMOVE);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* BARs resource is invalid, remap it to be safe. */
 		ret = pci_uio_remap_resource(pdev);
 		break;
@@ -552,7 +552,7 @@  pci_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_map
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -575,7 +575,7 @@  pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_unmap
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -622,8 +622,8 @@  rte_pci_get_iommu_class(void)
 			iommu_no_va = pci_device_iommu_support_va(dev)
 					? 0 : 1;
 
-		if (dev->kdrv == RTE_KDRV_UNKNOWN ||
-		    dev->kdrv == RTE_KDRV_NONE)
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN ||
+		    dev->kdrv == RTE_PCI_KDRV_NONE)
 			continue;
 		FOREACH_DRIVER_ON_PCIBUS(drv) {
 			enum rte_iova_mode dev_iova_mode;
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 29bea6d70d..ff6f072470 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -51,6 +51,15 @@  TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 
 struct rte_devargs;
 
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,
+	RTE_PCI_KDRV_IGB_UIO,
+	RTE_PCI_KDRV_VFIO,
+	RTE_PCI_KDRV_UIO_GENERIC,
+	RTE_PCI_KDRV_NIC_UIO,
+	RTE_PCI_KDRV_NONE,
+};
+
 /**
  * A structure describing a PCI device.
  */
@@ -64,7 +73,7 @@  struct rte_pci_device {
 	struct rte_intr_handle intr_handle; /**< Interrupt handle */
 	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
 	struct rte_intr_handle vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index c80bd55716..9e5c8fafb0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -211,7 +211,7 @@  get_device_resource_info(HDEVINFO dev_info,
 	BOOL  res;
 
 	switch (dev->kdrv) {
-	case RTE_KDRV_NONE:
+	case RTE_PCI_KDRV_NONE:
 		/* Get NUMA node using DEVPKEY_Device_Numa_Node */
 		res = SetupDiGetDevicePropertyW(dev_info, dev_info_data,
 			&DEVPKEY_Device_Numa_Node, &property_type,
@@ -223,7 +223,7 @@  get_device_resource_info(HDEVINFO dev_info,
 			return -1;
 		}
 		dev->device.numa_node = numa_node;
-		/* mem_resource - Unneeded for RTE_KDRV_NONE */
+		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
@@ -292,7 +292,7 @@  get_kernel_driver_type(struct rte_pci_device *dev)
 	 * If another kernel driver is supported the relevant checking
 	 * functions should be here
 	 */
-	dev->kdrv = RTE_KDRV_NONE;
+	dev->kdrv = RTE_PCI_KDRV_NONE;
 }
 
 static int
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index d7fc1af707..26fa1e27d4 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -280,7 +280,7 @@  void hinic_set_msix_state(void *hwdev, u16 msix_idx, enum hinic_msix_state flag)
 	/* vfio-pci does not mmap msi-x vector table to user space,
 	 * we can not access the space when kernel driver is vfio-pci
 	 */
-	if (hw->pcidev_hdl->kdrv == RTE_KDRV_VFIO)
+	if (hw->pcidev_hdl->kdrv == RTE_PCI_KDRV_VFIO)
 		return;
 
 	mask_bits = readl(hwif->intr_regs_base + offset);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 1d2941f0e3..63089d0bd4 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2425,8 +2425,8 @@  hns3vf_reinit_dev(struct hns3_adapter *hns)
 		 * UIO enables msix by writing the pcie configuration space
 		 * vfio_pci enables msix in rte_intr_enable.
 		 */
-		if (pci_dev->kdrv == RTE_KDRV_IGB_UIO ||
-		    pci_dev->kdrv == RTE_KDRV_UIO_GENERIC) {
+		if (pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO ||
+		    pci_dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC) {
 			if (hns3vf_enable_msix(pci_dev, true))
 				hns3_err(hw, "Failed to enable msix");
 		}
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 2258838c4c..2c2b27e62a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -1563,7 +1563,7 @@  lio_dev_close(struct rte_eth_dev *eth_dev)
 	/* Reset ioq regs */
 	lio_dev->fn_list.setup_device_regs(lio_dev);
 
-	if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (lio_dev->pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		rte_delay_ms(LIO_PCI_FLR_WAIT);
 	}
@@ -2012,7 +2012,7 @@  lio_first_time_init(struct lio_device *lio_dev,
 		goto error;
 
 	/* Request and wait for device reset. */
-	if (pdev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (pdev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		/* FLR wait time doubled as a precaution. */
 		rte_delay_ms(LIO_PCI_FLR_WAIT * 2);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99946279db..1cf949a9ab 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -3614,7 +3614,7 @@  static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	 * interface. Here we avoid this telling to the CPP init code to
 	 * use a lock file if UIO is being used.
 	 */
-	if (dev->kdrv == RTE_KDRV_VFIO)
+	if (dev->kdrv == RTE_PCI_KDRV_VFIO)
 		cpp = nfp_cpp_from_device_name(dev, 0);
 	else
 		cpp = nfp_cpp_from_device_name(dev, 1);
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 29a354bf76..9915eabf68 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -704,7 +704,7 @@  vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
 	if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
 		rte_pci_unmap_device(dev);
-		if (dev->kdrv == RTE_KDRV_UNKNOWN &&
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN &&
 		    (!dev->device.devargs ||
 		     dev->device.devargs->bus !=
 		     rte_bus_find_by_name("pci"))) {
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index c8d985fb5c..53c8bc6fab 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -54,18 +54,6 @@  typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 		return; \
 } while (0)
 
-/**
- * Device driver.
- */
-enum rte_kernel_driver {
-	RTE_KDRV_UNKNOWN = 0,
-	RTE_KDRV_IGB_UIO,
-	RTE_KDRV_VFIO,
-	RTE_KDRV_UIO_GENERIC,
-	RTE_KDRV_NIC_UIO,
-	RTE_KDRV_NONE,
-};
-
 /**
  * Device policies.
  */