Commit dd0b0a4a authored by Weiwen Hu's avatar Weiwen Hu Committed by Keith Busch
Browse files

nvme: rename CDR/MORE/DNR to NVME_STATUS_*



CDR/MORE/DNR fields are not belonging to SC in the NVMe spec, rename
them to NVME_STATUS_* to avoid confusion.

Signed-off-by: default avatarWeiwen Hu <huweiwen@linux.alibaba.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent d89a5c67
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ static void nvme_retry_req(struct request *req)
	u16 crd;

	/* The mask and shift result must be <= 3 */
	crd = (nvme_req(req)->status & NVME_SC_CRD) >> 11;
	crd = (nvme_req(req)->status & NVME_STATUS_CRD) >> 11;
	if (crd)
		delay = nvme_req(req)->ctrl->crdt[crd - 1] * 100;

@@ -331,8 +331,8 @@ static void nvme_log_error(struct request *req)
		       nvme_get_error_status_str(nr->status),
		       NVME_SCT(nr->status),		/* Status Code Type */
		       nr->status & NVME_SC_MASK,	/* Status Code */
		       nr->status & NVME_SC_MORE ? "MORE " : "",
		       nr->status & NVME_SC_DNR  ? "DNR "  : "");
		       nr->status & NVME_STATUS_MORE ? "MORE " : "",
		       nr->status & NVME_STATUS_DNR  ? "DNR "  : "");
		return;
	}

@@ -343,8 +343,8 @@ static void nvme_log_error(struct request *req)
			   nvme_get_error_status_str(nr->status),
			   NVME_SCT(nr->status),	/* Status Code Type */
			   nr->status & NVME_SC_MASK,	/* Status Code */
			   nr->status & NVME_SC_MORE ? "MORE " : "",
			   nr->status & NVME_SC_DNR  ? "DNR "  : "");
			   nr->status & NVME_STATUS_MORE ? "MORE " : "",
			   nr->status & NVME_STATUS_DNR  ? "DNR "  : "");
}

static void nvme_log_err_passthru(struct request *req)
@@ -361,8 +361,8 @@ static void nvme_log_err_passthru(struct request *req)
		nvme_get_error_status_str(nr->status),
		NVME_SCT(nr->status),		/* Status Code Type */
		nr->status & NVME_SC_MASK,	/* Status Code */
		nr->status & NVME_SC_MORE ? "MORE " : "",
		nr->status & NVME_SC_DNR  ? "DNR "  : "",
		nr->status & NVME_STATUS_MORE ? "MORE " : "",
		nr->status & NVME_STATUS_DNR  ? "DNR "  : "",
		nr->cmd->common.cdw10,
		nr->cmd->common.cdw11,
		nr->cmd->common.cdw12,
@@ -384,7 +384,7 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
		return COMPLETE;

	if (blk_noretry_request(req) ||
	    (nvme_req(req)->status & NVME_SC_DNR) ||
	    (nvme_req(req)->status & NVME_STATUS_DNR) ||
	    nvme_req(req)->retries >= nvme_max_retries)
		return COMPLETE;

@@ -3940,7 +3940,7 @@ static void nvme_ns_remove_by_nsid(struct nvme_ctrl *ctrl, u32 nsid)

static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_info *info)
{
	int ret = NVME_SC_INVALID_NS | NVME_SC_DNR;
	int ret = NVME_SC_INVALID_NS | NVME_STATUS_DNR;

	if (!nvme_ns_ids_equal(&ns->head->ids, &info->ids)) {
		dev_err(ns->ctrl->device,
@@ -3956,7 +3956,7 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_info *info)
	 *
	 * TODO: we should probably schedule a delayed retry here.
	 */
	if (ret > 0 && (ret & NVME_SC_DNR))
	if (ret > 0 && (ret & NVME_STATUS_DNR))
		nvme_ns_remove(ns);
}

@@ -4147,7 +4147,7 @@ static void nvme_scan_work(struct work_struct *work)
		 * they report) but don't actually support it.
		 */
		ret = nvme_scan_ns_list(ctrl);
		if (ret > 0 && ret & NVME_SC_DNR)
		if (ret > 0 && ret & NVME_STATUS_DNR)
			nvme_scan_ns_sequential(ctrl);
	}
	mutex_unlock(&ctrl->scan_lock);
