Commit 411df9ad authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 353533e2
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -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 (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(req->conn, req)) {
	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;
+0 −4
Original line number Diff line number Diff line
@@ -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);
+0 −21
Original line number Diff line number Diff line
@@ -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)
{
+0 −1
Original line number Diff line number Diff line
@@ -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