Commit 4dd2fae3 authored by Jim Harris's avatar Jim Harris Committed by Changpeng Liu
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I9fd4d8712280295f57134ad66f8ccbfe9736d30a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453484


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 74aa552e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
+5 −12
Original line number Diff line number Diff line
@@ -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.