Commit a5c54a1f authored by Jim Harris's avatar Jim Harris Committed by Changpeng Liu
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I0b86d89d8ebee27125b6081fd3845718e1118d5a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453481


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 14e67af3
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -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);