nvme: remove transport qpair_construct callback

Make the qpair construct functions private to the transports - it
doesn't need to be called from generic code.

Change-Id: I5f730a4bcf60ce231fe27bc8f4c3c39cb647dd2d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-12-14 17:29:34 -07:00
parent 988906135c
commit 0eb3125531
6 changed files with 26 additions and 25 deletions

View File

@ -581,7 +581,6 @@ void nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme
struct spdk_nvme_qpair *nvme_ ## name ## _ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid, enum spdk_nvme_qprio qprio); \
int nvme_ ## name ## _ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair); \
int nvme_ ## name ## _ctrlr_reinit_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair); \
int nvme_ ## name ## _qpair_construct(struct spdk_nvme_qpair *qpair); \
int nvme_ ## name ## _qpair_enable(struct spdk_nvme_qpair *qpair); \
int nvme_ ## name ## _qpair_disable(struct spdk_nvme_qpair *qpair); \
int nvme_ ## name ## _qpair_reset(struct spdk_nvme_qpair *qpair); \

View File

@ -180,6 +180,7 @@ struct nvme_pcie_qpair {
uint64_t cpl_bus_addr;
};
static int nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair);
static int nvme_pcie_qpair_destroy(struct spdk_nvme_qpair *qpair);
__thread struct nvme_pcie_ctrlr *g_thread_mmio_ctrlr = NULL;
@ -513,6 +514,7 @@ static int
nvme_pcie_ctrlr_construct_admin_qpair(struct spdk_nvme_ctrlr *ctrlr)
{
struct nvme_pcie_qpair *pqpair;
int rc;
pqpair = spdk_zmalloc(sizeof(*pqpair), 64, NULL);
if (pqpair == NULL) {
@ -521,11 +523,16 @@ nvme_pcie_ctrlr_construct_admin_qpair(struct spdk_nvme_ctrlr *ctrlr)
ctrlr->adminq = &pqpair->qpair;
return nvme_qpair_construct(ctrlr->adminq,
0, /* qpair ID */
NVME_ADMIN_ENTRIES,
ctrlr,
SPDK_NVME_QPRIO_URGENT);
rc = nvme_qpair_construct(ctrlr->adminq,
0, /* qpair ID */
NVME_ADMIN_ENTRIES,
ctrlr,
SPDK_NVME_QPRIO_URGENT);
if (rc != 0) {
return rc;
}
return nvme_pcie_qpair_construct(ctrlr->adminq);
}
/* This function must only be called while holding g_spdk_nvme_driver->lock */
@ -745,7 +752,7 @@ nvme_pcie_qpair_reset(struct spdk_nvme_qpair *qpair)
return 0;
}
int
static int
nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair)
{
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
@ -1344,6 +1351,12 @@ nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
return NULL;
}
rc = nvme_pcie_qpair_construct(qpair);
if (rc != 0) {
nvme_pcie_qpair_destroy(qpair);
return NULL;
}
rc = _nvme_pcie_ctrlr_create_io_qpair(ctrlr, qpair, qid);
if (rc != 0) {

View File

@ -356,11 +356,6 @@ nvme_qpair_construct(struct spdk_nvme_qpair *qpair, uint16_t id,
STAILQ_INIT(&qpair->queued_req);
if (nvme_transport_qpair_construct(qpair)) {
SPDK_ERRLOG("qpair_construct() failed\n");
return -1;
}
return 0;
}

View File

@ -130,6 +130,7 @@ struct spdk_nvme_rdma_req {
STAILQ_ENTRY(spdk_nvme_rdma_req) link;
};
static int nvme_rdma_qpair_construct(struct spdk_nvme_qpair *qpair);
static int nvme_rdma_qpair_destroy(struct spdk_nvme_qpair *qpair);
static inline struct nvme_rdma_qpair *
@ -994,6 +995,11 @@ nvme_rdma_ctrlr_create_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
return NULL;
}
rc = nvme_rdma_qpair_construct(qpair);
if (rc != 0) {
return NULL;
}
rc = _nvme_rdma_ctrlr_create_qpair(ctrlr, qpair);
if (rc < 0) {
nvme_rdma_qpair_destroy(qpair);
@ -1364,7 +1370,7 @@ nvme_rdma_ctrlr_reinit_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_
return _nvme_rdma_ctrlr_create_qpair(ctrlr, qpair);
}
int
static int
nvme_rdma_qpair_construct(struct spdk_nvme_qpair *qpair)
{
int32_t i;

View File

@ -178,12 +178,6 @@ nvme_transport_ctrlr_reinit_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_
NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_reinit_io_qpair, (ctrlr, qpair));
}
int
nvme_transport_qpair_construct(struct spdk_nvme_qpair *qpair)
{
NVME_TRANSPORT_CALL(qpair->trtype, qpair_construct, (qpair));
}
int
nvme_transport_qpair_enable(struct spdk_nvme_qpair *qpair)
{

View File

@ -183,12 +183,6 @@ nvme_request_remove_child(struct nvme_request *parent,
TAILQ_REMOVE(&parent->children, child, child_tailq);
}
int
nvme_transport_qpair_construct(struct spdk_nvme_qpair *qpair)
{
return 0;
}
int
nvme_transport_qpair_enable(struct spdk_nvme_qpair *qpair)
{