Skip to content

Commit 75efb73

Browse files
nitin-saoigaw
authored andcommitted
nvme-print: add new field added in TP4090
As per TP4090, a new field support is added as NPDGL (Namespace Preferred Deallocate Granularity Large) and so the bit-field of NSFEAT, OPTPERF get extended by 1 bit. Signed-off-by: Nitin Sao <nitin.sao@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com> Reviewed-by: Mohit Kapoor <mohit.kap@samsung.com>
1 parent dca16e4 commit 75efb73

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

nvme-print-json.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
269269
obj_add_int(r, "nsattr", ns->nsattr);
270270
obj_add_int(r, "nvmsetid", le16_to_cpu(ns->nvmsetid));
271271

272-
if (ns->nsfeat & 0x10) {
272+
if (ns->nsfeat & 0x30) {
273273
obj_add_int(r, "npwg", le16_to_cpu(ns->npwg));
274274
obj_add_int(r, "npwa", le16_to_cpu(ns->npwa));
275-
obj_add_int(r, "npdg", le16_to_cpu(ns->npdg));
275+
if (ns->nsfeat & 0x10)
276+
obj_add_int(r, "npdg", le16_to_cpu(ns->npdg));
276277
obj_add_int(r, "npda", le16_to_cpu(ns->npda));
277278
obj_add_int(r, "nows", le16_to_cpu(ns->nows));
278279
}
@@ -3063,6 +3064,8 @@ static void json_nvme_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns,
30633064

30643065
array_add_obj(elbafs, elbaf);
30653066
}
3067+
if (ns->nsfeat & 0x20)
3068+
obj_add_int(r, "npdgl", le32_to_cpu(nvm_ns->npdgl));
30663069

30673070
json_print(r);
30683071
}

nvme-print-stdout.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -2345,17 +2345,18 @@ static void stdout_id_ctrl_ofcs(__le16 ofcs)
23452345

23462346
static void stdout_id_ns_nsfeat(__u8 nsfeat)
23472347
{
2348-
__u8 rsvd = (nsfeat & 0xE0) >> 5;
2349-
__u8 ioopt = (nsfeat & 0x10) >> 4;
2348+
__u8 rsvd = (nsfeat & 0xC0) >> 6;
2349+
__u8 optperf = (nsfeat & 0x30) >> 4;
23502350
__u8 uidreuse = (nsfeat & 0x8) >> 3;
23512351
__u8 dulbe = (nsfeat & 0x4) >> 2;
23522352
__u8 na = (nsfeat & 0x2) >> 1;
23532353
__u8 thin = nsfeat & 0x1;
23542354

23552355
if (rsvd)
2356-
printf(" [7:5] : %#x\tReserved\n", rsvd);
2357-
printf(" [4:4] : %#x\tNPWG, NPWA, NPDG, NPDA, and NOWS are %sSupported\n",
2358-
ioopt, ioopt ? "" : "Not ");
2356+
printf(" [7:6] : %#x\tReserved\n", rsvd);
2357+
printf(" [5:4] : %#x\tNPWG, NPWA, %s%sNPDA, and NOWS are %sSupported\n",
2358+
optperf, ((optperf & 0x1) || (!optperf)) ? "NPDG, " : "",
2359+
((optperf & 0x2) || (!optperf)) ? "NPDGL, " : "", optperf ? "" : "Not ");
23592360
printf(" [3:3] : %#x\tNGUID and EUI64 fields if non-zero, %sReused\n",
23602361
uidreuse, uidreuse ? "Never " : "");
23612362
printf(" [2:2] : %#x\tDeallocated or Unwritten Logical Block error %sSupported\n",
@@ -2588,10 +2589,11 @@ static void stdout_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
25882589
printf("noiob : %d\n", le16_to_cpu(ns->noiob));
25892590
printf("nvmcap : %s\n",
25902591
uint128_t_to_l10n_string(le128_to_cpu(ns->nvmcap)));
2591-
if (ns->nsfeat & 0x10) {
2592+
if (ns->nsfeat & 0x30) {
25922593
printf("npwg : %u\n", le16_to_cpu(ns->npwg));
25932594
printf("npwa : %u\n", le16_to_cpu(ns->npwa));
2594-
printf("npdg : %u\n", le16_to_cpu(ns->npdg));
2595+
if (ns->nsfeat & 0x10)
2596+
printf("npdg : %u\n", le16_to_cpu(ns->npdg));
25952597
printf("npda : %u\n", le16_to_cpu(ns->npda));
25962598
printf("nows : %u\n", le16_to_cpu(ns->nows));
25972599
}
@@ -3135,6 +3137,8 @@ static void stdout_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns, unsigned int nsid,
31353137
printf("elbaf %2d : qpif:%d pif:%d sts:%-2d %s\n", i,
31363138
qpif, pif, sts, i == lbaf ? in_use : "");
31373139
}
3140+
if (ns->nsfeat & 0x20)
3141+
printf("npdgl : %#x\n", le32_to_cpu(nvm_ns->npdgl));
31383142
}
31393143

31403144
static void stdout_zns_id_ctrl(struct nvme_zns_id_ctrl *ctrl)

0 commit comments

Comments
 (0)