Commit ca2a1c36 authored by Pawel Baldysiak's avatar Pawel Baldysiak Committed by Tomasz Zawadzki
Browse files

nvmf: Add support for feature_ids_effects log page



This commit adds support for optional log page
LOG_FEATURE_IDS_EFFECTS that gathers all
supported get/set_features and their scopes.
Support is added for both discovery and IO subsystems.

Add public call to get just the stucture filled with what
is supported in SPDK for the controller - it can be used
in future in fixup for passthru get_log_page handling.

Change-Id: Ia3478ae75c3f5f5e9fe729f21b76692c7c664343
Signed-off-by: default avatarPawel Baldysiak <pawel.baldysiak@dell.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26453


Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent 6d7d56aa
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -3470,6 +3470,46 @@ struct spdk_nvme_supported_log_pages {
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_supported_log_pages) == 1024, "Incorrect size");

/* Feature Identifiers Effects Log Page */
struct spdk_nvme_feature_ids_effects_log_page {
	/* Feature Identifier Supported 0-255 */
	struct {
		/* FID Supported - 0 */
		uint32_t fsupp		: 1;
		/* User Data Content Change - 1 */
		uint32_t udcc		: 1;
		/* Namespace Capability Change - 2 */
		uint32_t ncc		: 1;
		/* Namespace Inventory Change - 3 */
		uint32_t nic		: 1;
		/* Controller Capability Change - 4 */
		uint32_t ccc		: 1;
		/* Reserved - 5:18 */
		uint32_t reserved	: 14;
		/* UUID Selection Supported - 19 */
		uint32_t uss		: 1;

		/* FID scope (FSP) - 20:31 */
		/* FID scope - Namespace Scope - 0 */
		uint32_t nscpe		: 1;
		/* FID scope - Controller Scope - 1 */
		uint32_t cscpe		: 1;
		/* FID scope - NVM Set Scope - 2 */
		uint32_t nsetscpe	: 1;
		/* FID scope - Endurance Group Scope - 3 */
		uint32_t egscpe		: 1;
		/* FID scope - Domain Scope - 4 */
		uint32_t dscpe		: 1;
		/* FID scope - NVM Subsystem Scope - 5 */
		uint32_t nsscpe		: 1;
		/* FID scope - Controller Data Queue - 6 */
		uint32_t cdqscpe	: 1;
		/* FID scope - Reserved - 7:11 */
		uint32_t fsp_reserved	: 5;
	} fis[256];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_feature_ids_effects_log_page) == 1024, "Incorrect size");

/**
 * Error information log page (\ref SPDK_NVME_LOG_ERROR)
 */
