env: remove spdk_pci_get_[first|next]_device

These APIs are not safe, since they do not hold the
pci device lock across calls, which can cause problems
if a device is inserted or removed while handles
returned by these APIs are being used.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I01a80f26d0a0ca4cdfc7181359932b38da8dd43a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10659
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Jim Harris 2021-12-10 16:02:04 -07:00 committed by Tomasz Zawadzki
parent e123181d71
commit 2b65309b6c
5 changed files with 7 additions and 35 deletions

View File

@ -35,6 +35,11 @@ were deprecated.
Added spdk_pci_for_each_device.
Removed spdk_pci_get_first_device and spdk_pci_get_next_device. These APIs were unsafe, because
they did not account for PCI devices being inserted or removed while the caller was using handles
returned from these APIs. Existing users of these APIs should switch to spdk_pci_for_each_device
instead.
## v21.10
Structure `spdk_nvmf_target_opts` has been extended with new member `discovery_filter` which allows to specify

View File

@ -796,25 +796,6 @@ int spdk_pci_enumerate(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb,
*/
void spdk_pci_for_each_device(void *ctx, void (*fn)(void *ctx, struct spdk_pci_device *dev));
/**
* Begin iterating over enumerated PCI device by calling this function to get
* the first PCI device. If there no PCI devices enumerated, return NULL
*
* \return a pointer to a PCI device on success, NULL otherwise.
*/
struct spdk_pci_device *spdk_pci_get_first_device(void);
/**
* Continue iterating over enumerated PCI devices.
* If no additional PCI devices, return NULL
*
* \param prev Previous PCI device returned from \ref spdk_pci_get_first_device
* or \ref spdk_pci_get_next_device
*
* \return a pointer to the next PCI device on success, NULL otherwise.
*/
struct spdk_pci_device *spdk_pci_get_next_device(struct spdk_pci_device *prev);
/**
* Map a PCI BAR in the current process.
*

View File

@ -34,8 +34,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 7
SO_MINOR := 1
SO_VER := 8
SO_MINOR := 0
CFLAGS += $(ENV_CFLAGS)
C_SRCS = env.c memory.c pci.c init.c threads.c

View File

@ -774,18 +774,6 @@ spdk_pci_for_each_device(void *ctx, void (*fn)(void *ctx, struct spdk_pci_device
pthread_mutex_unlock(&g_pci_mutex);
}
struct spdk_pci_device *
spdk_pci_get_first_device(void)
{
return TAILQ_FIRST(&g_pci_devices);
}
struct spdk_pci_device *
spdk_pci_get_next_device(struct spdk_pci_device *prev)
{
return TAILQ_NEXT(prev, internal.tailq);
}
int
spdk_pci_device_map_bar(struct spdk_pci_device *dev, uint32_t bar,
void **mapped_addr, uint64_t *phys_addr, uint64_t *size)

View File

@ -60,8 +60,6 @@
spdk_pci_virtio_get_driver;
spdk_pci_enumerate;
spdk_pci_for_each_device;
spdk_pci_get_first_device;
spdk_pci_get_next_device;
spdk_pci_device_map_bar;
spdk_pci_device_unmap_bar;
spdk_pci_device_get_domain;