lib/nvmf: Set missing fields if OPTPERF is set

As per the nvme specs,
If OPTPERF is set to ‘1’ indicates that the fields
NPWG, NPWA, NPDG, NPDA, and NOWS are defined for this namespace and
should be used by the host for I/O optimization

Setting NPWA, NPDG, NPDA same as NPWG and NOWS same as MDTS

Fixes #2197

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Change-Id: Ic769a21b6821fa731eeae83e7d30c380e8092e37
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10007
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Swapnil Ingle 2021-10-26 12:17:54 -04:00 committed by Changpeng Liu
parent dc82055029
commit 13e5be0b8d
2 changed files with 8 additions and 0 deletions

View File

@ -2426,6 +2426,11 @@ spdk_nvmf_ctrlr_identify_ns(struct spdk_nvmf_ctrlr *ctrlr,
nsdata->noiob = max_num_blocks;
}
/* Set NOWS equal to Controller MDTS */
if (nsdata->nsfeat.optperf) {
nsdata->nows = max_num_blocks - 1;
}
if (subsystem->flags.ana_reporting) {
assert(ns->anagrpid - 1 < subsystem->max_nsid);
nsdata->anagrpid = ns->anagrpid;

View File

@ -190,6 +190,9 @@ nvmf_bdev_ctrlr_identify_ns(struct spdk_nvmf_ns *ns, struct spdk_nvme_ns_data *n
nsdata->nsfeat.ns_atomic_write_unit = 1;
nsdata->npwg = (phys_blocklen >> nsdata->lbaf[0].lbads) - 1;
nsdata->nawupf = nsdata->npwg;
nsdata->npwa = nsdata->npwg;
nsdata->npdg = nsdata->npwg;
nsdata->npda = nsdata->npwg;
nsdata->noiob = spdk_bdev_get_optimal_io_boundary(bdev);
nsdata->nmic.can_share = 1;