]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print: add JSON for NVMe 1.4 NPWG, NPWA, NPDG, NPDA and NOWS fields
authorKenneth Heitke <kenneth.heitke@intel.com>
Tue, 11 Jun 2019 18:13:14 +0000 (12:13 -0600)
committerKenneth Heitke <kenneth.heitke@intel.com>
Thu, 20 Jun 2019 23:06:20 +0000 (17:06 -0600)
nvme-print.c

index 17478f9856e2eb03824b46995732310df3ed8f00..5ffc1b7514f71d40d8030f54289747ef411cc40f 100644 (file)
@@ -523,12 +523,15 @@ static void show_nvme_id_ctrl_ctrattr(__u8 ctrattr)
 
 static void show_nvme_id_ns_nsfeat(__u8 nsfeat)
 {
-       __u8 rsvd = (nsfeat & 0xF8) >> 3;
+       __u8 rsvd = (nsfeat & 0xE0) >> 5;
+       __u8 ioopt = (nsfeat & 0x10) >> 4;
        __u8 dulbe = (nsfeat & 0x4) >> 2;
        __u8 na = (nsfeat & 0x2) >> 1;
        __u8 thin = nsfeat & 0x1;
        if (rsvd)
-               printf("  [7:3] : %#x\tReserved\n", rsvd);
+               printf("  [7:5] : %#x\tReserved\n", rsvd);
+       printf("  [4:4] : %#x\tNPWG, NPWA, NPDG, NPDA, and NOWS are %sSupported\n",
+               ioopt, ioopt ? "" : "Not ");
        printf("  [2:2] : %#x\tDeallocated or Unwritten Logical Block error %sSupported\n",
                dulbe, dulbe ? "" : "Not ");
        printf("  [1:1] : %#x\tNamespace uses %s\n",
@@ -2296,6 +2299,14 @@ void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int mode)
        json_object_add_value_int(root, "nsattr", ns->nsattr);
        json_object_add_value_int(root, "nvmsetid", le16_to_cpu(ns->nvmsetid));
 
+       if (ns->nsfeat & 0x10) {
+               json_object_add_value_int(root, "npwg", le16_to_cpu(ns->npwg));
+               json_object_add_value_int(root, "npwa", le16_to_cpu(ns->npwa));
+               json_object_add_value_int(root, "npdg", le16_to_cpu(ns->npdg));
+               json_object_add_value_int(root, "npda", le16_to_cpu(ns->npda));
+               json_object_add_value_int(root, "nows", le16_to_cpu(ns->nows));
+       }
+
        json_object_add_value_int(root, "anagrpid", le32_to_cpu(ns->anagrpid));
        json_object_add_value_int(root, "endgid", le16_to_cpu(ns->endgid));