From b592cf6cdf2341d0d8ed61e1ff5ca4b55bb76d58 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 3 Mar 2017 16:09:17 -0700 Subject: [PATCH] nvmf: move NVMe qpair allocation to direct.c Change-Id: Ice167a5ec158e6e60c1c4b67bc7eeca80b262de2 Signed-off-by: Daniel Verkamp --- lib/nvmf/direct.c | 6 ++++++ lib/nvmf/subsystem.c | 6 ------ test/lib/nvmf/direct/direct_ut.c | 6 ++++++ test/lib/nvmf/subsystem/subsystem_ut.c | 6 ------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/nvmf/direct.c b/lib/nvmf/direct.c index 7210fc22bb..a639d6317e 100644 --- a/lib/nvmf/direct.c +++ b/lib/nvmf/direct.c @@ -264,6 +264,12 @@ nvmf_direct_ctrlr_complete_aer(void *arg, const struct spdk_nvme_cpl *cpl) static int nvmf_direct_ctrlr_attach(struct spdk_nvmf_subsystem *subsystem) { + subsystem->dev.direct.io_qpair = spdk_nvme_ctrlr_alloc_io_qpair(subsystem->dev.direct.ctrlr, 0); + if (subsystem->dev.direct.io_qpair == NULL) { + SPDK_ERRLOG("spdk_nvme_ctrlr_alloc_io_qpair() failed\n"); + return -1; + } + return 0; } diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index cb26cefbed..449a829ecf 100644 --- a/lib/nvmf/subsystem.c +++ b/lib/nvmf/subsystem.c @@ -315,12 +315,6 @@ nvmf_subsystem_add_ctrlr(struct spdk_nvmf_subsystem *subsystem, { subsystem->dev.direct.ctrlr = ctrlr; subsystem->dev.direct.pci_addr = *pci_addr; - /* Assume that all I/O will be handled on one thread for now */ - subsystem->dev.direct.io_qpair = spdk_nvme_ctrlr_alloc_io_qpair(ctrlr, 0); - if (subsystem->dev.direct.io_qpair == NULL) { - SPDK_ERRLOG("spdk_nvme_ctrlr_alloc_io_qpair() failed\n"); - return -1; - } subsystem->ops->set_aer_callback(subsystem); return 0; diff --git a/test/lib/nvmf/direct/direct_ut.c b/test/lib/nvmf/direct/direct_ut.c index 2dba091e6a..6c33fc2503 100644 --- a/test/lib/nvmf/direct/direct_ut.c +++ b/test/lib/nvmf/direct/direct_ut.c @@ -117,6 +117,12 @@ spdk_nvme_detach(struct spdk_nvme_ctrlr *ctrlr) return -1; } +struct spdk_nvme_qpair * +spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr *ctrlr, enum spdk_nvme_qprio qprio) +{ + return NULL; +} + int32_t spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_completions) { diff --git a/test/lib/nvmf/subsystem/subsystem_ut.c b/test/lib/nvmf/subsystem/subsystem_ut.c index 51bc6acc2c..f9b5e8020b 100644 --- a/test/lib/nvmf/subsystem/subsystem_ut.c +++ b/test/lib/nvmf/subsystem/subsystem_ut.c @@ -137,12 +137,6 @@ spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_ return -1; } -struct spdk_nvme_qpair * -spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr *ctrlr, enum spdk_nvme_qprio qprio) -{ - return NULL; -} - int spdk_nvme_detach(struct spdk_nvme_ctrlr *ctrlr) {