nvme/compliance: add a case to check NPWG and NWOS in IDENTIFY NS

Change-Id: Ie5ba6f86d7c99e20f56a11fc1623ce74bf5c6bc9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10110
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-11-04 22:52:45 +08:00 committed by Jim Harris
parent 8d5204acab
commit ab8b25793b

View File

@ -915,7 +915,9 @@ identify_ns(void)
struct spdk_nvme_cmd cmd;
const struct spdk_nvme_ctrlr_data *cdata;
struct spdk_nvme_ns_data *ns_data;
struct spdk_nvme_ns *ns;
uint32_t i, active_nsid, inactive_nsid;
uint32_t nows, npwg, max_xfer_size;
struct status s;
int rc;
@ -979,6 +981,19 @@ identify_ns(void)
wait_for_admin_completion(&s, ctrlr);
CU_ASSERT(!spdk_nvme_cpl_is_error(&s.cpl));
max_xfer_size = spdk_nvme_ctrlr_get_max_xfer_size(ctrlr);
ns = spdk_nvme_ctrlr_get_ns(ctrlr, active_nsid);
SPDK_CU_ASSERT_FATAL(ns != NULL);
if (ns_data->nsfeat.optperf) {
npwg = ns_data->npwg + 1;
nows = ns_data->nows + 1;
CU_ASSERT(npwg * spdk_nvme_ns_get_sector_size(ns) <= max_xfer_size);
CU_ASSERT(nows * spdk_nvme_ns_get_sector_size(ns) <= max_xfer_size);
CU_ASSERT(nows % npwg == 0);
}
}
/* NSID is inactive, valid and should contain zeroed data */