Commit b4d406b7 authored by Ankit Kumar's avatar Ankit Kumar Committed by Tomasz Zawadzki
Browse files

nvme: add raw field for controller attributes



Add raw field for controller attributes and change it to union from
structure. Update the respective location of code where its being used.

Change-Id: I56278daba9ab947bc5f49271d8107e097abb3576
Signed-off-by: default avatarAnkit Kumar <ankit.kumar@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22788


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent e762dcb2
Loading
Loading
Loading
Loading
+22 −22
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ get_features(struct spdk_nvme_ctrlr *ctrlr, uint8_t *features_to_get, size_t num
			struct spdk_nvme_ns *ns = spdk_nvme_ctrlr_get_ns(ctrlr, nsid);
			const struct spdk_nvme_ns_data *nsdata = spdk_nvme_ns_get_data(ns);

			if (!cdata->ctratt.fdps) {
			if (!cdata->ctratt.bits.fdps) {
				continue;
			} else {
				cdw11 = nsdata->endgid;
@@ -1417,11 +1417,11 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
	printf("Namespace Write Protected:             %s\n",
	       nsdata->nsattr.write_protected ? "Yes" : "No");

	if (cdata->ctratt.nvm_sets) {
	if (cdata->ctratt.bits.nvm_sets) {
		printf("NVM set ID:                            %u\n", nsdata->nvmsetid);
	}

	if (cdata->ctratt.endurance_groups) {
	if (cdata->ctratt.bits.endurance_groups) {
		printf("Endurance group ID:                    %u\n", nsdata->endgid);
	}

@@ -1439,7 +1439,7 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
	}
	printf("\n");

	if (cdata->ctratt.fdps) {
	if (cdata->ctratt.bits.fdps) {
		union spdk_nvme_feat_fdp_cdw12 fdp_res;

		if (features[SPDK_NVME_FEAT_FDP].valid) {
@@ -1737,39 +1737,39 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport

	printf("Controller Attributes\n");
	printf("  128-bit Host Identifier:             %s\n",
	       cdata->ctratt.host_id_exhid_supported ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.host_id_exhid_supported ? "Supported" : "Not Supported");
	printf("  Non-Operational Permissive Mode:     %s\n",
	       cdata->ctratt.non_operational_power_state_permissive_mode ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.non_operational_power_state_permissive_mode ? "Supported" : "Not Supported");
	printf("  NVM Sets:                            %s\n",
	       cdata->ctratt.nvm_sets ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.nvm_sets ? "Supported" : "Not Supported");
	printf("  Read Recovery Levels:                %s\n",
	       cdata->ctratt.read_recovery_levels ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.read_recovery_levels ? "Supported" : "Not Supported");
	printf("  Endurance Groups:                    %s\n",
	       cdata->ctratt.endurance_groups ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.endurance_groups ? "Supported" : "Not Supported");
	printf("  Predictable Latency Mode:            %s\n",
	       cdata->ctratt.predictable_latency_mode ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.predictable_latency_mode ? "Supported" : "Not Supported");
	printf("  Traffic Based Keep ALive:            %s\n",
	       cdata->ctratt.tbkas ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.tbkas ? "Supported" : "Not Supported");
	printf("  Namespace Granularity:               %s\n",
	       cdata->ctratt.namespace_granularity ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.namespace_granularity ? "Supported" : "Not Supported");
	printf("  SQ Associations:                     %s\n",
	       cdata->ctratt.sq_associations ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.sq_associations ? "Supported" : "Not Supported");
	printf("  UUID List:                           %s\n",
	       cdata->ctratt.uuid_list ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.uuid_list ? "Supported" : "Not Supported");
	printf("  Multi-Domain Subsystem:              %s\n",
	       cdata->ctratt.mds ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.mds ? "Supported" : "Not Supported");
	printf("  Fixed Capacity Management:           %s\n",
	       cdata->ctratt.fixed_capacity_management ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.fixed_capacity_management ? "Supported" : "Not Supported");
	printf("  Variable Capacity Management:        %s\n",
	       cdata->ctratt.variable_capacity_management ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.variable_capacity_management ? "Supported" : "Not Supported");
	printf("  Delete Endurance Group:              %s\n",
	       cdata->ctratt.delete_endurance_group ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.delete_endurance_group ? "Supported" : "Not Supported");
	printf("  Delete NVM Set:                      %s\n",
	       cdata->ctratt.delete_nvm_set ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.delete_nvm_set ? "Supported" : "Not Supported");
	printf("  Extended LBA Formats Supported:      %s\n",
	       cdata->ctratt.elbas ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.elbas ? "Supported" : "Not Supported");
	printf("  Flexible Data Placement Supported:   %s\n",
	       cdata->ctratt.fdps ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.fdps ? "Supported" : "Not Supported");
	printf("\n");

	printf("Controller Memory Buffer Support\n");
@@ -2225,7 +2225,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
			}
		}
		printf("Non-Operational Permissive Mode: %s\n",
		       cdata->ctratt.non_operational_power_state_permissive_mode ? "Supported" : "Not Supported");
		       cdata->ctratt.bits.non_operational_power_state_permissive_mode ? "Supported" : "Not Supported");
		printf("\n");
	}

+41 −38
Original line number Diff line number Diff line
@@ -2233,7 +2233,9 @@ struct spdk_nvme_cdata_oaes {
	uint32_t	discovery_log_change_notices : 1;
};

struct spdk_nvme_cdata_ctratt {
union spdk_nvme_cdata_ctratt {
	uint32_t	raw;
	struct {
		/* Supports 128-bit host identifier */
		uint32_t	host_id_exhid_supported: 1;

@@ -2288,6 +2290,7 @@ struct spdk_nvme_cdata_ctratt {
		uint32_t	fdps: 1;

		uint32_t	reserved2: 12;
	} bits;
};

#pragma pack(push, 1)
@@ -2343,7 +2346,7 @@ struct spdk_nvme_ctrlr_data {
	struct spdk_nvme_cdata_oaes oaes;

	/** controller attributes */
	struct spdk_nvme_cdata_ctratt ctratt;
	union spdk_nvme_cdata_ctratt ctratt;

	/** Read Recovery Levels Supported */
	uint16_t		rrls;
+2 −2
Original line number Diff line number Diff line
@@ -897,7 +897,7 @@ nvme_ctrlr_set_supported_log_pages(struct spdk_nvme_ctrlr *ctrlr)
		}
	}

	if (ctrlr->cdata.ctratt.fdps) {
	if (ctrlr->cdata.ctratt.bits.fdps) {
		ctrlr->log_page_supported[SPDK_NVME_LOG_FDP_CONFIGURATIONS] = true;
		ctrlr->log_page_supported[SPDK_NVME_LOG_RECLAIM_UNIT_HANDLE_USAGE] = true;
		ctrlr->log_page_supported[SPDK_NVME_LOG_FDP_STATISTICS] = true;
@@ -2992,7 +2992,7 @@ nvme_ctrlr_set_host_id(struct spdk_nvme_ctrlr *ctrlr)
		return 0;
	}

	if (ctrlr->cdata.ctratt.host_id_exhid_supported) {
	if (ctrlr->cdata.ctratt.bits.host_id_exhid_supported) {
		NVME_CTRLR_DEBUGLOG(ctrlr, "Using 128-bit extended host identifier\n");
		host_id = ctrlr->opts.extended_host_id;
		host_id_size = sizeof(ctrlr->opts.extended_host_id);
+1 −1
Original line number Diff line number Diff line
@@ -2804,7 +2804,7 @@ spdk_nvmf_ctrlr_identify_ctrlr(struct spdk_nvmf_ctrlr *ctrlr, struct spdk_nvme_c
		cdata->cmic.multi_port = 1;
		cdata->cmic.multi_ctrlr = 1;
		cdata->oaes.ns_attribute_notices = 1;
		cdata->ctratt.host_id_exhid_supported = 1;
		cdata->ctratt.bits.host_id_exhid_supported = 1;
		/* We do not have any actual limitation to the number of abort commands.
		 * We follow the recommendation by the NVMe specification.
		 */
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ print_controller(struct nvme_ctrlr *ctrlr, const struct spdk_pci_addr *addr)
	printf("  Firmware Activation Notices:         %s\n",
	       cdata->oaes.fw_activation_notices ? "Supported" : "Not Supported");
	printf("128-bit Host Identifier:               %s\n",
	       cdata->ctratt.host_id_exhid_supported ? "Supported" : "Not Supported");
	       cdata->ctratt.bits.host_id_exhid_supported ? "Supported" : "Not Supported");
}

static void
Loading