From 8fefa7e9ee5f6657fb6995bf9810e1724fb23310 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 13 Mar 2017 15:29:28 -0700 Subject: [PATCH] nvmf/rdma: Match queue depth math to Linux kernel initiator Change-Id: Iffe8c35ae76f5541aa95480f1aaaf654fcdfeffd Signed-off-by: Ben Walker --- lib/nvmf/rdma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index aa8862650..f4a0dd561 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -257,7 +257,9 @@ spdk_nvmf_rdma_conn_create(struct rdma_cm_id *id, struct ibv_comp_channel *chann TAILQ_INIT(&rdma_conn->pending_data_buf_queue); TAILQ_INIT(&rdma_conn->pending_rdma_rw_queue); - rdma_conn->cq = ibv_create_cq(id->verbs, max_queue_depth * 2, rdma_conn, channel, 0); + /* NOTE: Add one to this value to match the math in the Linux kernel initiator. + * We do not currently understand why they have added one to this value. */ + rdma_conn->cq = ibv_create_cq(id->verbs, (max_queue_depth + 1) * 2, rdma_conn, channel, 0); if (!rdma_conn->cq) { SPDK_ERRLOG("Unable to create completion queue\n"); SPDK_ERRLOG("Completion Channel: %p Id: %p Verbs: %p\n", channel, id, id->verbs); @@ -271,8 +273,12 @@ spdk_nvmf_rdma_conn_create(struct rdma_cm_id *id, struct ibv_comp_channel *chann attr.qp_type = IBV_QPT_RC; attr.send_cq = rdma_conn->cq; attr.recv_cq = rdma_conn->cq; - attr.cap.max_send_wr = max_queue_depth; /* SEND, READ, and WRITE operations */ - attr.cap.max_recv_wr = max_queue_depth; /* RECV operations */ + /* NOTE: The next two values have 1 added to them to match the math in the + * Linux kernel initiator. We currently do not understand why they have + * added one to these values and will continue to investigate. + */ + attr.cap.max_send_wr = max_queue_depth + 1; /* SEND, READ, and WRITE operations */ + attr.cap.max_recv_wr = max_queue_depth + 1; /* RECV operations */ attr.cap.max_send_sge = NVMF_DEFAULT_TX_SGE; attr.cap.max_recv_sge = NVMF_DEFAULT_RX_SGE;