Commit 38fa9d82 authored by Niklas Cassel's avatar Niklas Cassel Committed by Tomasz Zawadzki
Browse files

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: default avatarNiklas 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 09b0c84f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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",