From c917957bff9b8c3121b8594a4f5e0093caf46d70 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 23 Jun 2016 15:23:39 -0700 Subject: [PATCH] nvmf: Remove rx_desc pointer from tx_desc The nvmf_request structure holds the pair of pointers for rx_desc and tx_desc. Change-Id: I3e735979bbdcdc0e70ad78762e289849d41158ba Signed-off-by: Ben Walker --- lib/nvmf/conn.c | 17 +++++++---------- lib/nvmf/nvmf_internal.h | 4 ++-- lib/nvmf/rdma.c | 7 +++---- lib/nvmf/rdma.h | 1 - 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/nvmf/conn.c b/lib/nvmf/conn.c index 7e0438645..4653925bf 100644 --- a/lib/nvmf/conn.c +++ b/lib/nvmf/conn.c @@ -380,15 +380,15 @@ spdk_nvmf_send_response(struct spdk_nvmf_conn *conn, struct nvmf_request *req) "cpl: cdw0=0x%x rsvd1=0x%x sqhd=0x%x sqid=0x%x cid=0x%x status=0x%x\n", rsp->cdw0, rsp->rsvd1, rsp->sqhd, rsp->sqid, rsp->cid, *(uint16_t *)&rsp->status); - return nvmf_post_rdma_send(conn, req->fabric_tx_ctx); + return nvmf_post_rdma_send(conn, req->tx_desc); } void spdk_nvmf_request_complete(struct nvmf_request *req) { - struct nvme_qp_tx_desc *tx_desc = (struct nvme_qp_tx_desc *)req->fabric_tx_ctx; + struct nvme_qp_tx_desc *tx_desc = req->tx_desc; + struct nvme_qp_rx_desc *rx_desc = req->rx_desc; struct spdk_nvme_cpl *response; - struct nvme_qp_rx_desc *rx_desc = tx_desc->rx_desc; int ret; response = &req->rsp->nvme_cpl; @@ -707,8 +707,8 @@ nvmf_process_fabrics_command(struct spdk_nvmf_conn *conn, struct nvmf_request *r static int spdk_nvmf_request_prep_data(struct nvmf_request *req) { - struct nvme_qp_tx_desc *tx_desc = req->fabric_tx_ctx; - struct nvme_qp_rx_desc *rx_desc = tx_desc->rx_desc; + struct nvme_qp_tx_desc *tx_desc = req->tx_desc; + struct nvme_qp_rx_desc *rx_desc = req->rx_desc; struct spdk_nvmf_conn *conn = tx_desc->conn; struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; enum spdk_nvme_data_transfer xfer; @@ -894,12 +894,11 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc) } tx_desc = STAILQ_FIRST(&conn->qp_tx_desc); nvmf_active_tx_desc(tx_desc); - tx_desc->rx_desc = rx_desc; req = &tx_desc->req_state; req->session = conn->sess; - req->fabric_tx_ctx = tx_desc; - req->fabric_rx_ctx = rx_desc; + req->tx_desc = tx_desc; + req->rx_desc = rx_desc; req->length = 0; req->xfer = SPDK_NVME_DATA_NONE; req->data = NULL; @@ -929,7 +928,6 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc) * there is not a delayed posting because of * command processing. */ - tx_desc->rx_desc = NULL; nvmf_deactive_tx_desc(tx_desc); if (nvmf_post_rdma_recv(conn, rx_desc)) { SPDK_ERRLOG("Unable to re-post aq rx descriptor\n"); @@ -944,7 +942,6 @@ drop_recv: recv_error: /* recover the tx_desc */ if (tx_desc != NULL) { - tx_desc->rx_desc = NULL; nvmf_deactive_tx_desc(tx_desc); } return -1; diff --git a/lib/nvmf/nvmf_internal.h b/lib/nvmf/nvmf_internal.h index 3d29106da..9b2bd3241 100644 --- a/lib/nvmf/nvmf_internal.h +++ b/lib/nvmf/nvmf_internal.h @@ -103,8 +103,8 @@ SPDK_STATIC_ASSERT(sizeof(union nvmf_c2h_msg) == 16, "Incorrect size"); struct nvmf_request { struct nvmf_session *session; - void *fabric_tx_ctx; - void *fabric_rx_ctx; + struct nvme_qp_tx_desc *tx_desc; + struct nvme_qp_rx_desc *rx_desc; uint16_t cid; /* command identifier */ uint64_t remote_addr; uint32_t rkey; diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 2a689491c..3ef152043 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -268,7 +268,7 @@ nvmf_post_rdma_read(struct spdk_nvmf_conn *conn, struct nvme_qp_tx_desc *tx_desc) { struct ibv_send_wr wr, *bad_wr = NULL; - struct nvme_qp_rx_desc *rx_desc = tx_desc->rx_desc; + struct nvme_qp_rx_desc *rx_desc = tx_desc->req_state.rx_desc; struct nvmf_request *req = &tx_desc->req_state; int rc; @@ -306,7 +306,7 @@ nvmf_post_rdma_write(struct spdk_nvmf_conn *conn, struct nvme_qp_tx_desc *tx_desc) { struct ibv_send_wr wr, *bad_wr = NULL; - struct nvme_qp_rx_desc *rx_desc = tx_desc->rx_desc; + struct nvme_qp_rx_desc *rx_desc = tx_desc->req_state.rx_desc; struct nvmf_request *req = &tx_desc->req_state; int rc; @@ -332,7 +332,7 @@ nvmf_post_rdma_send(struct spdk_nvmf_conn *conn, { struct ibv_send_wr wr, *bad_wr = NULL; struct nvmf_request *req = &tx_desc->req_state; - struct nvme_qp_rx_desc *rx_desc = tx_desc->rx_desc; + struct nvme_qp_rx_desc *rx_desc = req->rx_desc; int rc; RTE_VERIFY(rx_desc != NULL); @@ -345,7 +345,6 @@ nvmf_post_rdma_send(struct spdk_nvmf_conn *conn, SPDK_ERRLOG("Unable to re-post rx descriptor\n"); return -1; } - tx_desc->rx_desc = NULL; nvmf_ibv_send_wr_init(&wr, NULL, &tx_desc->send_sgl, (uint64_t)tx_desc, IBV_WR_SEND, IBV_SEND_SIGNALED); diff --git a/lib/nvmf/rdma.h b/lib/nvmf/rdma.h index a8f3ab1f4..d962a6385 100644 --- a/lib/nvmf/rdma.h +++ b/lib/nvmf/rdma.h @@ -60,7 +60,6 @@ struct nvme_qp_tx_desc { struct nvmf_request req_state; struct ibv_mr *msg_buf_mr; struct ibv_sge send_sgl; - struct nvme_qp_rx_desc *rx_desc; STAILQ_ENTRY(nvme_qp_tx_desc) link; };