nvme/identify: print the command set identifier per namespace

For each active namespace, print the command set identifier.
This will work on namespaces that do not support or report a namespace
type, as spdk_nvme_ns_get_csi() will return SPDK_NVME_CSI_NVM for such
cases.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I05fa7fd6bb3d9ea32dac236c98baef90347094ca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6905
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Niklas Cassel 2021-03-16 17:38:16 +00:00 committed by Tomasz Zawadzki
parent 09b0c84f1b
commit 38fa9d82c8

View File

@ -896,6 +896,24 @@ print_zns_ns_data(const struct spdk_nvme_zns_ns_data *nsdata_zns)
printf("\n");
}
static const char *
csi_name(enum spdk_nvme_csi csi)
{
switch (csi) {
case SPDK_NVME_CSI_NVM:
return "NVM";
case SPDK_NVME_CSI_KV:
return "KV";
case SPDK_NVME_CSI_ZNS:
return "ZNS";
default:
if (csi >= 0x30 && csi <= 0x3f) {
return "Vendor specific";
}
return "Unknown";
}
}
static void
print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
{
@ -923,6 +941,8 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
/* This function is only called for active namespaces. */
assert(spdk_nvme_ns_is_active(ns));
printf("Command Set Identifier: %s (%02Xh)\n",
csi_name(spdk_nvme_ns_get_csi(ns)), spdk_nvme_ns_get_csi(ns));
printf("Deallocate: %s\n",
(flags & SPDK_NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported");
printf("Deallocated/Unwritten Error: %s\n",