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 <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-06-23 15:23:39 -07:00
parent 6b10df3576
commit c917957bff
4 changed files with 12 additions and 17 deletions

View File

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

View File

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

View File

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

View File

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