diff --git a/lib/nvmf/conn.c b/lib/nvmf/conn.c index 660e9c73fb..e505c4b0e3 100644 --- a/lib/nvmf/conn.c +++ b/lib/nvmf/conn.c @@ -430,7 +430,7 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc) struct nvme_qp_rx_desc *rx_desc; struct nvme_qp_tx_desc *tx_desc; struct spdk_nvmf_capsule_cmd *cap_hdr; - struct nvmf_request *req; + struct spdk_nvmf_request *req; int ret; rx_desc = (struct nvme_qp_rx_desc *)wc->wr_id; @@ -450,7 +450,7 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc) tx_desc = STAILQ_FIRST(&conn->rdma.qp_tx_desc); nvmf_active_tx_desc(tx_desc); - req = &tx_desc->req_state; + req = &tx_desc->req; req->conn = conn; req->tx_desc = tx_desc; req->rx_desc = rx_desc; @@ -490,7 +490,7 @@ static int nvmf_check_rdma_completions(struct spdk_nvmf_conn *conn) { struct ibv_wc wc; struct nvme_qp_tx_desc *tx_desc; - struct nvmf_request *req; + struct spdk_nvmf_request *req; int rc; int cq_count = 0; int i; @@ -531,14 +531,14 @@ static int nvmf_check_rdma_completions(struct spdk_nvmf_conn *conn) */ SPDK_TRACELOG(SPDK_TRACE_RDMA, "\nCQ rdma write completion\n"); tx_desc = (struct nvme_qp_tx_desc *)wc.wr_id; - req = &tx_desc->req_state; + req = &tx_desc->req; spdk_trace_record(TRACE_RDMA_WRITE_COMPLETE, 0, 0, (uint64_t)req, 0); break; case IBV_WC_RDMA_READ: SPDK_TRACELOG(SPDK_TRACE_RDMA, "\nCQ rdma read completion\n"); tx_desc = (struct nvme_qp_tx_desc *)wc.wr_id; - req = &tx_desc->req_state; + req = &tx_desc->req; spdk_trace_record(TRACE_RDMA_READ_COMPLETE, 0, 0, (uint64_t)req, 0); rc = spdk_nvmf_request_exec(req); if (rc) { diff --git a/lib/nvmf/controller.c b/lib/nvmf/controller.c index e2d7a3e199..ea3749d37a 100644 --- a/lib/nvmf/controller.c +++ b/lib/nvmf/controller.c @@ -77,15 +77,15 @@ spdk_nvmf_complete_ctrlr_aer(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nv subsystem = g_whitelist[i].subsystem; TAILQ_FOREACH(sess, &subsystem->sessions, entries) { - if (sess->aer_req_state == NULL) { + if (sess->aer_req == NULL) { continue; } - SPDK_TRACELOG(SPDK_TRACE_NVMF, "Process session AER request, sess %p, req_state %p\n", - sess, sess->aer_req_state); - nvmf_complete_cmd(sess->aer_req_state, cpl); + SPDK_TRACELOG(SPDK_TRACE_NVMF, "Process session AER request, sess %p, req %p\n", + sess, sess->aer_req); + nvmf_complete_cmd(sess->aer_req, cpl); /* clear this AER from the session */ - sess->aer_req_state = NULL; + sess->aer_req = NULL; } } } diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 851d931bc7..d5a9675615 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -255,7 +255,7 @@ nvmf_trace_ibv_sge(struct ibv_sge *sg_list) static void nvmf_ibv_send_wr_init(struct ibv_send_wr *wr, - struct nvmf_request *req, + struct spdk_nvmf_request *req, struct ibv_sge *sg_list, uint64_t wr_id, enum ibv_wr_opcode opcode, @@ -286,7 +286,7 @@ nvmf_ibv_send_wr_init(struct ibv_send_wr *wr, int nvmf_post_rdma_read(struct spdk_nvmf_conn *conn, - struct nvmf_request *req) + struct spdk_nvmf_request *req) { struct ibv_send_wr wr, *bad_wr = NULL; struct nvme_qp_tx_desc *tx_desc = req->tx_desc; @@ -328,7 +328,7 @@ nvmf_post_rdma_read(struct spdk_nvmf_conn *conn, static int nvmf_post_rdma_write(struct spdk_nvmf_conn *conn, - struct nvmf_request *req) + struct spdk_nvmf_request *req) { struct ibv_send_wr wr, *bad_wr = NULL; struct nvme_qp_tx_desc *tx_desc = req->tx_desc; @@ -356,7 +356,7 @@ nvmf_post_rdma_write(struct spdk_nvmf_conn *conn, static int nvmf_post_rdma_send(struct spdk_nvmf_conn *conn, - struct nvmf_request *req) + struct spdk_nvmf_request *req) { struct ibv_send_wr wr, *bad_wr = NULL; struct nvme_qp_tx_desc *tx_desc = req->tx_desc; @@ -377,7 +377,7 @@ nvmf_post_rdma_send(struct spdk_nvmf_conn *conn, nvmf_ibv_send_wr_init(&wr, NULL, &tx_desc->send_sgl, (uint64_t)tx_desc, IBV_WR_SEND, IBV_SEND_SIGNALED); - SPDK_TRACELOG(SPDK_TRACE_RDMA, "tx_desc %p: req_state %p, rsp %p\n", + SPDK_TRACELOG(SPDK_TRACE_RDMA, "tx_desc %p: req %p, rsp %p\n", tx_desc, req, req->rsp); spdk_trace_record(TRACE_NVMF_IO_COMPLETE, 0, 0, (uint64_t)req, 0); @@ -389,7 +389,7 @@ nvmf_post_rdma_send(struct spdk_nvmf_conn *conn, } int -spdk_nvmf_rdma_request_complete(struct spdk_nvmf_conn *conn, struct nvmf_request *req) +spdk_nvmf_rdma_request_complete(struct spdk_nvmf_conn *conn, struct spdk_nvmf_request *req) { struct nvme_qp_tx_desc *tx_desc = req->tx_desc; struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl; @@ -1070,10 +1070,10 @@ alloc_qp_tx_desc(struct spdk_nvmf_conn *conn) tx_desc->send_sgl.lkey = tx_desc->rsp_mr->lkey; /* init request state associated with each tx_desc */ - tx_desc->req_state.rsp = &tx_desc->rsp; - SPDK_TRACELOG(SPDK_TRACE_DEBUG, "tx_desc %p: req_state %p, rsp %p\n", - tx_desc, &tx_desc->req_state, - tx_desc->req_state.rsp); + tx_desc->req.rsp = &tx_desc->rsp; + SPDK_TRACELOG(SPDK_TRACE_DEBUG, "tx_desc %p: req %p, rsp %p\n", + tx_desc, &tx_desc->req, + tx_desc->req.rsp); STAILQ_INSERT_TAIL(&conn->rdma.qp_tx_desc, tx_desc, link); } @@ -1122,7 +1122,7 @@ nvmf_process_pending_rdma(struct spdk_nvmf_conn *conn) 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->req_state); + rc = nvmf_post_rdma_read(conn, &tx_desc->req); if (rc) { SPDK_ERRLOG("Unable to post pending rdma read descriptor\n"); return -1; diff --git a/lib/nvmf/rdma.h b/lib/nvmf/rdma.h index 16ef3eb346..fb4e6d3167 100644 --- a/lib/nvmf/rdma.h +++ b/lib/nvmf/rdma.h @@ -76,20 +76,20 @@ struct nvme_qp_rx_desc { }; struct nvme_qp_tx_desc { - union nvmf_c2h_msg rsp; - struct spdk_nvmf_conn *conn; - struct nvmf_request req_state; - struct ibv_mr *rsp_mr; - struct ibv_sge send_sgl; + union nvmf_c2h_msg rsp; + struct spdk_nvmf_conn *conn; + struct spdk_nvmf_request req; + struct ibv_mr *rsp_mr; + struct ibv_sge send_sgl; STAILQ_ENTRY(nvme_qp_tx_desc) link; }; int nvmf_post_rdma_read(struct spdk_nvmf_conn *conn, - struct nvmf_request *req); + struct spdk_nvmf_request *req); int nvmf_post_rdma_recv(struct spdk_nvmf_conn *conn, struct nvme_qp_rx_desc *rx_desc); int spdk_nvmf_rdma_request_complete(struct spdk_nvmf_conn *conn, - struct nvmf_request *req); + struct spdk_nvmf_request *req); 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); diff --git a/lib/nvmf/request.c b/lib/nvmf/request.c index ce43316ffe..21c71d3708 100644 --- a/lib/nvmf/request.c +++ b/lib/nvmf/request.c @@ -48,7 +48,7 @@ #include "spdk/trace.h" int -spdk_nvmf_request_complete(struct nvmf_request *req) +spdk_nvmf_request_complete(struct spdk_nvmf_request *req) { struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl; @@ -73,7 +73,7 @@ spdk_nvmf_request_complete(struct nvmf_request *req) } static int -nvmf_process_admin_cmd(struct nvmf_request *req) +nvmf_process_admin_cmd(struct spdk_nvmf_request *req) { struct nvmf_session *session = req->conn->sess; struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; @@ -207,8 +207,8 @@ nvmf_process_admin_cmd(struct nvmf_request *req) Trap request here and save in the session context until NVMe library indicates some event. */ - if (session->aer_req_state == NULL) { - session->aer_req_state = req; + if (session->aer_req == NULL) { + session->aer_req = req; } else { /* AER already recorded, send error response */ SPDK_TRACELOG(SPDK_TRACE_NVMF, "AER already active!\n"); @@ -260,7 +260,7 @@ passthrough: } static int -nvmf_process_admin_command(struct nvmf_request *req) +nvmf_process_admin_command(struct spdk_nvmf_request *req) { int ret; @@ -280,7 +280,7 @@ nvmf_process_admin_command(struct nvmf_request *req) } static int -nvmf_process_io_cmd(struct nvmf_request *req) +nvmf_process_io_cmd(struct spdk_nvmf_request *req) { struct nvmf_session *session = req->conn->sess; struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; @@ -378,7 +378,7 @@ nvmf_process_io_cmd(struct nvmf_request *req) } static int -nvmf_process_io_command(struct nvmf_request *req) +nvmf_process_io_command(struct spdk_nvmf_request *req) { int ret; @@ -399,7 +399,7 @@ nvmf_process_io_command(struct nvmf_request *req) } static int -nvmf_process_property_get(struct nvmf_request *req) +nvmf_process_property_get(struct spdk_nvmf_request *req) { struct spdk_nvmf_fabric_prop_get_rsp *response; struct spdk_nvmf_fabric_prop_get_cmd *cmd; @@ -422,7 +422,7 @@ nvmf_process_property_get(struct nvmf_request *req) } static int -nvmf_process_property_set(struct nvmf_request *req) +nvmf_process_property_set(struct spdk_nvmf_request *req) { struct spdk_nvmf_fabric_prop_set_rsp *response; struct spdk_nvmf_fabric_prop_set_cmd *cmd; @@ -453,7 +453,7 @@ nvmf_process_property_set(struct nvmf_request *req) } static int -nvmf_process_connect(struct nvmf_request *req) +nvmf_process_connect(struct spdk_nvmf_request *req) { struct spdk_nvmf_fabric_connect_cmd *connect; struct spdk_nvmf_fabric_connect_data *connect_data; @@ -522,7 +522,7 @@ nvmf_process_connect(struct nvmf_request *req) } static int -nvmf_process_fabrics_command(struct nvmf_request *req) +nvmf_process_fabrics_command(struct spdk_nvmf_request *req) { struct spdk_nvmf_capsule_cmd *cap_hdr; @@ -544,7 +544,7 @@ nvmf_process_fabrics_command(struct nvmf_request *req) } int -spdk_nvmf_request_prep_data(struct nvmf_request *req, +spdk_nvmf_request_prep_data(struct spdk_nvmf_request *req, void *in_cap_data, uint32_t in_cap_len, void *bb, uint32_t bb_len) { @@ -659,7 +659,7 @@ spdk_nvmf_request_prep_data(struct nvmf_request *req, } int -spdk_nvmf_request_exec(struct nvmf_request *req) +spdk_nvmf_request_exec(struct spdk_nvmf_request *req) { struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; diff --git a/lib/nvmf/request.h b/lib/nvmf/request.h index 1bcf1c9004..b00fee5812 100644 --- a/lib/nvmf/request.h +++ b/lib/nvmf/request.h @@ -57,7 +57,7 @@ SPDK_STATIC_ASSERT(sizeof(union nvmf_c2h_msg) == 16, "Incorrect size"); #define NVMF_H2C_MAX_MSG (sizeof(union nvmf_h2c_msg)) #define NVMF_C2H_MAX_MSG (sizeof(union nvmf_c2h_msg)) -struct nvmf_request { +struct spdk_nvmf_request { struct spdk_nvmf_conn *conn; struct nvme_qp_tx_desc *tx_desc; struct nvme_qp_rx_desc *rx_desc; @@ -70,17 +70,17 @@ struct nvmf_request { union nvmf_h2c_msg *cmd; union nvmf_c2h_msg *rsp; - TAILQ_ENTRY(nvmf_request) entries; + TAILQ_ENTRY(spdk_nvmf_request) entries; }; int -spdk_nvmf_request_prep_data(struct nvmf_request *req, +spdk_nvmf_request_prep_data(struct spdk_nvmf_request *req, void *in_cap_data, uint32_t in_cap_len, void *bb, uint32_t bb_len); int -spdk_nvmf_request_exec(struct nvmf_request *req); +spdk_nvmf_request_exec(struct spdk_nvmf_request *req); -int spdk_nvmf_request_complete(struct nvmf_request *req); +int spdk_nvmf_request_complete(struct spdk_nvmf_request *req); #endif diff --git a/lib/nvmf/session.c b/lib/nvmf/session.c index 219ae94663..f3208d3a45 100644 --- a/lib/nvmf/session.c +++ b/lib/nvmf/session.c @@ -329,18 +329,18 @@ nvmf_disconnect(void *fabric_conn, } void -nvmf_complete_cmd(void *rsp, const struct spdk_nvme_cpl *cmp) +nvmf_complete_cmd(void *ctx, const struct spdk_nvme_cpl *cmp) { - struct nvmf_request *req_state = (struct nvmf_request *)rsp; + struct spdk_nvmf_request *req = ctx; struct spdk_nvme_cpl *response; - spdk_trace_record(TRACE_NVMF_LIB_COMPLETE, 0, 0, (uint64_t)req_state, 0); - SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_complete_cmd callback: req_state %p\n", req_state); + spdk_trace_record(TRACE_NVMF_LIB_COMPLETE, 0, 0, (uint64_t)req, 0); + SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_complete_cmd callback: req %p\n", req); - response = &req_state->rsp->nvme_cpl; + response = &req->rsp->nvme_cpl; memcpy(response, cmp, sizeof(*cmp)); - spdk_nvmf_request_complete(req_state); + spdk_nvmf_request_complete(req); } void diff --git a/lib/nvmf/session.h b/lib/nvmf/session.h index 78989bf5b8..95d3b5fd1d 100644 --- a/lib/nvmf/session.h +++ b/lib/nvmf/session.h @@ -95,7 +95,7 @@ struct nvmf_session { int num_connections; int max_connections_allowed; - struct nvmf_request *aer_req_state; + struct spdk_nvmf_request *aer_req; TAILQ_ENTRY(nvmf_session) entries; }; diff --git a/test/lib/nvmf/nvmf_c/nvmf_ut.c b/test/lib/nvmf/nvmf_c/nvmf_ut.c index 8f31fca4d9..8b5b434435 100644 --- a/test/lib/nvmf/nvmf_c/nvmf_ut.c +++ b/test/lib/nvmf/nvmf_c/nvmf_ut.c @@ -117,7 +117,7 @@ struct spdk_nvmf_host *spdk_nvmf_host_find_by_tag(int tag) } int -spdk_nvmf_request_complete(struct nvmf_request *req) +spdk_nvmf_request_complete(struct spdk_nvmf_request *req) { return 0; } @@ -517,7 +517,7 @@ nvmf_test_process_io_cmd(void) { struct spdk_nvme_cmd nvmf_cmd = {}; struct nvmf_session *sess; - struct nvmf_request nvmf_req = {}; + struct spdk_nvmf_request nvmf_req = {}; struct nvme_read_cdw12 *cdw12; struct spdk_nvmf_subsystem *tmp; uint8_t *buf; @@ -571,7 +571,7 @@ nvmf_test_process_admin_cmd(void) { struct spdk_nvme_cmd nvmf_cmd = {}; struct nvmf_session *sess; - struct nvmf_request nvmf_req = {}; + struct spdk_nvmf_request nvmf_req = {}; struct spdk_nvmf_subsystem *subsystem; int buf_len = sizeof(struct spdk_nvme_ns_data);