nvmf: Add spdk_nvmf_ctrlr_process_io_fused_cmd
Move fused cmd related code from spdk_nvmf_ctrlr_process_io_cmd to separate function. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: Ic662a968b054f05db7f6e1cf4fa9aa13f6fb7c40 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481942 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
941d9e7aa8
commit
87be077d0b
@ -471,7 +471,7 @@ enum spdk_nvme_cmd_fuse {
|
||||
SPDK_NVME_CMD_FUSE_NONE = 0x0, /**< normal operation */
|
||||
SPDK_NVME_CMD_FUSE_FIRST = 0x1, /**< fused operation, first command */
|
||||
SPDK_NVME_CMD_FUSE_SECOND = 0x2, /**< fused operation, second command */
|
||||
/* 0x3 - reserved */
|
||||
SPDK_NVME_CMD_FUSE_MASK = 0x3, /**< fused operation flags mask */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2446,23 +2446,12 @@ exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
|
||||
static int
|
||||
spdk_nvmf_ctrlr_process_io_fused_cmd(struct spdk_nvmf_request *req, struct spdk_bdev *bdev,
|
||||
struct spdk_bdev_desc *desc, struct spdk_io_channel *ch)
|
||||
{
|
||||
uint32_t nsid;
|
||||
struct spdk_nvmf_ns *ns;
|
||||
struct spdk_bdev *bdev;
|
||||
struct spdk_bdev_desc *desc;
|
||||
struct spdk_io_channel *ch;
|
||||
struct spdk_nvmf_poll_group *group = req->qpair->group;
|
||||
struct spdk_nvmf_ctrlr *ctrlr = req->qpair->ctrlr;
|
||||
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
|
||||
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
|
||||
struct spdk_nvmf_subsystem_pg_ns_info *ns_info;
|
||||
|
||||
/* pre-set response details for this command */
|
||||
response->status.sc = SPDK_NVME_SC_SUCCESS;
|
||||
nsid = cmd->nsid;
|
||||
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
|
||||
|
||||
if (cmd->fuse == SPDK_NVME_CMD_FUSE_FIRST) {
|
||||
/* first fused operation (should be compare) */
|
||||
@ -2481,8 +2470,8 @@ spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
|
||||
/* second fused operation */
|
||||
if (req->qpair->first_fused_req == NULL) {
|
||||
SPDK_ERRLOG("Wrong sequence of fused operations\n");
|
||||
response->status.sct = SPDK_NVME_SCT_GENERIC;
|
||||
response->status.sc = SPDK_NVME_SC_ABORTED_MISSING_FUSED;
|
||||
rsp->status.sct = SPDK_NVME_SCT_GENERIC;
|
||||
rsp->status.sc = SPDK_NVME_SC_ABORTED_MISSING_FUSED;
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
@ -2491,6 +2480,27 @@ spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
|
||||
req->qpair->first_fused_req = NULL;
|
||||
}
|
||||
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
|
||||
{
|
||||
uint32_t nsid;
|
||||
struct spdk_nvmf_ns *ns;
|
||||
struct spdk_bdev *bdev;
|
||||
struct spdk_bdev_desc *desc;
|
||||
struct spdk_io_channel *ch;
|
||||
struct spdk_nvmf_poll_group *group = req->qpair->group;
|
||||
struct spdk_nvmf_ctrlr *ctrlr = req->qpair->ctrlr;
|
||||
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
|
||||
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
|
||||
struct spdk_nvmf_subsystem_pg_ns_info *ns_info;
|
||||
|
||||
/* pre-set response details for this command */
|
||||
response->status.sc = SPDK_NVME_SC_SUCCESS;
|
||||
nsid = cmd->nsid;
|
||||
|
||||
if (spdk_unlikely(ctrlr == NULL)) {
|
||||
SPDK_ERRLOG("I/O command sent before CONNECT\n");
|
||||
response->status.sct = SPDK_NVME_SCT_GENERIC;
|
||||
@ -2525,6 +2535,11 @@ spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
|
||||
bdev = ns->bdev;
|
||||
desc = ns->desc;
|
||||
ch = ns_info->channel;
|
||||
|
||||
if (spdk_unlikely(cmd->fuse & SPDK_NVME_CMD_FUSE_MASK)) {
|
||||
return spdk_nvmf_ctrlr_process_io_fused_cmd(req, bdev, desc, ch);
|
||||
}
|
||||
|
||||
switch (cmd->opc) {
|
||||
case SPDK_NVME_OPC_READ:
|
||||
return spdk_nvmf_bdev_ctrlr_read_cmd(bdev, desc, ch, req);
|
||||
|
Loading…
Reference in New Issue
Block a user