From 184984603f771cc93806009f77429e536ec77bfd Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 5 Aug 2016 15:06:05 -0700 Subject: [PATCH] nvmf: use Connect command SQSIZE to manage SQHD The NVMe submission queue head wraparound point can be determined in the generic NVMe over Fabrics layer; it should not be using the RDMA connection queue depth. Change-Id: I9da8f09e4f057f8fdc1ff4c6cc5f48cea7123e11 Signed-off-by: Daniel Verkamp --- lib/nvmf/rdma.c | 11 ++++++----- lib/nvmf/session.c | 2 ++ lib/nvmf/session.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index cff2be2e7..048853830 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -534,7 +534,6 @@ spdk_nvmf_rdma_request_send_completion(struct spdk_nvmf_request *req) { int rc; struct spdk_nvmf_conn *conn = req->conn; - struct spdk_nvmf_rdma_conn *rdma_conn = get_rdma_conn(conn); struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl; struct spdk_nvmf_rdma_session *rdma_sess; struct spdk_nvmf_rdma_buf *buf; @@ -550,9 +549,10 @@ spdk_nvmf_rdma_request_send_completion(struct spdk_nvmf_request *req) } /* Advance our sq_head pointer */ - conn->sq_head++; - if (conn->sq_head == rdma_conn->max_queue_depth) { + if (conn->sq_head == conn->sq_head_max) { conn->sq_head = 0; + } else { + conn->sq_head++; } rsp->sqhd = conn->sq_head; @@ -579,9 +579,10 @@ spdk_nvmf_rdma_request_ack_completion(struct spdk_nvmf_request *req) struct spdk_nvmf_rdma_conn *rdma_conn = get_rdma_conn(conn); /* Advance our sq_head pointer */ - conn->sq_head++; - if (conn->sq_head == rdma_conn->max_queue_depth) { + if (conn->sq_head == conn->sq_head_max) { conn->sq_head = 0; + } else { + conn->sq_head++; } rdma_conn->cur_queue_depth--; diff --git a/lib/nvmf/session.c b/lib/nvmf/session.c index 43c405a01..b8b8a9099 100644 --- a/lib/nvmf/session.c +++ b/lib/nvmf/session.c @@ -223,6 +223,8 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn, return; } + conn->sq_head_max = cmd->sqsize; + if (cmd->qid == 0) { conn->type = CONN_TYPE_AQ; diff --git a/lib/nvmf/session.h b/lib/nvmf/session.h index d3dab744f..db48ccbb4 100644 --- a/lib/nvmf/session.h +++ b/lib/nvmf/session.h @@ -56,6 +56,7 @@ struct spdk_nvmf_conn { enum conn_type type; uint16_t sq_head; + uint16_t sq_head_max; TAILQ_ENTRY(spdk_nvmf_conn) link; };