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 <thomas.monjalon@6wind.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
Thomas Monjalon 2015-04-01 00:00:37 +02:00
parent f14db469be
commit b5a1f1ae2f
4 changed files with 27 additions and 29 deletions

View File

@ -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,

View File

@ -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, ...) */

View File

@ -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;
}

View File

@ -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;
}