From b5a1f1ae2f98c644389293bd97e81a0ab2b2b31f Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Wed, 1 Apr 2015 00:00:37 +0200 Subject: [PATCH] pci: rename passthrough driver to kernel driver Kernel driver (kdrv) seems easier to understand than passthrough driver (pt_driver). It's also more generic as a PMD could run on top of any PCI kernel driver if it would offer such support. Signed-off-by: Thomas Monjalon Acked-by: Michael Qiu Acked-by: David Marchand --- lib/librte_eal/bsdapp/eal/eal_pci.c | 3 +-- lib/librte_eal/common/include/rte_pci.h | 12 ++++----- lib/librte_eal/linuxapp/eal/eal_pci.c | 33 ++++++++++++------------- lib/librte_ether/rte_ethdev.c | 8 +++--- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index fe3ef86c45..30f0232f1d 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -356,8 +356,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) TAILQ_INSERT_BEFORE(dev2, dev, next); return 0; } else { /* already registered */ - /* update pt_driver */ - dev2->pt_driver = dev->pt_driver; + dev2->kdrv = dev->kdrv; dev2->max_vfs = dev->max_vfs; memmove(dev2->mem_resource, dev->mem_resource, diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 995f814a55..785852d1a1 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -142,11 +142,11 @@ struct rte_pci_addr { struct rte_devargs; -enum rte_pt_driver { - RTE_PT_UNKNOWN = 0, - RTE_PT_IGB_UIO = 1, - RTE_PT_VFIO = 2, - RTE_PT_UIO_GENERIC = 3, +enum rte_kernel_driver { + RTE_KDRV_UNKNOWN = 0, + RTE_KDRV_IGB_UIO, + RTE_KDRV_VFIO, + RTE_KDRV_UIO_GENERIC, }; /** @@ -162,7 +162,7 @@ struct rte_pci_device { uint16_t max_vfs; /**< sriov enable if not zero */ int numa_node; /**< NUMA node connection */ struct rte_devargs *devargs; /**< Device user arguments */ - enum rte_pt_driver pt_driver; /**< Driver of passthrough */ + enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ }; /** Any PCI device identifier (vendor, device, ...) */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 83c589e516..9cb0ffd919 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -340,19 +340,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, ret = pci_get_kernel_driver_by_path(filename, driver); if (!ret) { if (!strcmp(driver, "vfio-pci")) - dev->pt_driver = RTE_PT_VFIO; + dev->kdrv = RTE_KDRV_VFIO; else if (!strcmp(driver, "igb_uio")) - dev->pt_driver = RTE_PT_IGB_UIO; + dev->kdrv = RTE_KDRV_IGB_UIO; else if (!strcmp(driver, "uio_pci_generic")) - dev->pt_driver = RTE_PT_UIO_GENERIC; + dev->kdrv = RTE_KDRV_UIO_GENERIC; else - dev->pt_driver = RTE_PT_UNKNOWN; + dev->kdrv = RTE_KDRV_UNKNOWN; } else if (ret < 0) { RTE_LOG(ERR, EAL, "Fail to get kernel driver\n"); free(dev); return -1; } else - dev->pt_driver = RTE_PT_UNKNOWN; + dev->kdrv = RTE_KDRV_UNKNOWN; /* device is valid, add in list (sorted) */ if (TAILQ_EMPTY(&pci_device_list)) { @@ -370,8 +370,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, TAILQ_INSERT_BEFORE(dev2, dev, next); return 0; } else { /* already registered */ - /* update pt_driver */ - dev2->pt_driver = dev->pt_driver; + dev2->kdrv = dev->kdrv; dev2->max_vfs = dev->max_vfs; memmove(dev2->mem_resource, dev->mem_resource, @@ -570,20 +569,20 @@ pci_map_device(struct rte_pci_device *dev) int ret = -1; /* try mapping the NIC resources using VFIO if it exists */ - switch (dev->pt_driver) { - case RTE_PT_VFIO: + switch (dev->kdrv) { + case RTE_KDRV_VFIO: #ifdef VFIO_PRESENT if (pci_vfio_is_enabled()) ret = pci_vfio_map_resource(dev); #endif break; - case RTE_PT_IGB_UIO: - case RTE_PT_UIO_GENERIC: + case RTE_KDRV_IGB_UIO: + case RTE_KDRV_UIO_GENERIC: /* map resources for devices that use uio */ ret = pci_uio_map_resource(dev); break; default: - RTE_LOG(DEBUG, EAL, " Not managed by known pt driver," + RTE_LOG(DEBUG, EAL, " Not managed by a supported kernel driver," " skipped\n"); ret = 1; break; @@ -600,17 +599,17 @@ pci_unmap_device(struct rte_pci_device *dev) return; /* try unmapping the NIC resources using VFIO if it exists */ - switch (dev->pt_driver) { - case RTE_PT_VFIO: + switch (dev->kdrv) { + case RTE_KDRV_VFIO: RTE_LOG(ERR, EAL, "Hotplug doesn't support vfio yet\n"); break; - case RTE_PT_IGB_UIO: - case RTE_PT_UIO_GENERIC: + case RTE_KDRV_IGB_UIO: + case RTE_KDRV_UIO_GENERIC: /* unmap resources for devices that use uio */ pci_uio_unmap_resource(dev); break; default: - RTE_LOG(DEBUG, EAL, " Not managed by known pt driver," + RTE_LOG(DEBUG, EAL, " Not managed by a supported kernel driver," " skipped\n"); break; } diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 5208badf67..e20cca59ac 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -512,11 +512,11 @@ rte_eth_dev_is_detachable(uint8_t port_id) } if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) { - switch (rte_eth_devices[port_id].pci_dev->pt_driver) { - case RTE_PT_IGB_UIO: - case RTE_PT_UIO_GENERIC: + switch (rte_eth_devices[port_id].pci_dev->kdrv) { + case RTE_KDRV_IGB_UIO: + case RTE_KDRV_UIO_GENERIC: break; - case RTE_PT_VFIO: + case RTE_KDRV_VFIO: default: return -ENOTSUP; } -- 2.20.1