diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index ea2debc02..b9514f4aa 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -211,7 +211,7 @@ free_rdma_req(struct spdk_nvmf_rdma_request *rdma_req) rte_free(rdma_req); } -void +static void spdk_nvmf_rdma_free_req(struct spdk_nvmf_request *req) { struct spdk_nvmf_rdma_conn *rdma_conn = get_rdma_conn(req->conn); @@ -221,7 +221,7 @@ spdk_nvmf_rdma_free_req(struct spdk_nvmf_request *req) free_rdma_req(rdma_req); } -void +static void spdk_nvmf_rdma_free_reqs(struct spdk_nvmf_conn *conn) { struct spdk_nvmf_rdma_conn *rdma_conn = get_rdma_conn(conn); @@ -503,12 +503,26 @@ spdk_nvmf_rdma_request_complete(struct spdk_nvmf_conn *conn, return 0; } -int +static int spdk_nvmf_rdma_request_release(struct spdk_nvmf_conn *conn, struct spdk_nvmf_request *req) { + struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; - if (nvmf_post_rdma_recv(req->conn, req)) { + if (cmd->opc == SPDK_NVME_OPC_FABRIC) { + struct spdk_nvmf_capsule_cmd *capsule = &req->cmd->nvmf_cmd; + + if (capsule->fctype == SPDK_NVMF_FABRIC_COMMAND_CONNECT) { + /* Special case: connect is always the first capsule and new + * work queue entries are allocated in response to this command. + * Instead of re-posting this entry, just free it. + */ + spdk_nvmf_rdma_free_req(req); + return 0; + } + } + + if (nvmf_post_rdma_recv(conn, req)) { SPDK_ERRLOG("Unable to re-post rx descriptor\n"); return -1; } @@ -1032,7 +1046,7 @@ nvmf_check_rdma_completions(struct spdk_nvmf_conn *conn) SPDK_TRACELOG(SPDK_TRACE_RDMA, "CQ send completion\n"); rdma_req = (struct spdk_nvmf_rdma_request *)wc.wr_id; req = &rdma_req->req; - if (spdk_nvmf_request_release(req)) { + if (spdk_nvmf_rdma_request_release(conn, req)) { return -1; } break; diff --git a/lib/nvmf/rdma.h b/lib/nvmf/rdma.h index 3646df900..d74aaa528 100644 --- a/lib/nvmf/rdma.h +++ b/lib/nvmf/rdma.h @@ -44,12 +44,8 @@ int nvmf_post_rdma_read(struct spdk_nvmf_conn *conn, struct spdk_nvmf_request *req); int spdk_nvmf_rdma_request_complete(struct spdk_nvmf_conn *conn, struct spdk_nvmf_request *req); -int spdk_nvmf_rdma_request_release(struct spdk_nvmf_conn *conn, - struct spdk_nvmf_request *req); int spdk_nvmf_rdma_alloc_reqs(struct spdk_nvmf_conn *conn); -void spdk_nvmf_rdma_free_reqs(struct spdk_nvmf_conn *conn); -void spdk_nvmf_rdma_free_req(struct spdk_nvmf_request *req); void nvmf_rdma_conn_cleanup(struct spdk_nvmf_conn *conn); int nvmf_acceptor_start(void); diff --git a/lib/nvmf/request.c b/lib/nvmf/request.c index b29c8e88e..7689eb69f 100644 --- a/lib/nvmf/request.c +++ b/lib/nvmf/request.c @@ -70,27 +70,6 @@ spdk_nvmf_request_complete(struct spdk_nvmf_request *req) return 0; } -int -spdk_nvmf_request_release(struct spdk_nvmf_request *req) -{ - struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; - struct spdk_nvmf_capsule_cmd *capsule; - - if (cmd->opc == SPDK_NVME_OPC_FABRIC) { - capsule = &req->cmd->nvmf_cmd; - if (capsule->fctype == SPDK_NVMF_FABRIC_COMMAND_CONNECT) { - /* Special case: connect is always the first capsule and new - * work queue entries are allocated in response to this command. - * Instead of re-posting this entry, just free it. - */ - spdk_nvmf_rdma_free_req(req); - return 0; - } - } - - return spdk_nvmf_rdma_request_release(req->conn, req); -} - static bool nvmf_process_discovery_cmd(struct spdk_nvmf_request *req) { diff --git a/lib/nvmf/request.h b/lib/nvmf/request.h index f19d59aac..6601291b2 100644 --- a/lib/nvmf/request.h +++ b/lib/nvmf/request.h @@ -75,6 +75,5 @@ int spdk_nvmf_request_exec(struct spdk_nvmf_request *req); int spdk_nvmf_request_complete(struct spdk_nvmf_request *req); -int spdk_nvmf_request_release(struct spdk_nvmf_request *req); #endif