rdma: consolidate common error paths in qpair_init
Consolidating error paths is common practice in SPDK so do that here to make the function more uniform and save space. Change-Id: I98c5d5f7feeb688f1d8b24f4d2d3461a43d00c1d Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448191 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
97a43680a9
commit
a5972c6245
@ -908,19 +908,13 @@ spdk_nvmf_rdma_qpair_initialize(struct spdk_nvmf_qpair *qpair)
|
||||
|
||||
if (nvmf_rdma_resize_cq(rqpair, device) < 0) {
|
||||
SPDK_ERRLOG("Failed to resize the completion queue. Cannot initialize qpair.\n");
|
||||
rdma_destroy_id(rqpair->cm_id);
|
||||
rqpair->cm_id = NULL;
|
||||
spdk_nvmf_rdma_qpair_destroy(rqpair);
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = rdma_create_qp(rqpair->cm_id, rqpair->port->device->pd, &ibv_init_attr);
|
||||
if (rc) {
|
||||
SPDK_ERRLOG("rdma_create_qp failed: errno %d: %s\n", errno, spdk_strerror(errno));
|
||||
rdma_destroy_id(rqpair->cm_id);
|
||||
rqpair->cm_id = NULL;
|
||||
spdk_nvmf_rdma_qpair_destroy(rqpair);
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
rqpair->max_send_depth = spdk_min((uint32_t)(rqpair->max_queue_depth * 2 + 1),
|
||||
@ -945,10 +939,7 @@ spdk_nvmf_rdma_qpair_initialize(struct spdk_nvmf_qpair *qpair)
|
||||
|
||||
if (!rqpair->resources) {
|
||||
SPDK_ERRLOG("Unable to allocate resources for receive queue.\n");
|
||||
rdma_destroy_id(rqpair->cm_id);
|
||||
rqpair->cm_id = NULL;
|
||||
spdk_nvmf_rdma_qpair_destroy(rqpair);
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
rqpair->resources = rqpair->poller->resources;
|
||||
@ -959,6 +950,12 @@ spdk_nvmf_rdma_qpair_initialize(struct spdk_nvmf_qpair *qpair)
|
||||
STAILQ_INIT(&rqpair->pending_rdma_write_queue);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
rdma_destroy_id(rqpair->cm_id);
|
||||
rqpair->cm_id = NULL;
|
||||
spdk_nvmf_rdma_qpair_destroy(rqpair);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user