diff --git a/include/spdk/env.h b/include/spdk/env.h index 2908c1dad..de58683ef 100644 --- a/include/spdk/env.h +++ b/include/spdk/env.h @@ -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. * diff --git a/lib/env_dpdk/pci_ioat.c b/lib/env_dpdk/pci_ioat.c index 80d9e2498..1be6c20b0 100644 --- a/lib/env_dpdk/pci_ioat.c +++ b/lib/env_dpdk/pci_ioat.c @@ -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); diff --git a/lib/ioat/ioat.c b/lib/ioat/ioat.c index d8c15bf36..4b5f50e88 100644 --- a/lib/ioat/ioat.c +++ b/lib/ioat/ioat.c @@ -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); diff --git a/test/common/lib/test_env.c b/test/common/lib/test_env.c index 38d9f0df0..682632dc2 100644 --- a/test/common/lib/test_env.c +++ b/test/common/lib/test_env.c @@ -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 diff --git a/test/unit/lib/ioat/ioat.c/ioat_ut.c b/test/unit/lib/ioat/ioat.c/ioat_ut.c index 92330e326..bf074ceb0 100644 --- a/test/unit/lib/ioat/ioat.c/ioat_ut.c +++ b/test/unit/lib/ioat/ioat.c/ioat_ut.c @@ -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; }