+5 −5
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val)
	if (unlikely(ret != 0))
		dev_err(ctrl->device,
			"Property Get error: %d, offset %#x\n",
			ret > 0 ? ret & ~NVME_SC_DNR : ret, off);
			ret > 0 ? ret & ~NVME_STATUS_DNR : ret, off);

	return ret;
}
@@ -233,7 +233,7 @@ int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
	if (unlikely(ret != 0))
		dev_err(ctrl->device,
			"Property Get error: %d, offset %#x\n",
			ret > 0 ? ret & ~NVME_SC_DNR : ret, off);
			ret > 0 ? ret & ~NVME_STATUS_DNR : ret, off);
	return ret;
}
EXPORT_SYMBOL_GPL(nvmf_reg_read64);
@@ -275,7 +275,7 @@ int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)
	if (unlikely(ret))
		dev_err(ctrl->device,
			"Property Set error: %d, offset %#x\n",
			ret > 0 ? ret & ~NVME_SC_DNR : ret, off);
			ret > 0 ? ret & ~NVME_STATUS_DNR : ret, off);
	return ret;
}
EXPORT_SYMBOL_GPL(nvmf_reg_write32);
@@ -295,7 +295,7 @@ static void nvmf_log_connect_error(struct nvme_ctrl *ctrl,
		int errval, int offset, struct nvme_command *cmd,
		struct nvmf_connect_data *data)
{
	int err_sctype = errval & ~NVME_SC_DNR;
	int err_sctype = errval & ~NVME_STATUS_DNR;

	if (errval < 0) {
		dev_err(ctrl->device,
@@ -573,7 +573,7 @@ EXPORT_SYMBOL_GPL(nvmf_connect_io_queue);
 */
bool nvmf_should_reconnect(struct nvme_ctrl *ctrl, int status)
{
	if (status > 0 && (status & NVME_SC_DNR))
	if (status > 0 && (status & NVME_STATUS_DNR))
		return false;

	if (status == -EKEYREJECTED)
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ void nvme_should_fail(struct request *req)
		/* inject status code and DNR bit */
		status = fault_inject->status;
		if (fault_inject->dont_retry)
			status |= NVME_SC_DNR;
			status |= NVME_STATUS_DNR;
		nvme_req(req)->status =	status;
	}
}
+3 −3
Original line number Diff line number Diff line
@@ -3132,7 +3132,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
	if (ctrl->ctrl.icdoff) {
		dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n",
				ctrl->ctrl.icdoff);
		ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
		ret = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
		goto out_stop_keep_alive;
	}

@@ -3140,7 +3140,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
	if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) {
		dev_err(ctrl->ctrl.device,
			"Mandatory sgls are not supported!\n");
		ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
		ret = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
		goto out_stop_keep_alive;
	}

@@ -3325,7 +3325,7 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
		queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay);
	} else {
		if (portptr->port_state == FC_OBJSTATE_ONLINE) {
			if (status > 0 && (status & NVME_SC_DNR))
			if (status > 0 && (status & NVME_STATUS_DNR))
				dev_warn(ctrl->ctrl.device,
					 "NVME-FC{%d}: reconnect failure\n",
					 ctrl->cnum);
+1 −1
Original line number Diff line number Diff line
@@ -878,7 +878,7 @@ enum {
	NVME_SUBMIT_NOWAIT = (__force nvme_submit_flags_t)(1 << 1),
	/* Set BLK_MQ_REQ_RESERVED when allocating request */
	NVME_SUBMIT_RESERVED = (__force nvme_submit_flags_t)(1 << 2),
	/* Retry command when NVME_SC_DNR is not set in the result */
	/* Retry command when NVME_STATUS_DNR is not set in the result */
	NVME_SUBMIT_RETRY = (__force nvme_submit_flags_t)(1 << 3),
};

Loading