Loading lib/nvmf/conn.c +2 −4 Original line number Diff line number Diff line Loading @@ -403,7 +403,6 @@ nvmf_io_cmd_continue(struct spdk_nvmf_conn *conn, struct nvme_qp_tx_desc *tx_des { struct nvme_qp_rx_desc *rx_desc; struct nvmf_request *req; struct spdk_nvme_cmd *cmd; int ret; Loading @@ -414,11 +413,10 @@ nvmf_io_cmd_continue(struct spdk_nvmf_conn *conn, struct nvme_qp_tx_desc *tx_des } req = &tx_desc->req_state; cmd = &req->cmd->nvme_cmd; req->fabric_rx_ctx = rx_desc; /* send to NVMf library for backend NVMe processing */ ret = nvmf_process_io_cmd(req->session, cmd, req->data, req->length, req); ret = nvmf_process_io_cmd(req); if (ret) { /* library failed the request and should have Updated the response */ Loading Loading @@ -675,7 +673,7 @@ nvmf_process_io_command(struct spdk_nvmf_conn *conn, } /* send to NVMf library for backend NVMe processing */ ret = nvmf_process_io_cmd(req->session, cmd, req->data, req->length, req); ret = nvmf_process_io_cmd(req); if (ret) { /* library failed the request and should have Updated the response */ Loading lib/nvmf/nvmf_io_cmd.c +13 −14 Original line number Diff line number Diff line Loading @@ -42,11 +42,10 @@ #include "spdk/trace.h" int nvmf_process_io_cmd(struct nvmf_session *session, struct spdk_nvme_cmd *cmd, void *buf, uint32_t len, struct nvmf_request *req_state) nvmf_process_io_cmd(struct nvmf_request *req) { struct nvmf_session *session = req->session; struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; struct spdk_nvme_cpl *response; struct spdk_nvmf_subsystem *subsystem = session->subsys; struct spdk_nvmf_namespace *nvmf_ns; Loading @@ -60,10 +59,10 @@ nvmf_process_io_cmd(struct nvmf_session *session, uint32_t io_flags; int rc = 0; SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: req_state %p\n", req_state); SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: req %p\n", req); /* pre-set response details for this command */ response = &req_state->rsp->nvme_cpl; response = &req->rsp->nvme_cpl; response->status.sc = SPDK_NVME_SC_SUCCESS; response->cid = cmd->cid; Loading Loading @@ -108,20 +107,20 @@ nvmf_process_io_cmd(struct nvmf_session *session, SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: Read; lba address %lx, lba count %x\n", lba_address, lba_count); spdk_trace_record(TRACE_NVMF_LIB_READ_START, 0, 0, (uint64_t)req_state->fabric_rx_ctx, 0); (uint64_t)req->fabric_rx_ctx, 0); rc = spdk_nvme_ns_cmd_read(ns, qpair, buf, lba_address, lba_count, req->data, lba_address, lba_count, nvmf_complete_cmd, (void *)req_state, io_flags); req, io_flags); } else { SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: Write; lba address %lx, lba count %x\n", lba_address, lba_count); spdk_trace_record(TRACE_NVMF_LIB_WRITE_START, 0, 0, (uint64_t)req_state->fabric_rx_ctx, 0); (uint64_t)req->fabric_rx_ctx, 0); rc = spdk_nvme_ns_cmd_write(ns, qpair, buf, lba_address, lba_count, req->data, lba_address, lba_count, nvmf_complete_cmd, (void *)req_state, io_flags); req, io_flags); } break; default: Loading @@ -129,9 +128,9 @@ nvmf_process_io_cmd(struct nvmf_session *session, cmd->nsid = nsid; rc = spdk_nvme_ctrlr_cmd_io_raw(ctrlr, qpair, cmd, buf, len, req->data, req->length, nvmf_complete_cmd, (void *)req_state); req); break; } Loading lib/nvmf/session.h +1 −4 Original line number Diff line number Diff line Loading @@ -126,10 +126,7 @@ nvmf_process_admin_cmd(struct nvmf_session *session, struct nvmf_request *req_state); int nvmf_process_io_cmd(struct nvmf_session *session, struct spdk_nvme_cmd *cmd, void *buf, uint32_t len, struct nvmf_request *req_state); nvmf_process_io_cmd(struct nvmf_request *req); void nvmf_property_get(struct nvmf_session *session, Loading test/lib/nvmf/nvmf_c/nvmf_ut.c +11 −8 Original line number Diff line number Diff line Loading @@ -528,44 +528,47 @@ nvmf_test_process_io_cmd(void) struct nvmf_request nvmf_req = {}; struct nvme_read_cdw12 *cdw12; struct spdk_nvmf_subsystem *tmp; int buf_len = 64; uint8_t *buf; nvmf_cmd.opc = SPDK_NVME_OPC_READ; nvmf_cmd.nsid = 2; nvmf_cmd.cid = 3; nvmf_req.cmd = (union nvmf_h2c_msg *)&nvmf_cmd; nvmf_req.rsp = malloc(sizeof(union nvmf_c2h_msg)); nvmf_req.cb_fn = io_nvmf_cmd_complete; nvmf_req.cid = nvmf_cmd.cid; cdw12 = (struct nvme_read_cdw12 *)&nvmf_cmd.cdw12; cdw12->nlb = 16; //read 16 lb, check in nvme read buf = malloc(buf_len); nvmf_req.length = 64; buf = malloc(nvmf_req.length); SPDK_CU_ASSERT_FATAL(buf != NULL); nvmf_req.data = buf; sess = nvmf_find_session_by_id("subsystem1", SS_SC_CNTLID); nvmf_req.session = sess; sess->vcprop.csts.bits.rdy = 1; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), 0); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), 0); CU_ASSERT_STRING_EQUAL(buf, "hello"); nvmf_cmd.cid = 4; nvmf_cmd.opc = SPDK_NVME_OPC_WRITE; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), 0); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), 0); nvmf_cmd.opc = 0xff; nvmf_cmd.cid = 5; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), 0); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), 0); sess->vcprop.csts.bits.rdy = 0; nvmf_cmd.cid = 6; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_req.rsp->nvme_cpl.status.sc, SPDK_NVME_SC_NAMESPACE_NOT_READY); sess->vcprop.csts.bits.rdy = 1; /* nsid = 0 */ nvmf_cmd.nsid = 0; nvmf_cmd.cid = 7; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), -1); CU_ASSERT_NOT_EQUAL(nvmf_req.rsp->nvme_cpl.status.sc, SPDK_NVME_SC_SUCCESS); /* set sess->subsys to NULL */ tmp = sess->subsys; sess->subsys = NULL; nvmf_cmd.nsid = 1; nvmf_cmd.cid = 8; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), -1); CU_ASSERT_NOT_EQUAL(nvmf_req.rsp->nvme_cpl.status.sc, SPDK_NVME_SC_SUCCESS); sess->subsys = tmp; free(buf); Loading Loading
lib/nvmf/conn.c +2 −4 Original line number Diff line number Diff line Loading @@ -403,7 +403,6 @@ nvmf_io_cmd_continue(struct spdk_nvmf_conn *conn, struct nvme_qp_tx_desc *tx_des { struct nvme_qp_rx_desc *rx_desc; struct nvmf_request *req; struct spdk_nvme_cmd *cmd; int ret; Loading @@ -414,11 +413,10 @@ nvmf_io_cmd_continue(struct spdk_nvmf_conn *conn, struct nvme_qp_tx_desc *tx_des } req = &tx_desc->req_state; cmd = &req->cmd->nvme_cmd; req->fabric_rx_ctx = rx_desc; /* send to NVMf library for backend NVMe processing */ ret = nvmf_process_io_cmd(req->session, cmd, req->data, req->length, req); ret = nvmf_process_io_cmd(req); if (ret) { /* library failed the request and should have Updated the response */ Loading Loading @@ -675,7 +673,7 @@ nvmf_process_io_command(struct spdk_nvmf_conn *conn, } /* send to NVMf library for backend NVMe processing */ ret = nvmf_process_io_cmd(req->session, cmd, req->data, req->length, req); ret = nvmf_process_io_cmd(req); if (ret) { /* library failed the request and should have Updated the response */ Loading
lib/nvmf/nvmf_io_cmd.c +13 −14 Original line number Diff line number Diff line Loading @@ -42,11 +42,10 @@ #include "spdk/trace.h" int nvmf_process_io_cmd(struct nvmf_session *session, struct spdk_nvme_cmd *cmd, void *buf, uint32_t len, struct nvmf_request *req_state) nvmf_process_io_cmd(struct nvmf_request *req) { struct nvmf_session *session = req->session; struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd; struct spdk_nvme_cpl *response; struct spdk_nvmf_subsystem *subsystem = session->subsys; struct spdk_nvmf_namespace *nvmf_ns; Loading @@ -60,10 +59,10 @@ nvmf_process_io_cmd(struct nvmf_session *session, uint32_t io_flags; int rc = 0; SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: req_state %p\n", req_state); SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: req %p\n", req); /* pre-set response details for this command */ response = &req_state->rsp->nvme_cpl; response = &req->rsp->nvme_cpl; response->status.sc = SPDK_NVME_SC_SUCCESS; response->cid = cmd->cid; Loading Loading @@ -108,20 +107,20 @@ nvmf_process_io_cmd(struct nvmf_session *session, SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: Read; lba address %lx, lba count %x\n", lba_address, lba_count); spdk_trace_record(TRACE_NVMF_LIB_READ_START, 0, 0, (uint64_t)req_state->fabric_rx_ctx, 0); (uint64_t)req->fabric_rx_ctx, 0); rc = spdk_nvme_ns_cmd_read(ns, qpair, buf, lba_address, lba_count, req->data, lba_address, lba_count, nvmf_complete_cmd, (void *)req_state, io_flags); req, io_flags); } else { SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_process_io_cmd: Write; lba address %lx, lba count %x\n", lba_address, lba_count); spdk_trace_record(TRACE_NVMF_LIB_WRITE_START, 0, 0, (uint64_t)req_state->fabric_rx_ctx, 0); (uint64_t)req->fabric_rx_ctx, 0); rc = spdk_nvme_ns_cmd_write(ns, qpair, buf, lba_address, lba_count, req->data, lba_address, lba_count, nvmf_complete_cmd, (void *)req_state, io_flags); req, io_flags); } break; default: Loading @@ -129,9 +128,9 @@ nvmf_process_io_cmd(struct nvmf_session *session, cmd->nsid = nsid; rc = spdk_nvme_ctrlr_cmd_io_raw(ctrlr, qpair, cmd, buf, len, req->data, req->length, nvmf_complete_cmd, (void *)req_state); req); break; } Loading
lib/nvmf/session.h +1 −4 Original line number Diff line number Diff line Loading @@ -126,10 +126,7 @@ nvmf_process_admin_cmd(struct nvmf_session *session, struct nvmf_request *req_state); int nvmf_process_io_cmd(struct nvmf_session *session, struct spdk_nvme_cmd *cmd, void *buf, uint32_t len, struct nvmf_request *req_state); nvmf_process_io_cmd(struct nvmf_request *req); void nvmf_property_get(struct nvmf_session *session, Loading
test/lib/nvmf/nvmf_c/nvmf_ut.c +11 −8 Original line number Diff line number Diff line Loading @@ -528,44 +528,47 @@ nvmf_test_process_io_cmd(void) struct nvmf_request nvmf_req = {}; struct nvme_read_cdw12 *cdw12; struct spdk_nvmf_subsystem *tmp; int buf_len = 64; uint8_t *buf; nvmf_cmd.opc = SPDK_NVME_OPC_READ; nvmf_cmd.nsid = 2; nvmf_cmd.cid = 3; nvmf_req.cmd = (union nvmf_h2c_msg *)&nvmf_cmd; nvmf_req.rsp = malloc(sizeof(union nvmf_c2h_msg)); nvmf_req.cb_fn = io_nvmf_cmd_complete; nvmf_req.cid = nvmf_cmd.cid; cdw12 = (struct nvme_read_cdw12 *)&nvmf_cmd.cdw12; cdw12->nlb = 16; //read 16 lb, check in nvme read buf = malloc(buf_len); nvmf_req.length = 64; buf = malloc(nvmf_req.length); SPDK_CU_ASSERT_FATAL(buf != NULL); nvmf_req.data = buf; sess = nvmf_find_session_by_id("subsystem1", SS_SC_CNTLID); nvmf_req.session = sess; sess->vcprop.csts.bits.rdy = 1; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), 0); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), 0); CU_ASSERT_STRING_EQUAL(buf, "hello"); nvmf_cmd.cid = 4; nvmf_cmd.opc = SPDK_NVME_OPC_WRITE; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), 0); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), 0); nvmf_cmd.opc = 0xff; nvmf_cmd.cid = 5; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), 0); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), 0); sess->vcprop.csts.bits.rdy = 0; nvmf_cmd.cid = 6; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_req.rsp->nvme_cpl.status.sc, SPDK_NVME_SC_NAMESPACE_NOT_READY); sess->vcprop.csts.bits.rdy = 1; /* nsid = 0 */ nvmf_cmd.nsid = 0; nvmf_cmd.cid = 7; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), -1); CU_ASSERT_NOT_EQUAL(nvmf_req.rsp->nvme_cpl.status.sc, SPDK_NVME_SC_SUCCESS); /* set sess->subsys to NULL */ tmp = sess->subsys; sess->subsys = NULL; nvmf_cmd.nsid = 1; nvmf_cmd.cid = 8; CU_ASSERT_EQUAL(nvmf_process_io_cmd(sess, &nvmf_cmd, buf, buf_len, &nvmf_req), -1); CU_ASSERT_EQUAL(nvmf_process_io_cmd(&nvmf_req), -1); CU_ASSERT_NOT_EQUAL(nvmf_req.rsp->nvme_cpl.status.sc, SPDK_NVME_SC_SUCCESS); sess->subsys = tmp; free(buf); Loading