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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-05 15:06:05 -07:00 committed by Ben Walker
parent f279de1f71
commit 184984603f
3 changed files with 9 additions and 5 deletions

View File

@ -534,7 +534,6 @@ spdk_nvmf_rdma_request_send_completion(struct spdk_nvmf_request *req)
{ {
int rc; int rc;
struct spdk_nvmf_conn *conn = req->conn; 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_nvme_cpl *rsp = &req->rsp->nvme_cpl;
struct spdk_nvmf_rdma_session *rdma_sess; struct spdk_nvmf_rdma_session *rdma_sess;
struct spdk_nvmf_rdma_buf *buf; 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 */ /* Advance our sq_head pointer */
conn->sq_head++; if (conn->sq_head == conn->sq_head_max) {
if (conn->sq_head == rdma_conn->max_queue_depth) {
conn->sq_head = 0; conn->sq_head = 0;
} else {
conn->sq_head++;
} }
rsp->sqhd = 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); struct spdk_nvmf_rdma_conn *rdma_conn = get_rdma_conn(conn);
/* Advance our sq_head pointer */ /* Advance our sq_head pointer */
conn->sq_head++; if (conn->sq_head == conn->sq_head_max) {
if (conn->sq_head == rdma_conn->max_queue_depth) {
conn->sq_head = 0; conn->sq_head = 0;
} else {
conn->sq_head++;
} }
rdma_conn->cur_queue_depth--; rdma_conn->cur_queue_depth--;

View File

@ -223,6 +223,8 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
return; return;
} }
conn->sq_head_max = cmd->sqsize;
if (cmd->qid == 0) { if (cmd->qid == 0) {
conn->type = CONN_TYPE_AQ; conn->type = CONN_TYPE_AQ;

View File

@ -56,6 +56,7 @@ struct spdk_nvmf_conn {
enum conn_type type; enum conn_type type;
uint16_t sq_head; uint16_t sq_head;
uint16_t sq_head_max;
TAILQ_ENTRY(spdk_nvmf_conn) link; TAILQ_ENTRY(spdk_nvmf_conn) link;
}; };