From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:16:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98B8E67B430; Tue, 21 Sep 2021 21:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ3Y3r2cz4b72; Tue, 21 Sep 2021 21:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6377533EE; Tue, 21 Sep 2021 21:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LLG9k9041133; Tue, 21 Sep 2021 21:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLG9xe041132; Tue, 21 Sep 2021 21:16:09 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:16:09 GMT Message-Id: <202109212116.18LLG9xe041132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: ae5a522cae7e - main - nvmecontrol: Display Metadata and Sanitize capabilities of the device MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae5a522cae7e95790e84274c4ba23bbd1e4f3033 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:16:09 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=ae5a522cae7e95790e84274c4ba23bbd1e4f3033 commit ae5a522cae7e95790e84274c4ba23bbd1e4f3033 Author: Allan Jude AuthorDate: 2021-09-21 21:14:20 +0000 Commit: Allan Jude CommitDate: 2021-09-21 21:15:55 +0000 nvmecontrol: Display Metadata and Sanitize capabilities of the device Determine if a device supports "Extended" or "Separate" metadata, and what the current metadata setting is (None, Extended, Separate) Also determine if the device supports: - Sanitize Crypto Erase - Sanitize Block Erase - Sanitize Overwrite Reviewed by: chuck Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #49 Differential Revision: https://reviews.freebsd.org/D31067 --- sbin/nvmecontrol/identify.c | 12 +++++++++++- sbin/nvmecontrol/identify_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index 6cd7ad0fdc2d..0d4d8003e5d2 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -84,7 +84,17 @@ print_namespace(struct nvme_namespace_data *nsdata) printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); - printf("Current LBA Format: LBA Format #%02d\n", flbas_fmt); + printf("Current LBA Format: LBA Format #%02d", flbas_fmt); + if (nsdata->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_MS_SHIFT & NVME_NS_DATA_LBAF_MS_MASK) + printf(" %s metadata\n", nsdata->flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT & + NVME_NS_DATA_FLBAS_EXTENDED_MASK ? "Extended" : "Separate"); + else + printf("\n"); + printf("Metadata Capabilities\n"); + printf(" Extended: %s\n", + nsdata->mc >> NVME_NS_DATA_MC_EXTENDED_SHIFT & NVME_NS_DATA_MC_EXTENDED_MASK ? "Supported" : "Not Supported"); + printf(" Separate: %s\n", + nsdata->mc >> NVME_NS_DATA_MC_POINTER_SHIFT & NVME_NS_DATA_MC_POINTER_MASK ? "Supported" : "Not Supported"); printf("Data Protection Caps: %s%s%s%s%s%s\n", (nsdata->dpc == 0) ? "Not Supported" : "", ((nsdata->dpc >> NVME_NS_DATA_DPC_MD_END_SHIFT) & diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 311c8cba09a9..50b8901b799e 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -124,6 +124,38 @@ nvme_print_controller(struct nvme_controller_data *cdata) printf("Unlimited\n"); else printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("Sanitize Crypto Erase: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) & + NVME_CTRLR_DATA_SANICAP_CES_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize Block Erase: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) & + NVME_CTRLR_DATA_SANICAP_BES_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize Overwrite: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) & + NVME_CTRLR_DATA_SANICAP_OWS_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize NDI: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_NDI_SHIFT) & + NVME_CTRLR_DATA_SANICAP_NDI_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize NODMMAS: "); + switch (((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_NODMMAS_SHIFT) & + NVME_CTRLR_DATA_SANICAP_NODMMAS_MASK)) { + case NVME_CTRLR_DATA_SANICAP_NODMMAS_UNDEF: + printf("Undefined\n"); + break; + case NVME_CTRLR_DATA_SANICAP_NODMMAS_NO: + printf("No\n"); + break; + case NVME_CTRLR_DATA_SANICAP_NODMMAS_YES: + printf("Yes\n"); + break; + default: + printf("Unknown\n"); + break; + } printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff,