nvmf: Keep track of outstanding requests
This will allow us to later quiesce all requests for a given subsystem. Change-Id: I50a4df9bf1f65a2fc6668295cf9978d2099f6507 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/406450 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
16d0fbd0d6
commit
7740b02e36
@ -549,6 +549,7 @@ spdk_nvmf_poll_group_add_subsystem(struct spdk_nvmf_poll_group *group,
|
|||||||
sgroup = &group->sgroups[subsystem->id];
|
sgroup = &group->sgroups[subsystem->id];
|
||||||
sgroup->state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
|
sgroup->state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
|
||||||
TAILQ_INIT(&sgroup->queued);
|
TAILQ_INIT(&sgroup->queued);
|
||||||
|
TAILQ_INIT(&sgroup->outstanding);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ struct spdk_nvmf_subsystem_poll_group {
|
|||||||
enum spdk_nvmf_subsystem_state state;
|
enum spdk_nvmf_subsystem_state state;
|
||||||
|
|
||||||
TAILQ_HEAD(, spdk_nvmf_request) queued;
|
TAILQ_HEAD(, spdk_nvmf_request) queued;
|
||||||
|
TAILQ_HEAD(, spdk_nvmf_request) outstanding;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spdk_nvmf_poll_group {
|
struct spdk_nvmf_poll_group {
|
||||||
|
@ -49,6 +49,7 @@ int
|
|||||||
spdk_nvmf_request_complete(struct spdk_nvmf_request *req)
|
spdk_nvmf_request_complete(struct spdk_nvmf_request *req)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
|
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
|
||||||
|
struct spdk_nvmf_capsule_cmd *cap_hdr;
|
||||||
|
|
||||||
rsp->sqid = 0;
|
rsp->sqid = 0;
|
||||||
rsp->status.p = 0;
|
rsp->status.p = 0;
|
||||||
@ -59,6 +60,18 @@ spdk_nvmf_request_complete(struct spdk_nvmf_request *req)
|
|||||||
rsp->cid, rsp->cdw0, rsp->rsvd1,
|
rsp->cid, rsp->cdw0, rsp->rsvd1,
|
||||||
*(uint16_t *)&rsp->status);
|
*(uint16_t *)&rsp->status);
|
||||||
|
|
||||||
|
cap_hdr = &req->cmd->nvmf_cmd;
|
||||||
|
|
||||||
|
if (spdk_unlikely(req->cmd->nvmf_cmd.opcode == SPDK_NVME_OPC_FABRIC &&
|
||||||
|
cap_hdr->fctype == SPDK_NVMF_FABRIC_COMMAND_CONNECT)) {
|
||||||
|
/* CONNECT commands don't actually get placed on the outstanding list. */
|
||||||
|
} else {
|
||||||
|
struct spdk_nvmf_subsystem_poll_group *sgroup;
|
||||||
|
|
||||||
|
sgroup = &req->qpair->group->sgroups[req->qpair->ctrlr->subsys->id];
|
||||||
|
TAILQ_REMOVE(&sgroup->outstanding, req, link);
|
||||||
|
}
|
||||||
|
|
||||||
if (spdk_nvmf_transport_req_complete(req)) {
|
if (spdk_nvmf_transport_req_complete(req)) {
|
||||||
SPDK_ERRLOG("Transport request completion error!\n");
|
SPDK_ERRLOG("Transport request completion error!\n");
|
||||||
}
|
}
|
||||||
@ -126,6 +139,9 @@ spdk_nvmf_request_exec(struct spdk_nvmf_request *req)
|
|||||||
TAILQ_INSERT_TAIL(&sgroup->queued, req, link);
|
TAILQ_INSERT_TAIL(&sgroup->queued, req, link);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Place the request on the outstanding list so we can keep track of it */
|
||||||
|
TAILQ_INSERT_TAIL(&sgroup->outstanding, req, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spdk_unlikely(req->cmd->nvmf_cmd.opcode == SPDK_NVME_OPC_FABRIC)) {
|
if (spdk_unlikely(req->cmd->nvmf_cmd.opcode == SPDK_NVME_OPC_FABRIC)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user