nvme_spec: Add two macros to check status of command completion

This patch adds two macros, spdk_nvme_cpl_is_success and
spdk_nvme_cpl_is_pi_error. The former will be used to check if
checked read completes normally, and the latter will be used to
know if PI verification should be done.

Change-Id: I425035c7f1e43284857181e0d815e3e001e82f4b
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/443340
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-02-05 11:01:37 +09:00 committed by Darek Stojaczyk
parent 742b879691
commit f76ca9a0e7

View File

@ -2452,8 +2452,17 @@ struct spdk_nvme_fw_commit {
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_fw_commit) == 4, "Incorrect size");
#define spdk_nvme_cpl_is_error(cpl) \
((cpl)->status.sc != 0 || (cpl)->status.sct != 0)
#define spdk_nvme_cpl_is_error(cpl) \
((cpl)->status.sc != SPDK_NVME_SC_SUCCESS || \
(cpl)->status.sct != SPDK_NVME_SCT_GENERIC)
#define spdk_nvme_cpl_is_success(cpl) (!spdk_nvme_cpl_is_error(cpl))
#define spdk_nvme_cpl_is_pi_error(cpl) \
((cpl)->status.sct == SPDK_NVME_SCT_MEDIA_ERROR && \
((cpl)->status.sc == SPDK_NVME_SC_GUARD_CHECK_ERROR || \
(cpl)->status.sc == SPDK_NVME_SC_APPLICATION_TAG_CHECK_ERROR || \
(cpl)->status.sc == SPDK_NVME_SC_REFERENCE_TAG_CHECK_ERROR))
/** Enable protection information checking of the Logical Block Reference Tag field */
#define SPDK_NVME_IO_FLAGS_PRCHK_REFTAG (1U << 26)