+10 −0
Original line number Diff line number Diff line
@@ -29,6 +29,16 @@ enum spdk_nvmf_request_exec_status {
int spdk_nvmf_ctrlr_identify_ctrlr(struct spdk_nvmf_ctrlr *ctrlr,
				   struct spdk_nvme_ctrlr_data *cdata);

/**
 * Fills log page struct with feature identifiers effects log page for specified controller
 *
 * \param ctrlr The NVMe-oF controller
 * \param log_page target struct to be filled with log page data
 */

void spdk_nvmf_get_feature_ids_effects_log_page(struct spdk_nvmf_ctrlr *ctrlr,
		struct spdk_nvme_feature_ids_effects_log_page *log_page);

/**
 * Fill the log page struct with supported log pages for specified controller
 *
+71 −0
Original line number Diff line number Diff line
@@ -2796,10 +2796,74 @@ is_log_page_ctrlr_nvm_scope(uint8_t lid)
	}
}

static const struct spdk_nvme_feature_ids_effects_log_page
	g_supported_feat_id_effects_log_pages_discovery = {
	.fis = {
		[SPDK_NVME_FEAT_KEEP_ALIVE_TIMER] =	     { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION] = { .fsupp = 1, .cscpe = 1},
	}
};

static const struct spdk_nvme_feature_ids_effects_log_page g_supported_feat_id_effects_log_pages = {
	.fis = {
		[SPDK_NVME_FEAT_KEEP_ALIVE_TIMER] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION] =	  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_ARBITRATION] =			  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_POWER_MANAGEMENT] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_TEMPERATURE_THRESHOLD] =	  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_ERROR_RECOVERY] =		  { .fsupp = 1, .nscpe = 1},
		[SPDK_NVME_FEAT_VOLATILE_WRITE_CACHE] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_NUMBER_OF_QUEUES] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_INTERRUPT_COALESCING] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION] = { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_WRITE_ATOMICITY] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_HOST_IDENTIFIER] =		  { .fsupp = 1, .cscpe = 1},
		[SPDK_NVME_FEAT_HOST_RESERVE_MASK] =		  { .fsupp = 1, .nscpe = 1},
		[SPDK_NVME_FEAT_HOST_RESERVE_PERSIST] =		  { .fsupp = 1, .nscpe = 1},
		[SPDK_NVME_FEAT_HOST_BEHAVIOR_SUPPORT] =	  { .fsupp = 1, .cscpe = 1},
	}
};

void
spdk_nvmf_get_feature_ids_effects_log_page(struct spdk_nvmf_ctrlr *ctrlr,
		struct spdk_nvme_feature_ids_effects_log_page *log_page)
{
	if (spdk_nvmf_subsystem_is_discovery(ctrlr->subsys)) {
		*log_page = g_supported_feat_id_effects_log_pages_discovery;
	} else {
		*log_page = g_supported_feat_id_effects_log_pages;
	}
}

static int
nvmf_get_feature_ids_effects_log_page(struct spdk_nvmf_ctrlr *ctrlr, struct iovec *iovs, int iovcnt,
				      uint64_t offset, uint32_t length)
{
	uint32_t page_size = sizeof(struct spdk_nvme_feature_ids_effects_log_page);
	size_t copy_len = 0;
	struct spdk_iov_xfer ix;
	struct spdk_nvme_feature_ids_effects_log_page supported_feature_ids_effects_log_page = {};

	spdk_nvmf_get_feature_ids_effects_log_page(ctrlr, &supported_feature_ids_effects_log_page);

	spdk_iov_xfer_init(&ix, iovs, iovcnt);
	if (offset < page_size) {
		copy_len = spdk_min(page_size - offset, length);
		spdk_iov_xfer_from_buf(&ix, (char *)(&supported_feature_ids_effects_log_page) + offset, copy_len);
	} else {
		SPDK_ERRLOG("Invalid Get feat id effects log page offset: (%" PRIu64 "),"
			    " log page size (%" PRIu32")\n", offset, page_size);
		return -EINVAL;
	}

	return 0;
}

static const struct spdk_nvme_supported_log_pages g_supported_log_pages_discover = {
	.lids = {
		[SPDK_NVME_LOG_SUPPORTED_LOG_PAGES] = { .lsupp = 1 },
		[SPDK_NVME_LOG_DISCOVERY] =	      { .lsupp = 1 },
		[SPDK_NVME_LOG_FEATURE_IDS_EFFECTS] = { .lsupp = 1 },
	}
};

@@ -2813,6 +2877,7 @@ static const struct spdk_nvme_supported_log_pages g_supported_log_pages = {
		[SPDK_NVME_LOG_COMMAND_EFFECTS_LOG] =	      { .lsupp = 1 },
		[SPDK_NVME_LOG_CHANGED_NS_LIST] =	      { .lsupp = 1 },
		[SPDK_NVME_LOG_RESERVATION_NOTIFICATION] =    { .lsupp = 1 },
		[SPDK_NVME_LOG_FEATURE_IDS_EFFECTS] =	      { .lsupp = 1 },
	}
};

@@ -2920,6 +2985,9 @@ nvmf_ctrlr_get_log_page(struct spdk_nvmf_request *req)
				nvmf_ctrlr_unmask_aen(ctrlr, SPDK_NVME_ASYNC_EVENT_DISCOVERY_LOG_CHANGE_MASK_BIT);
			}
			break;
		case SPDK_NVME_LOG_FEATURE_IDS_EFFECTS:
			rc = nvmf_get_feature_ids_effects_log_page(ctrlr, req->iov, req->iovcnt, offset, len);
			break;
		default:
			SPDK_INFOLOG(nvmf, "Unsupported Get Log Page Identifier for discovery subsystem 0x%02X\n", lid);
			goto invalid_field_log_page;
@@ -2963,6 +3031,9 @@ nvmf_ctrlr_get_log_page(struct spdk_nvmf_request *req)
	case SPDK_NVME_LOG_RESERVATION_NOTIFICATION:
		rc = nvmf_get_reservation_notification_log_page(ctrlr, req->iov, req->iovcnt, offset, len, rae);
		break;
	case SPDK_NVME_LOG_FEATURE_IDS_EFFECTS:
		rc = nvmf_get_feature_ids_effects_log_page(ctrlr, req->iov, req->iovcnt, offset, len);
		break;
	default:
		SPDK_INFOLOG(nvmf, "Unsupported Get Log Page Identifier 0x%02X\n", lid);
		goto invalid_field_log_page;
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@

	# public functions in nvmf_cmd.h
	spdk_nvmf_ctrlr_identify_ctrlr;
	spdk_nvmf_get_feature_ids_effects_log_page;
	spdk_nvmf_get_supported_log_pages;
	spdk_nvmf_ctrlr_identify_iocs_specific;
	spdk_nvmf_ctrlr_identify_ns;