nvme: add internal function to iterate over transports.

This will come in handy in the new poll group API.

Change-Id: I9cf14082270b28b35f4a440c5cb2471c81e374ba
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/578
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2020-02-05 10:13:01 -07:00 committed by Tomasz Zawadzki
parent 19260848f6
commit b1daf62be5
2 changed files with 15 additions and 0 deletions

View File

@ -1121,6 +1121,9 @@ struct spdk_nvme_ctrlr *spdk_nvme_get_ctrlr_by_trid_unsafe(
const struct spdk_nvme_transport_id *trid);
const struct spdk_nvme_transport *nvme_get_transport(const char *transport_name);
const struct spdk_nvme_transport *nvme_get_first_transport(void);
const struct spdk_nvme_transport *nvme_get_next_transport(const struct spdk_nvme_transport
*transport);
/* Transport specific functions */
struct spdk_nvme_ctrlr *nvme_transport_ctrlr_construct(const struct spdk_nvme_transport_id *trid,

View File

@ -46,6 +46,18 @@ struct spdk_nvme_transport {
TAILQ_HEAD(nvme_transport_list, spdk_nvme_transport) g_spdk_nvme_transports =
TAILQ_HEAD_INITIALIZER(g_spdk_nvme_transports);
const struct spdk_nvme_transport *
nvme_get_first_transport(void)
{
return TAILQ_FIRST(&g_spdk_nvme_transports);
}
const struct spdk_nvme_transport *
nvme_get_next_transport(const struct spdk_nvme_transport *transport)
{
return TAILQ_NEXT(transport, link);
}
/*
* Unfortunately, due to NVMe PCIe multiprocess support, we cannot store the
* transport object in either the controller struct or the admin qpair. THis means