]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print: print the new fields added in TP4165
authorFrancis Pravin <francis.p@samsung.com>
Wed, 7 Aug 2024 12:38:05 +0000 (18:08 +0530)
committerDaniel Wagner <wagi@monom.org>
Thu, 8 Aug 2024 06:49:42 +0000 (08:49 +0200)
Print the new fields added in TP4165.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme-print-json.c
nvme-print-stdout.c
nvme.c

index 6c3e45f463413784eaa008ad1ddf48429f4102cb..e71dea54f5e90d60602734cf23a7a535b318ee1a 100644 (file)
@@ -3033,6 +3033,7 @@ static void json_nvme_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm)
        obj_add_uint(r, "dmrl", ctrl_nvm->dmrl);
        obj_add_uint(r, "dmrsl", le32_to_cpu(ctrl_nvm->dmrsl));
        obj_add_uint64(r, "dmsl", le64_to_cpu(ctrl_nvm->dmsl));
+       obj_add_uint(r, "aocs", le16_to_cpu(ctrl_nvm->aocs));
 
        json_print(r);
 }
@@ -3066,6 +3067,7 @@ static void json_nvme_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns,
        }
        if (ns->nsfeat & 0x20)
                obj_add_int(r, "npdgl", le32_to_cpu(nvm_ns->npdgl));
+       obj_add_uint(r, "tlbaag", le32_to_cpu(nvm_ns->tlbaag));
 
        json_print(r);
 }
index 568704a27fe67f42e16f32c5ab8557e80d630c34..b9d902abaaa45d1e6fb105299587f388e0e915d0 100644 (file)
@@ -3053,8 +3053,22 @@ static void stdout_id_ctrl(struct nvme_id_ctrl *ctrl,
        }
 }
 
+static void stdout_id_ctrl_nvm_aocs(__u16 aocs)
+{
+       __u16 rsvd = (aocs & 0xfffe) >> 1;
+       __u8 ralbas = aocs & 0x1;
+
+       if (rsvd)
+               printf("  [15:1] : %#x\tReserved\n", rsvd);
+       printf("  [0:0] : %#x\tReporting Allocated LBA %sSupported\n", ralbas,
+               ralbas ? "" : "Not ");
+       printf("\n");
+}
+
 static void stdout_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm)
 {
+       int verbose = stdout_print_ops.flags & VERBOSE;
+
        printf("NVMe Identify Controller NVM:\n");
        printf("vsl    : %u\n", ctrl_nvm->vsl);
        printf("wzsl   : %u\n", ctrl_nvm->wzsl);
@@ -3062,6 +3076,9 @@ static void stdout_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm)
        printf("dmrl   : %u\n", ctrl_nvm->dmrl);
        printf("dmrsl  : %u\n", le32_to_cpu(ctrl_nvm->dmrsl));
        printf("dmsl   : %"PRIu64"\n", le64_to_cpu(ctrl_nvm->dmsl));
+       printf("aocs   : %u\n", le16_to_cpu(ctrl_nvm->aocs));
+       if (verbose)
+               stdout_id_ctrl_nvm_aocs(le16_to_cpu(ctrl_nvm->aocs));
 }
 
 static void stdout_nvm_id_ns_pic(__u8 pic)
@@ -3159,6 +3176,7 @@ static void stdout_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns, unsigned int nsid,
        }
        if (ns->nsfeat & 0x20)
                printf("npdgl : %#x\n", le32_to_cpu(nvm_ns->npdgl));
+       printf("tlbaag: %#x\n", le32_to_cpu(nvm_ns->tlbaag));
 }
 
 static void stdout_zns_id_ctrl(struct nvme_zns_id_ctrl *ctrl)
diff --git a/nvme.c b/nvme.c
index 20dfee648917d5230558948ad6cc52b6b25d65fb..a69ac9cdf5f863503213bbbf5bd2f5a817278f40 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3467,6 +3467,9 @@ static int nvm_id_ctrl(int argc, char **argv, struct command *cmd,
                return err;
        }
 
+       if (argconfig_parse_seen(opts, "verbose"))
+               flags |= VERBOSE;
+
        ctrl_nvm = nvme_alloc(sizeof(*ctrl_nvm));
        if (!ctrl_nvm)
                return -ENOMEM;