pci: remove virtio-specific attach functions

As a part of cleanup they're replaced by a device-agnostic
attach API, which is easier for us to manage.

Change-Id: I2ec68f20ba209f02ee5c2de4b6fe5330a4bc0853
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/436480
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-12-07 11:51:02 +01:00 committed by Ben Walker
parent 41130653b7
commit 76a7517caa
4 changed files with 15 additions and 28 deletions

View File

@ -633,6 +633,13 @@ struct spdk_pci_driver *spdk_pci_nvme_get_driver(void);
*/
struct spdk_pci_driver *spdk_pci_ioat_get_driver(void);
/**
* Get the Virtio PCI driver object.
*
* \return PCI driver.
*/
struct spdk_pci_driver *spdk_pci_virtio_get_driver(void);
/**
* Enumerate all PCI devices supported by the provided driver and try to
* attach those that weren't attached yet. The provided callback will be
@ -653,14 +660,6 @@ struct spdk_pci_driver *spdk_pci_ioat_get_driver(void);
*/
int spdk_pci_enumerate(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb, void *enum_ctx);
/**
* Enumerate all Virtio devices on the PCI bus and try to attach those that
* weren't attached yet.
*
* \see spdk_pci_enumerate
*/
int spdk_pci_virtio_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx);
/**
* Map a PCI BAR in the current process.
*
@ -846,14 +845,6 @@ void spdk_pci_device_detach(struct spdk_pci_device *device);
int spdk_pci_device_attach(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb,
void *enum_ctx, struct spdk_pci_addr *pci_address);
/**
* Attach a PCI Virtio device.
*
* \see spdk_pci_device_attach
*/
int spdk_pci_virtio_device_attach(spdk_pci_enum_cb enum_cb, void *enum_ctx,
struct spdk_pci_addr *pci_address);
/**
* Read \c len bytes from the PCI configuration space.
*

View File

@ -59,17 +59,10 @@ static struct spdk_pci_driver g_virtio_pci_drv = {
.is_registered = false,
};
int
spdk_pci_virtio_device_attach(spdk_pci_enum_cb enum_cb,
void *enum_ctx, struct spdk_pci_addr *pci_address)
struct spdk_pci_driver *
spdk_pci_virtio_get_driver(void)
{
return spdk_pci_device_attach(&g_virtio_pci_drv, enum_cb, enum_ctx, pci_address);
}
int
spdk_pci_virtio_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx)
{
return spdk_pci_enumerate(&g_virtio_pci_drv, enum_cb, enum_ctx);
return &g_virtio_pci_drv;
}
SPDK_PMD_REGISTER_PCI(g_virtio_pci_drv);

View File

@ -549,7 +549,8 @@ virtio_pci_dev_enumerate(virtio_pci_create_cb enum_cb, void *enum_ctx,
ctx.enum_ctx = enum_ctx;
ctx.device_id = pci_device_id;
return spdk_pci_virtio_enumerate(virtio_pci_dev_probe_cb, &ctx);
return spdk_pci_enumerate(spdk_pci_virtio_get_driver(),
virtio_pci_dev_probe_cb, &ctx);
}
int
@ -567,7 +568,8 @@ virtio_pci_dev_attach(virtio_pci_create_cb enum_cb, void *enum_ctx,
ctx.enum_ctx = enum_ctx;
ctx.device_id = pci_device_id;
return spdk_pci_virtio_device_attach(virtio_pci_dev_probe_cb, &ctx, pci_address);
return spdk_pci_device_attach(spdk_pci_virtio_get_driver(),
virtio_pci_dev_probe_cb, &ctx, pci_address);
}
int

View File

@ -42,6 +42,7 @@ DEFINE_STUB(spdk_process_is_primary, bool, (void), true)
DEFINE_STUB(spdk_memzone_lookup, void *, (const char *name), NULL)
DEFINE_STUB(spdk_pci_nvme_get_driver, struct spdk_pci_driver *, (void), NULL)
DEFINE_STUB(spdk_pci_ioat_get_driver, struct spdk_pci_driver *, (void), NULL)
DEFINE_STUB(spdk_pci_virtio_get_driver, struct spdk_pci_driver *, (void), NULL)
/*
* These mocks don't use the DEFINE_STUB macros because