pci: remove ioat-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: Ia92bd8f4525712bd27ade16ead67435c5e0fbe7a
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/436479
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:47:55 +01:00 committed by Ben Walker
parent 576f08f732
commit 41130653b7
5 changed files with 13 additions and 28 deletions

View File

@ -626,6 +626,13 @@ typedef int (*spdk_pci_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev)
*/
struct spdk_pci_driver *spdk_pci_nvme_get_driver(void);
/**
* Get the I/OAT PCI driver object.
*
* \return PCI driver.
*/
struct spdk_pci_driver *spdk_pci_ioat_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
@ -646,14 +653,6 @@ struct spdk_pci_driver *spdk_pci_nvme_get_driver(void);
*/
int spdk_pci_enumerate(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb, void *enum_ctx);
/**
* Enumerate all I/OAT devices on the PCI bus and try to attach those that
* weren't attached yet.
*
* \see spdk_pci_enumerate
*/
int spdk_pci_ioat_enumerate(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.
@ -847,14 +846,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 I/OAT device.
*
* \see spdk_pci_device_attach
*/
int spdk_pci_ioat_device_attach(spdk_pci_enum_cb enum_cb, void *enum_ctx,
struct spdk_pci_addr *pci_address);
/**
* Attach a PCI Virtio device.
*

View File

@ -102,17 +102,10 @@ static struct spdk_pci_driver g_ioat_pci_drv = {
.is_registered = false,
};
int
spdk_pci_ioat_device_attach(spdk_pci_enum_cb enum_cb, void *enum_ctx,
struct spdk_pci_addr *pci_address)
struct spdk_pci_driver *
spdk_pci_ioat_get_driver(void)
{
return spdk_pci_device_attach(&g_ioat_pci_drv, enum_cb, enum_ctx, pci_address);
}
int
spdk_pci_ioat_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx)
{
return spdk_pci_enumerate(&g_ioat_pci_drv, enum_cb, enum_ctx);
return &g_ioat_pci_drv;
}
SPDK_PMD_REGISTER_PCI(g_ioat_pci_drv);

View File

@ -559,7 +559,7 @@ spdk_ioat_probe(void *cb_ctx, spdk_ioat_probe_cb probe_cb, spdk_ioat_attach_cb a
enum_ctx.attach_cb = attach_cb;
enum_ctx.cb_ctx = cb_ctx;
rc = spdk_pci_ioat_enumerate(ioat_enum_cb, &enum_ctx);
rc = spdk_pci_enumerate(spdk_pci_ioat_get_driver(), ioat_enum_cb, &enum_ctx);
pthread_mutex_unlock(&g_ioat_driver.lock);

View File

@ -41,6 +41,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)
/*
* These mocks don't use the DEFINE_STUB macros because

View File

@ -40,7 +40,7 @@
#include "common/lib/test_env.c"
int
spdk_pci_ioat_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx)
spdk_pci_enumerate(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb, void *enum_ctx)
{
return -1;
}