nvmf: remove nvmf_request cb_fn field
It is always set to nvmf_process_async_completion and is only used within the library. Also rename nvmf_process_async_completion to spdk_nvmf_request_complete to clarify its purpose. Change-Id: Ie737fb60688329bfe329a8553c4a40ff2e5f8f1d Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
85ee88979d
commit
1d3ee6c5f1
@ -398,8 +398,8 @@ spdk_nvmf_send_response(struct spdk_nvmf_conn *conn, struct nvmf_request *req)
|
||||
return nvmf_post_rdma_send(conn, req->fabric_tx_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_process_async_completion(struct nvmf_request *req)
|
||||
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 spdk_nvme_cpl *response;
|
||||
@ -916,7 +916,6 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc)
|
||||
req->session = conn->sess;
|
||||
req->fabric_tx_ctx = tx_desc;
|
||||
req->fabric_rx_ctx = rx_desc;
|
||||
req->cb_fn = nvmf_process_async_completion;
|
||||
req->length = 0;
|
||||
req->xfer = SPDK_NVME_DATA_NONE;
|
||||
req->data = NULL;
|
||||
|
@ -119,13 +119,13 @@ nvmf_process_admin_cmd(struct nvmf_request *req)
|
||||
}
|
||||
nsdata = spdk_nvme_ns_get_data(ns);
|
||||
memcpy(req->data, (char *)nsdata, sizeof(struct spdk_nvme_ns_data));
|
||||
req->cb_fn(req);
|
||||
spdk_nvmf_request_complete(req);
|
||||
} else if (cmd->cdw10 == 1) {
|
||||
/* identify controller */
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Identify Controller\n");
|
||||
/* pull from virtual controller context */
|
||||
memcpy(req->data, (char *)&session->vcdata, sizeof(struct spdk_nvme_ctrlr_data));
|
||||
req->cb_fn(req);
|
||||
spdk_nvmf_request_complete(req);
|
||||
} else {
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Identify Namespace List\n");
|
||||
response->status.sc = SPDK_NVME_SC_INVALID_OPCODE;
|
||||
|
@ -78,10 +78,6 @@
|
||||
#define TRACE_NVMF_LIB_COMPLETE SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x7)
|
||||
#define TRACE_NVMF_IO_COMPLETE SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x8)
|
||||
|
||||
struct nvmf_request;
|
||||
|
||||
typedef void (*nvmf_cb_fn_t)(struct nvmf_request *);
|
||||
|
||||
union sgl_shift {
|
||||
struct spdk_nvmf_keyed_sgl_descriptor nvmf_sgl;
|
||||
struct spdk_nvme_sgl_descriptor nvme_sgl;
|
||||
@ -123,7 +119,6 @@ struct nvmf_request {
|
||||
void *data;
|
||||
union nvmf_h2c_msg *cmd;
|
||||
union nvmf_c2h_msg *rsp;
|
||||
nvmf_cb_fn_t cb_fn;
|
||||
|
||||
TAILQ_ENTRY(nvmf_request) entries;
|
||||
};
|
||||
@ -169,6 +164,11 @@ struct spdk_nvmf_globals {
|
||||
uint16_t sin_port;
|
||||
};
|
||||
|
||||
/**
|
||||
* Send the response and transfer data from controller to host if required.
|
||||
*/
|
||||
void spdk_nvmf_request_complete(struct nvmf_request *req);
|
||||
|
||||
void
|
||||
nvmf_complete_cmd(void *rsp, const struct spdk_nvme_cpl *cmp);
|
||||
|
||||
|
@ -351,7 +351,7 @@ nvmf_complete_cmd(void *rsp, const struct spdk_nvme_cpl *cmp)
|
||||
response = &req_state->rsp->nvme_cpl;
|
||||
memcpy(response, cmp, sizeof(*cmp));
|
||||
|
||||
req_state->cb_fn(req_state);
|
||||
spdk_nvmf_request_complete(req_state);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -116,18 +116,9 @@ struct spdk_nvmf_host *spdk_nvmf_host_find_by_tag(int tag)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void io_nvmf_cmd_complete(struct nvmf_request *req)
|
||||
void
|
||||
spdk_nvmf_request_complete(struct nvmf_request *req)
|
||||
{
|
||||
struct spdk_nvme_cpl *rsp;
|
||||
|
||||
rsp = &req->rsp->nvme_cpl;
|
||||
CU_ASSERT_EQUAL(rsp->cdw0, 0xff);
|
||||
CU_ASSERT_EQUAL(rsp->status.sc, SPDK_NVME_SC_SUCCESS);
|
||||
}
|
||||
|
||||
static void admin_nvmf_cmd_complete(struct nvmf_request *req)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
@ -534,7 +525,6 @@ nvmf_test_process_io_cmd(void)
|
||||
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
|
||||
@ -588,7 +578,6 @@ nvmf_test_process_admin_cmd(void)
|
||||
nvmf_req.session = sess;
|
||||
nvmf_req.cmd = (union nvmf_h2c_msg *)&nvmf_cmd;
|
||||
nvmf_req.rsp = malloc(sizeof(union nvmf_c2h_msg));
|
||||
nvmf_req.cb_fn = admin_nvmf_cmd_complete;
|
||||
#define BUILD_CMD(cmd_opc, cmd_nsid, cmd_cid, cmd_cdw10) \
|
||||
do { \
|
||||
nvmf_cmd.opc = cmd_opc; \
|
||||
|
Loading…
Reference in New Issue
Block a user