From owner-svn-src-stable-12@freebsd.org Tue Aug 27 04:02:26 2019 Return-Path: Delivered-To: svn-src-stable-12@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 79B25C861F; Tue, 27 Aug 2019 04:02:26 +0000 (UTC) (envelope-from mav@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZvk2hnSz4KQr; Tue, 27 Aug 2019 04:02:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F4DF19010; Tue, 27 Aug 2019 04:02:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R42QEH000533; Tue, 27 Aug 2019 04:02:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R42Pw1000532; Tue, 27 Aug 2019 04:02:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270402.x7R42Pw1000532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:02:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351533 - stable/12/sbin/nvmecontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/nvmecontrol X-SVN-Commit-Revision: 351533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Aug 2019 04:02:26 -0000 Author: mav Date: Tue Aug 27 04:02:25 2019 New Revision: 351533 URL: https://svnweb.freebsd.org/changeset/base/351533 Log: MFC r351038: Print few more useful identify fields. Modified: stable/12/sbin/nvmecontrol/identify.c stable/12/sbin/nvmecontrol/identify_ext.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/nvmecontrol/identify.c ============================================================================== --- stable/12/sbin/nvmecontrol/identify.c Tue Aug 27 04:01:56 2019 (r351532) +++ stable/12/sbin/nvmecontrol/identify.c Tue Aug 27 04:02:25 2019 (r351533) @@ -62,6 +62,7 @@ static struct options { void print_namespace(struct nvme_namespace_data *nsdata) { + char cbuf[UINT128_DIG + 1]; uint32_t i; uint32_t lbaf, lbads, ms, rp; uint8_t thin_prov, ptype; @@ -73,15 +74,12 @@ print_namespace(struct nvme_namespace_data *nsdata) flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & NVME_NS_DATA_FLBAS_FORMAT_MASK; - printf("Size (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nsze, - (long long)nsdata->nsze / 1024 / 1024); - printf("Capacity (in LBAs): %lld (%lldM)\n", - (long long)nsdata->ncap, - (long long)nsdata->ncap / 1024 / 1024); - printf("Utilization (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nuse, - (long long)nsdata->nuse / 1024 / 1024); + printf("Size: %lld blocks\n", + (long long)nsdata->nsze); + printf("Capacity: %lld blocks\n", + (long long)nsdata->ncap); + printf("Utilization: %lld blocks\n", + (long long)nsdata->nuse); printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); @@ -148,7 +146,22 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "", (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) & NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : ""); - printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob); + printf("Optimal I/O Boundary: %u blocks\n", nsdata->noiob); + printf("NVM Capacity: %s bytes\n", + uint128_to_str(to128(nsdata->nvmcap), cbuf, sizeof(cbuf))); + if ((nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) { + printf("Preferred Write Granularity: %u blocks", + nsdata->npwg + 1); + printf("Preferred Write Alignment: %u blocks", + nsdata->npwa + 1); + printf("Preferred Deallocate Granul: %u blocks", + nsdata->npdg + 1); + printf("Preferred Deallocate Align: %u blocks", + nsdata->npda + 1); + printf("Optimal Write Size: %u blocks", + nsdata->nows + 1); + } printf("Globally Unique Identifier: "); for (i = 0; i < sizeof(nsdata->nguid); i++) printf("%02x", nsdata->nguid[i]); Modified: stable/12/sbin/nvmecontrol/identify_ext.c ============================================================================== --- stable/12/sbin/nvmecontrol/identify_ext.c Tue Aug 27 04:01:56 2019 (r351532) +++ stable/12/sbin/nvmecontrol/identify_ext.c Tue Aug 27 04:02:25 2019 (r351533) @@ -121,7 +121,7 @@ nvme_print_controller(struct nvme_controller_data *cda if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff, @@ -184,6 +184,14 @@ nvme_print_controller(struct nvme_controller_data *cda ns_smart ? "Yes" : "No"); printf("Error Log Page Entries: %d\n", cdata->elpe+1); printf("Number of Power States: %d\n", cdata->npss+1); + if (cdata->ver >= 0x010200) { + printf("Total NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.tnvmcap), + cbuf, sizeof(cbuf))); + printf("Unallocated NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.unvmcap), + cbuf, sizeof(cbuf))); + } printf("\n"); printf("NVM Command Set Attributes\n"); @@ -235,13 +243,6 @@ nvme_print_controller(struct nvme_controller_data *cda (t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" : (t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : ""); - if (nsmgmt) { - printf("\n"); - printf("Namespace Drive Attributes\n"); - printf("==========================\n"); - printf("NVM total cap: %s\n", - uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, sizeof(cbuf))); - printf("NVM unallocated cap: %s\n", - uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf))); - } + if (cdata->ver >= 0x010201) + printf("\nNVM Subsystem Name: %.256s\n", cdata->subnqn); }