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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-07-25 16:29:57 -07:00
parent 5e15296025
commit 201843a9eb
2 changed files with 22 additions and 8 deletions

View File

@ -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;

View File

@ -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 */
session->vcprop.vs.bits.mjr = 1;
session->vcprop.vs.bits.mnr = 0;
session->vcprop.vs.bits.ter = 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 = 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 */