nvmf: Move processing of pending RDMA reads into rdma.c

This code is operating on a list owned by the RDMA
connection, so move it to rdma.c

Change-Id: I8b81f9d1ffc1df489c9b698969725ed0d1db6a06
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-06-24 12:35:30 -07:00
parent 5677fe3c8d
commit 41aadf1591
3 changed files with 29 additions and 17 deletions

View File

@ -632,23 +632,9 @@ static int nvmf_check_rdma_completions(struct spdk_nvmf_conn *conn)
goto handler_error;
}
/*
* Check for any pending rdma_reads to start
*/
conn->rdma.pending_rdma_read_count--;
if (!STAILQ_EMPTY(&conn->rdma.qp_pending_desc)) {
tx_desc = STAILQ_FIRST(&conn->rdma.qp_pending_desc);
STAILQ_REMOVE_HEAD(&conn->rdma.qp_pending_desc, link);
STAILQ_INSERT_TAIL(&conn->rdma.qp_tx_active_desc, tx_desc, link);
SPDK_TRACELOG(SPDK_TRACE_RDMA, "Issue rdma read from pending queue: tx_desc %p\n",
tx_desc);
rc = nvmf_post_rdma_read(conn, tx_desc);
if (rc) {
SPDK_ERRLOG("Unable to post pending rdma read descriptor\n");
goto handler_error;
}
rc = nvmf_process_pending_rdma(conn);
if (rc) {
goto handler_error;
}
break;

View File

@ -1070,4 +1070,29 @@ fail:
return -ENOMEM;
}
int
nvmf_process_pending_rdma(struct spdk_nvmf_conn *conn)
{
struct nvme_qp_tx_desc *tx_desc;
int rc;
conn->rdma.pending_rdma_read_count--;
if (!STAILQ_EMPTY(&conn->rdma.qp_pending_desc)) {
tx_desc = STAILQ_FIRST(&conn->rdma.qp_pending_desc);
STAILQ_REMOVE_HEAD(&conn->rdma.qp_pending_desc, link);
STAILQ_INSERT_TAIL(&conn->rdma.qp_tx_active_desc, tx_desc, link);
SPDK_TRACELOG(SPDK_TRACE_RDMA, "Issue rdma read from pending queue: tx_desc %p\n",
tx_desc);
rc = nvmf_post_rdma_read(conn, tx_desc);
if (rc) {
SPDK_ERRLOG("Unable to post pending rdma read descriptor\n");
return -1;
}
}
return 0;
}
SPDK_LOG_REGISTER_TRACE_FLAG("rdma", SPDK_TRACE_RDMA)

View File

@ -88,6 +88,7 @@ int nvmf_post_rdma_recv(struct spdk_nvmf_conn *conn,
struct nvme_qp_rx_desc *rx_desc);
int nvmf_post_rdma_send(struct spdk_nvmf_conn *conn,
struct nvme_qp_tx_desc *tx_desc);
int nvmf_process_pending_rdma(struct spdk_nvmf_conn *conn);
int nvmf_rdma_init(void);
void nvmf_rdma_conn_cleanup(struct spdk_nvmf_conn *conn);