Commit 201843a9 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: report virtualized NVMe version 1.2.1



The NVMe over Fabrics 1.0 spec corresponds to the NVMe base spec version
1.2.1, so we should pretend to be at least that new.

Change-Id: I36fc44c780de01d6c666e87b803cd47dba0e74c5
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 5e152960
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -196,6 +196,16 @@ union spdk_nvme_vs_register {
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_vs_register) == 4, "Incorrect size");

/** Generate raw version in the same format as \ref spdk_nvme_vs_register for comparison. */
#define SPDK_NVME_VERSION(mjr, mnr, ter) \
	(((uint32_t)(mjr) << 16) | \
	((uint32_t)(mnr) << 8) | \
	(uint32_t)(ter))

/* Test that the shifts are correct */
SPDK_STATIC_ASSERT(SPDK_NVME_VERSION(1, 0, 0) == 0x00010000, "version macro error");
SPDK_STATIC_ASSERT(SPDK_NVME_VERSION(1, 2, 1) == 0x00010201, "version macro error");

union spdk_nvme_cmbloc_register {
	uint32_t	raw;
	struct {
@@ -735,7 +745,7 @@ struct __attribute__((packed)) spdk_nvme_ctrlr_data {
	uint16_t		cntlid;

	/** version */
	uint32_t		ver;
	union spdk_nvme_vs_register	ver;

	/** RTD3 resume latency */
	uint32_t		rtd3r;
+11 −7
Original line number Diff line number Diff line
@@ -67,10 +67,11 @@ nvmf_init_discovery_session_properties(struct nvmf_session *session)
	session->vcprop.cap.bits.mpsmin = 0; /* 2 ^ 12 + mpsmin == 4k */
	session->vcprop.cap.bits.mpsmax = 0; /* 2 ^ 12 + mpsmax == 4k */

	/* Version Supported: 1.0 */
	/* Version Supported: 1.2.1 */
	session->vcprop.vs.bits.mjr = 1;
	session->vcprop.vs.bits.mnr = 0;
	session->vcprop.vs.bits.ter = 0;
	session->vcprop.vs.bits.mnr = 2;
	session->vcprop.vs.bits.ter = 1;
	session->vcdata.ver = session->vcprop.vs;

	session->vcprop.cc.raw = 0;

@@ -135,10 +136,13 @@ nvmf_init_nvme_session_properties(struct nvmf_session *session)
	session->vcprop.cap.bits.mpsmin = 0; /* 2 ^ 12 + mpsmin == 4k */
	session->vcprop.cap.bits.mpsmax = 0; /* 2 ^ 12 + mpsmax == 4k */

	/* Version Supported: 1.0 */
	/* Report at least version 1.2.1 */
	if (session->vcprop.vs.raw < SPDK_NVME_VERSION(1, 2, 1)) {
		session->vcprop.vs.bits.mjr = 1;
	session->vcprop.vs.bits.mnr = 0;
	session->vcprop.vs.bits.ter = 0;
		session->vcprop.vs.bits.mnr = 2;
		session->vcprop.vs.bits.ter = 1;
		session->vcdata.ver = session->vcprop.vs;
	}

	session->vcprop.cc.raw = 0;
	session->vcprop.cc.bits.en = 0; /* Init controller disabled */