nvme: move qpair is_enabled flag to common layer

Upcoming patches will move the actual is_enabled
logic to the common layer as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9fd4d8712280295f57134ad66f8ccbfe9736d30a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453484
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Jim Harris 2019-05-06 16:19:56 -07:00 committed by Changpeng Liu
parent 74aa552ef9
commit 4dd2fae3ad
2 changed files with 7 additions and 12 deletions

View File

@ -330,6 +330,8 @@ struct spdk_nvme_qpair {
uint8_t qprio;
uint8_t is_enabled : 1;
/*
* Members for handling IO qpair deletion inside of a completion context.
* These are specifically defined as single bits, so that they do not

View File

@ -165,7 +165,6 @@ struct nvme_pcie_qpair {
struct {
uint8_t phase : 1;
uint8_t is_enabled : 1;
uint8_t delay_pcie_doorbell : 1;
uint8_t has_shadow_doorbell : 1;
} flags;
@ -1433,9 +1432,7 @@ nvme_pcie_io_qpair_enable(struct spdk_nvme_qpair *qpair)
int
nvme_pcie_qpair_enable(struct spdk_nvme_qpair *qpair)
{
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
pqpair->flags.is_enabled = true;
qpair->is_enabled = true;
if (nvme_qpair_is_io_queue(qpair)) {
nvme_pcie_io_qpair_enable(qpair);
} else {
@ -1458,9 +1455,7 @@ nvme_pcie_io_qpair_disable(struct spdk_nvme_qpair *qpair)
int
nvme_pcie_qpair_disable(struct spdk_nvme_qpair *qpair)
{
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
pqpair->flags.is_enabled = false;
qpair->is_enabled = false;
if (nvme_qpair_is_io_queue(qpair)) {
nvme_pcie_io_qpair_disable(qpair);
} else {
@ -1982,13 +1977,11 @@ nvme_pcie_qpair_build_prps_sgl_request(struct spdk_nvme_qpair *qpair, struct nvm
static inline bool
nvme_pcie_qpair_check_enabled(struct spdk_nvme_qpair *qpair)
{
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
if (!pqpair->flags.is_enabled &&
if (!qpair->is_enabled &&
!qpair->ctrlr->is_resetting) {
nvme_qpair_enable(qpair);
}
return pqpair->flags.is_enabled;
return qpair->is_enabled;
}
int
@ -2008,7 +2001,7 @@ nvme_pcie_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_reques
tr = TAILQ_FIRST(&pqpair->free_tr);
if (tr == NULL || !pqpair->flags.is_enabled) {
if (tr == NULL || !qpair->is_enabled) {
/*
* No tracker is available, or the qpair is disabled due to
* an in-progress controller-level reset.