From 78a794b9a3a65ee25e7d1840f3a4b4b98a053bb3 Mon Sep 17 00:00:00 2001 From: Krishna Kanth Reddy Date: Fri, 30 Apr 2021 14:26:43 +0530 Subject: [PATCH] examples/identify: Identification of Simple Copy Command support Signed-off-by: Krishna Kanth Reddy Change-Id: I251f3b1a6c7e36b946ddc8bd8a07b0f588e23c9e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7693 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk --- examples/nvme/identify/identify.c | 8 +++++++ include/spdk/nvme_spec.h | 40 ++++++++++++++++++++++++++++--- test/make/check_so_deps.sh | 4 ++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 20a0d2d68..c75762ee5 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -1027,6 +1027,12 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns) printf(" Atomic Boundary Offset: %d\n", nsdata->nabo); } + if (cdata->oncs.copy) { + printf("Maximum Single Source Range Length: %d\n", nsdata->mssrl); + printf("Maximum Copy Length: %d\n", nsdata->mcl); + printf("Maximum Source Range Count: %d\n", nsdata->msrc + 1); + } + printf("NGUID/EUI64 Never Reused: %s\n", nsdata->nsfeat.guid_never_reused ? "Yes" : "No"); @@ -1463,6 +1469,8 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport cdata->oncs.reservations ? "Supported" : "Not Supported"); printf("Timestamp: %s\n", cdata->oncs.timestamp ? "Supported" : "Not Supported"); + printf("Copy: %s\n", + cdata->oncs.copy ? "Supported" : "Not Supported"); printf("Volatile Write Cache: %s\n", cdata->vwc.present ? "Present" : "Not Present"); printf("Atomic Write Unit (Normal): %d\n", cdata->awun + 1); diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index df9471672..5cab10183 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -1338,6 +1338,21 @@ struct spdk_nvme_dsm_range { }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_dsm_range) == 16, "Incorrect size"); +/** + * Simple Copy Command source range + */ +struct spdk_nvme_scc_source_range { + uint64_t reserved0; + uint64_t slba; + uint16_t nlb; + uint16_t reserved18; + uint32_t reserved20; + uint32_t eilbrt; + uint16_t elbat; + uint16_t elbatm; +}; +SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_scc_source_range) == 32, "Incorrect size"); + /** * Status code types */ @@ -1443,6 +1458,7 @@ enum spdk_nvme_command_specific_status_code { SPDK_NVME_SC_CONFLICTING_ATTRIBUTES = 0x80, SPDK_NVME_SC_INVALID_PROTECTION_INFO = 0x81, SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE = 0x82, + SPDK_NVME_SC_CMD_SIZE_LIMIT_SIZE_EXCEEDED = 0x83, }; /** @@ -1539,6 +1555,8 @@ enum spdk_nvme_nvm_opcode { SPDK_NVME_OPC_RESERVATION_ACQUIRE = 0x11, SPDK_NVME_OPC_RESERVATION_RELEASE = 0x15, + + SPDK_NVME_OPC_COPY = 0x19, }; /** @@ -2149,7 +2167,9 @@ struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data { uint16_t set_features_save: 1; uint16_t reservations: 1; uint16_t timestamp: 1; - uint16_t reserved: 9; + uint16_t verify: 1; + uint16_t copy: 1; + uint16_t reserved9: 7; } oncs; /** fused operation support */ @@ -2187,7 +2207,12 @@ struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data { /** atomic compare & write unit */ uint16_t acwu; - uint16_t reserved534; + /** optional copy formats supported */ + struct { + uint16_t copy_format0 : 1; + uint16_t reserved1: 15; + } ocfs; + struct spdk_nvme_cdata_sgls sgls; @@ -2479,7 +2504,16 @@ struct spdk_nvme_ns_data { /** Namespace Optimal Write Size */ uint16_t nows; - uint8_t reserved64[18]; + /** Maximum Single Source Range Length */ + uint16_t mssrl; + + /** Maximum Copy Length */ + uint32_t mcl; + + /** Maximum Source Range Count */ + uint8_t msrc; + + uint8_t reserved64[11]; /** ANA group identifier */ uint32_t anagrpid; diff --git a/test/make/check_so_deps.sh b/test/make/check_so_deps.sh index c53ccc25f..a42c68338 100755 --- a/test/make/check_so_deps.sh +++ b/test/make/check_so_deps.sh @@ -49,6 +49,10 @@ function confirm_abi_deps() { fi cat << EOF > ${suppression_file} +[suppress_type] + name = spdk_nvme_ns_data +[suppress_type] + name = spdk_nvme_ctrlr_data EOF for object in "$libdir"/libspdk_*.so; do