From e3971c41ea92bff68f52d97a12121d5e45409838 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 28 Aug 2017 14:00:57 -0700 Subject: [PATCH] nvme_spec: update Identify Controller SGLS field In NVMe 1.3, the Identify Controller data SGLS field's definition was changed; in NVMe 1.2, the first bit simply indicated whether SGLs were supported, but in NVMe 1.3, the first two bits now indicate whether SGLs are supported and whether they require Dword-aligned data. Change-Id: I9181055a86f52ad939b65eca5af66a400594a696 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/376027 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- examples/nvme/identify/identify.c | 4 +++- include/spdk/nvme_spec.h | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 20f944940..af883fce6 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -622,7 +622,9 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport printf("Atomic Write Unit (PFail): %d\n", cdata->awupf + 1); printf("Scatter-Gather List\n"); printf(" SGL Command Set: %s\n", - cdata->sgls.supported ? "Supported" : "Not Supported"); + cdata->sgls.supported == SPDK_NVME_SGLS_SUPPORTED ? "Supported" : + cdata->sgls.supported == SPDK_NVME_SGLS_SUPPORTED_DWORD_ALIGNED ? "Supported (Dword aligned)" : + "Not Supported"); printf(" SGL Keyed: %s\n", cdata->sgls.keyed_sgl ? "Supported" : "Not Supported"); printf(" SGL Bit Bucket Descriptor: %s\n", diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index bc645345c..3842da2b8 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -849,6 +849,18 @@ enum spdk_nvmf_ctrlr_model { #define SPDK_NVME_CTRLR_MN_LEN 40 #define SPDK_NVME_CTRLR_FR_LEN 8 +/** Identify Controller data sgls.supported values */ +enum spdk_nvme_sgls_supported { + /** SGLs are not supported */ + SPDK_NVME_SGLS_NOT_SUPPORTED = 0, + + /** SGLs are supported with no alignment or granularity requirement. */ + SPDK_NVME_SGLS_SUPPORTED = 1, + + /** SGLs are supported with a DWORD alignment and granularity requirement. */ + SPDK_NVME_SGLS_SUPPORTED_DWORD_ALIGNED = 2, +}; + struct __attribute__((packed)) spdk_nvme_ctrlr_data { /* bytes 0-255: controller capabilities and features */ @@ -1174,8 +1186,7 @@ struct __attribute__((packed)) spdk_nvme_ctrlr_data { /** SGL support */ struct { - uint32_t supported : 1; - uint32_t reserved0 : 1; + uint32_t supported : 2; uint32_t keyed_sgl : 1; uint32_t reserved1 : 13; uint32_t bit_bucket_descriptor : 1;