Commit 10f0f4b0 authored by Cunyin Chang's avatar Cunyin Chang
Browse files

spdk: Add Intel specific log page.



This patch add support for Intel specific log pages :
marketing description page.

Change-Id: I87bccb2af286279598c9dd3c870094b384a0d2f7
Signed-off-by: default avatarCunyin Chang <cunyin.chang@intel.com>
parent 1e9c43dd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ enum spdk_nvme_intel_log_page {
	SPDK_NVME_INTEL_LOG_WRITE_CMD_LATENCY			= 0xC2,
	SPDK_NVME_INTEL_LOG_TEMPERATURE				= 0xC5,
	SPDK_NVME_INTEL_LOG_SMART				= 0xCA,
	SPDK_NVME_INTEL_MARKETING_DESCRIPTION			= 0xDD,
};

enum spdk_nvme_intel_smart_attribute_code {
@@ -101,7 +102,9 @@ struct spdk_nvme_intel_log_page_directory {
	uint8_t		temperature_statistics_log_len;
	uint8_t		reserved4[9];
	uint8_t		smart_log_len;
	uint8_t		reserved5[107];
	uint8_t		reserved5[37];
	uint8_t		marketing_description_log_len;
	uint8_t		reserved6[69];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_intel_log_page_directory) == 512, "Incorrect size");

@@ -198,6 +201,11 @@ union spdk_nvme_intel_feat_latency_tracking {
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_intel_feat_latency_tracking) == 4, "Incorrect size");

struct spdk_nvme_intel_marketing_description_page {
	uint8_t		marketing_product[512];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_intel_marketing_description_page) == 512,
		   "Incorrect size");
#ifdef __cplusplus
}
#endif
+3 −0
Original line number Diff line number Diff line
@@ -222,6 +222,9 @@ nvme_ctrlr_construct_intel_support_log_page_list(struct spdk_nvme_ctrlr *ctrlr,
	if (log_page_directory->smart_log_len) {
		ctrlr->log_page_supported[SPDK_NVME_INTEL_LOG_SMART] = true;
	}
	if (log_page_directory->marketing_description_log_len) {
		ctrlr->log_page_supported[SPDK_NVME_INTEL_MARKETING_DESCRIPTION] = true;
	}
}

static int nvme_ctrlr_set_intel_support_log_pages(struct spdk_nvme_ctrlr *ctrlr)
+25 −0
Original line number Diff line number Diff line
@@ -178,6 +178,18 @@ static void verify_intel_get_log_page_directory(struct nvme_request *req)
	CU_ASSERT(req->cmd.cdw10 == temp_cdw10);
}

static void verify_intel_marketing_description_log_page(struct nvme_request *req)
{
	uint32_t temp_cdw10;

	CU_ASSERT(req->cmd.opc == SPDK_NVME_OPC_GET_LOG_PAGE);

	temp_cdw10 = ((sizeof(struct spdk_nvme_intel_marketing_description_page) / sizeof(
			       uint32_t) - 1) << 16) |
		     SPDK_NVME_INTEL_MARKETING_DESCRIPTION;
	CU_ASSERT(req->cmd.cdw10 == temp_cdw10);
}

static void verify_namespace_attach(struct nvme_request *req)
{
	CU_ASSERT(req->cmd.opc == SPDK_NVME_OPC_NS_ATTACHMENT);
@@ -369,6 +381,18 @@ static void test_intel_get_log_page_directory(void)
					 &payload, sizeof(payload), NULL, NULL);
}

static void test_intel_marketing_description_get_log_page(void)
{
	struct spdk_nvme_ctrlr					ctrlr = {};
	struct spdk_nvme_intel_marketing_description_page	payload = {};

	verify_fn = verify_intel_marketing_description_log_page;

	spdk_nvme_ctrlr_cmd_get_log_page(&ctrlr, SPDK_NVME_INTEL_MARKETING_DESCRIPTION,
					 SPDK_NVME_GLOBAL_NS_TAG,
					 &payload, sizeof(payload), NULL, NULL);
}

static void test_generic_get_log_pages(void)
{
	test_error_get_log_page();
@@ -383,6 +407,7 @@ static void test_intel_get_log_pages(void)
	test_intel_temperature_get_log_page();
	test_intel_read_latency_get_log_page();
	test_intel_write_latency_get_log_page();
	test_intel_marketing_description_get_log_page();
}

static void