From 8280d5f2fc3b9f66a07a2fe4a3a54df3f3cc0bfb Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Tue, 29 Jun 2021 13:34:46 +0200 Subject: [PATCH] nvme: don't queue fabrics CONNECT command This allows for submitting IO requests before the CONNECT command is sent and not stopping the connect process due to the CONNECT being queued. It could happen once IO qpair connection is asynchronous. Signed-off-by: Jim Harris Signed-off-by: Konrad Sztyber Change-Id: I04e45b1c2f49f9da3412c843ea899341c56a0420 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8624 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk --- lib/nvme/nvme_qpair.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/nvme/nvme_qpair.c b/lib/nvme/nvme_qpair.c index f431909a1..0fc870155 100644 --- a/lib/nvme/nvme_qpair.c +++ b/lib/nvme/nvme_qpair.c @@ -985,13 +985,18 @@ nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *re if (spdk_unlikely(!STAILQ_EMPTY(&qpair->queued_req) && req->num_children == 0)) { /* - * requests that have no children should be sent to the transport after all + * Requests that have no children should be sent to the transport after all * currently queued requests. Requests with chilren will be split and go back - * through this path. + * through this path. We need to make an exception for the fabrics commands + * while the qpair is connecting to be able to send the connect command + * asynchronously. */ - STAILQ_INSERT_TAIL(&qpair->queued_req, req, stailq); - req->queued = true; - return 0; + if (req->cmd.opc != SPDK_NVME_OPC_FABRIC || + nvme_qpair_get_state(qpair) != NVME_QPAIR_CONNECTING) { + STAILQ_INSERT_TAIL(&qpair->queued_req, req, stailq); + req->queued = true; + return 0; + } } rc = _nvme_qpair_submit_request(qpair, req);