Author: mav
Date: Wed Aug 14 17:36:26 2019
New Revision: 351038
URL: https://svnweb.freebsd.org/changeset/base/351038

Log:
  Print few more useful identify fields.
  
  MFC after:    2 weeks

Modified:
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/identify_ext.c

Modified: head/sbin/nvmecontrol/identify.c
==============================================================================
--- head/sbin/nvmecontrol/identify.c    Wed Aug 14 17:17:52 2019        
(r351037)
+++ head/sbin/nvmecontrol/identify.c    Wed Aug 14 17:36:26 2019        
(r351038)
@@ -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: head/sbin/nvmecontrol/identify_ext.c
==============================================================================
--- head/sbin/nvmecontrol/identify_ext.c        Wed Aug 14 17:17:52 2019        
(r351037)
+++ head/sbin/nvmecontrol/identify_ext.c        Wed Aug 14 17:36:26 2019        
(r351038)
@@ -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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to