From 6d98264552a992f513664bc20fdc5031f5ddead1 Mon Sep 17 00:00:00 2001 From: Philipp Skadorov Date: Wed, 13 Dec 2017 09:27:32 -0500 Subject: [PATCH] nvmf/rdma: decrement r/w counter if ibv_post_send fails The outstanding r/w requests counter is not decremented back if IB r/w request fails. As the result, the rdma qpair stops pumping the requests after the number of ibv_post_send failures reaches the threshold for outstanding r/w requests for that qpair. The patch decrements qpair's r/w counter back in case of ibv_post_send returns an error. Change-Id: I8fa0f2905974a50037034962e4d2a001290a06a9 Signed-off-by: Philipp Skadorov Reviewed-on: https://review.gerrithub.io/391799 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/nvmf/rdma.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 2b1931752..c23d2d17c 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -486,6 +486,11 @@ request_transfer_in(struct spdk_nvmf_request *req) rc = ibv_post_send(rqpair->cm_id->qp, &rdma_req->data.wr, &bad_wr); if (rc) { SPDK_ERRLOG("Unable to transfer data from host to target\n"); + + /* Decrement r/w counter back since data transfer + * has not started. + */ + rqpair->cur_rdma_rw_depth--; return -1; } @@ -552,6 +557,13 @@ request_transfer_out(struct spdk_nvmf_request *req) rc = ibv_post_send(rqpair->cm_id->qp, send_wr, &bad_send_wr); if (rc) { SPDK_ERRLOG("Unable to send response capsule\n"); + + if (rdma_req->data.wr.opcode == IBV_WR_RDMA_WRITE) { + /* Decrement r/w counter back since data transfer + * has not started. + */ + rqpair->cur_rdma_rw_depth--; + } } return rc;