nvmf: make request_release and free_req private

These can be isolated in rdma.c rather than being part of the generic
transport API.

Change-Id: Idc2b969a2f7685420cda2f7c4aa12495ffc3fcbc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-07-11 16:54:37 -07:00
parent 353533e229
commit 411df9ad9b
4 changed files with 19 additions and 31 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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)
{

View File

@ -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