From 258845450de3409ee65bffeea4b1976248b67f0c Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 28 Mar 2018 15:50:52 -0700 Subject: [PATCH] env: deprecate spdk_pci_get_device() This isn't possible to implement using the current public API of DPDK, and all of the in-tree users have been removed. Replace the implementation with a stub that always returns NULL and mark it deprecated so that any users have a release to update their code. Change-Id: I4bc71f0a9fd518923484e862333b0c5e86883980 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/405710 Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- CHANGELOG.md | 2 ++ include/spdk/env.h | 3 ++- lib/env_dpdk/pci.c | 26 -------------------------- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68cc962a5..258d867fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ option, but instead returns SPDK_APP_PARSE_ARGS_HELP and SPDK_APP_PARSE_ARGS_FAIL, respectively, and SPDK_APP_PARSE_ARGS_SUCCESS on success. +spdk_pci_get_device() has been deprecated and will be removed in SPDK v18.07. + ### I/O Channels The prototype for spdk_poller_fn() has been modified; it now returns a value indicating diff --git a/include/spdk/env.h b/include/spdk/env.h index 2b72b60b4..3f94e4d39 100644 --- a/include/spdk/env.h +++ b/include/spdk/env.h @@ -353,7 +353,8 @@ int spdk_pci_nvme_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx); int spdk_pci_ioat_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx); int spdk_pci_virtio_enumerate(spdk_pci_enum_cb enum_cb, void *enum_ctx); -struct spdk_pci_device *spdk_pci_get_device(struct spdk_pci_addr *pci_addr); +struct spdk_pci_device *spdk_pci_get_device(struct spdk_pci_addr *pci_addr) +__attribute__((deprecated)); int spdk_pci_device_map_bar(struct spdk_pci_device *dev, uint32_t bar, void **mapped_addr, uint64_t *phys_addr, uint64_t *size); diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 73bfbf51e..26cb0cc16 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -210,32 +210,6 @@ spdk_pci_enumerate(struct spdk_pci_enum_ctx *ctx, struct spdk_pci_device * spdk_pci_get_device(struct spdk_pci_addr *pci_addr) { - struct rte_pci_device *dev; - struct rte_pci_addr addr; - int rc; - - addr.domain = pci_addr->domain; - addr.bus = pci_addr->bus; - addr.devid = pci_addr->dev; - addr.function = pci_addr->func; - -#if RTE_VERSION >= RTE_VERSION_NUM(17, 05, 0, 2) - FOREACH_DEVICE_ON_PCIBUS(dev) { -#else - TAILQ_FOREACH(dev, &pci_device_list, next) { -#endif - rc = rte_eal_compare_pci_addr(&dev->addr, &addr); - if (rc < 0) { - continue; - } - - if (rc == 0) { - return (struct spdk_pci_device *)dev; - } else { - break; - } - } - return NULL; }