Commit 41130653 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Ben Walker
Browse files

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: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/436479


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 576f08f7
Loading
Loading
Loading
Loading
+7 −16
Original line number Diff line number Diff line
@@ -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.
 *
+3 −10
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);

+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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;
}