nvme/tcp: alloc requests when qpair is created

This allows us to reconnect the qpair in the future,
avoiding reallocating memory every time.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0b86d89d8ebee27125b6081fd3845718e1118d5a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453481
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-05-06 15:18:49 -07:00 committed by Changpeng Liu
parent 14e67af3c5
commit a5c54a1f6a

View File

@ -1730,14 +1730,6 @@ nvme_tcp_qpair_connect(struct nvme_tcp_qpair *tqpair)
}
tqpair->max_r2t = NVME_TCP_MAX_R2T_DEFAULT;
rc = nvme_tcp_alloc_reqs(tqpair);
SPDK_DEBUGLOG(SPDK_LOG_NVME, "rc =%d\n", rc);
if (rc) {
SPDK_ERRLOG("Unable to allocate tqpair tcp requests\n");
return -1;
}
SPDK_DEBUGLOG(SPDK_LOG_NVME, "TCP requests allocated\n");
rc = nvme_tcp_qpair_icreq_send(tqpair);
if (rc != 0) {
SPDK_ERRLOG("Unable to connect the tqpair\n");
@ -1778,6 +1770,12 @@ nvme_tcp_ctrlr_create_qpair(struct spdk_nvme_ctrlr *ctrlr,
return NULL;
}
rc = nvme_tcp_alloc_reqs(tqpair);
if (rc) {
nvme_tcp_qpair_destroy(qpair);
return NULL;
}
rc = nvme_tcp_qpair_connect(tqpair);
if (rc < 0) {
nvme_tcp_qpair_destroy(qpair);