Skip to content

Commit 25a4a5d

Browse files
francispravin5igaw
authored andcommitted
nvme-print: print new id-ns fields added in NVM Command Set Spec 1.1
Print the new fields of Identify Namespace Data Structure added in NVM Command Set Specification 1.1. Signed-off-by: Francis Pravin <[email protected]>
1 parent 4512881 commit 25a4a5d

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

nvme-print-json.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
238238
obj_add_int(r, "nabspf", le16_to_cpu(ns->nabspf));
239239
obj_add_int(r, "noiob", le16_to_cpu(ns->noiob));
240240
obj_add_uint128(r, "nvmcap", nvmcap);
241-
obj_add_int(r, "nsattr", ns->nsattr);
242-
obj_add_int(r, "nvmsetid", le16_to_cpu(ns->nvmsetid));
243241

244242
if (ns->nsfeat & 0x30) {
245243
obj_add_int(r, "npwg", le16_to_cpu(ns->npwg));
@@ -253,12 +251,16 @@ static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
253251
obj_add_int(r, "mssrl", le16_to_cpu(ns->mssrl));
254252
obj_add_uint(r, "mcl", le32_to_cpu(ns->mcl));
255253
obj_add_int(r, "msrc", ns->msrc);
254+
obj_add_uint(r, "kpios", ns->kpios);
256255
}
257256

258257
obj_add_int(r, "nulbaf", ns->nulbaf);
259258

260259
if (!cap_only) {
260+
obj_add_uint(r, "kpiodaag", le32_to_cpu(ns->kpiodaag));
261261
obj_add_uint(r, "anagrpid", le32_to_cpu(ns->anagrpid));
262+
obj_add_int(r, "nsattr", ns->nsattr);
263+
obj_add_int(r, "nvmsetid", le16_to_cpu(ns->nvmsetid));
262264
obj_add_int(r, "endgid", le16_to_cpu(ns->endgid));
263265

264266
memset(eui64, 0, sizeof(eui64_buf));
@@ -271,8 +273,8 @@ static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
271273
for (i = 0; i < sizeof(ns->nguid); i++)
272274
nguid += sprintf(nguid, "%02x", ns->nguid[i]);
273275

274-
obj_add_str(r, "eui64", eui64_buf);
275276
obj_add_str(r, "nguid", nguid_buf);
277+
obj_add_str(r, "eui64", eui64_buf);
276278
}
277279

278280
obj_add_array(r, "lbafs", lbafs);

nvme-print-stdout.c

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,15 +2547,18 @@ static void stdout_id_ctrl_ofcs(__le16 ofcs)
25472547

25482548
static void stdout_id_ns_nsfeat(__u8 nsfeat)
25492549
{
2550-
__u8 rsvd = (nsfeat & 0xC0) >> 6;
2550+
__u8 optrperf = (nsfeat & 0x80) >> 7;
2551+
__u8 mam = (nsfeat & 0x40) >> 6;
25512552
__u8 optperf = (nsfeat & 0x30) >> 4;
25522553
__u8 uidreuse = (nsfeat & 0x8) >> 3;
25532554
__u8 dulbe = (nsfeat & 0x4) >> 2;
25542555
__u8 na = (nsfeat & 0x2) >> 1;
25552556
__u8 thin = nsfeat & 0x1;
25562557

2557-
if (rsvd)
2558-
printf(" [7:6] : %#x\tReserved\n", rsvd);
2558+
printf(" [7:7] : %#x\tNPRG, NPRA and NORS are %sSupported\n",
2559+
optrperf, optrperf ? "" : "Not ");
2560+
printf(" [6:6] : %#x\t%s Atomicity Mode applies to write operations\n",
2561+
mam, mam ? "Multiple" : "Single");
25592562
printf(" [5:4] : %#x\tNPWG, NPWA, %s%sNPDA, and NOWS are %sSupported\n",
25602563
optperf, ((optperf & 0x1) || (!optperf)) ? "NPDG, " : "",
25612564
((optperf & 0x2) || (!optperf)) ? "NPDGL, " : "", optperf ? "" : "Not ");
@@ -2647,13 +2650,16 @@ static void stdout_id_ns_dps(__u8 dps)
26472650

26482651
static void stdout_id_ns_nmic(__u8 nmic)
26492652
{
2650-
__u8 rsvd = (nmic & 0xFE) >> 1;
2651-
__u8 mp = nmic & 0x1;
2653+
__u8 rsvd = (nmic & 0xfc) >> 2;
2654+
__u8 disns = (nmic & 0x2) >> 1;
2655+
__u8 shrns = nmic & 0x1;
26522656

26532657
if (rsvd)
2654-
printf(" [7:1] : %#x\tReserved\n", rsvd);
2658+
printf(" [7:2] : %#x\tReserved\n", rsvd);
2659+
printf(" [1:1] : %#x\tNamespace is %sa Dispersed Namespace\n",
2660+
disns, disns ? "" : "Not ");
26552661
printf(" [0:0] : %#x\tNamespace Multipath %sCapable\n",
2656-
mp, mp ? "" : "Not ");
2662+
shrns, shrns ? "" : "Not ");
26572663
printf("\n");
26582664
}
26592665

@@ -2732,6 +2738,21 @@ static void stdout_id_ns_dlfeat(__u8 dlfeat)
27322738
printf("\n");
27332739
}
27342740

2741+
static void stdout_id_ns_kpios(__u8 kpios)
2742+
{
2743+
__u8 rsvd = (kpios & 0xfc) >> 2;
2744+
__u8 kpiosns = (kpios & 0x2) >> 1;
2745+
__u8 kpioens = kpios & 0x1;
2746+
2747+
if (rsvd)
2748+
printf(" [7:2] : %#x\tReserved\n", rsvd);
2749+
printf(" [1:1] : %#x\tKey Per I/O Capability %sSupported\n",
2750+
kpiosns, kpiosns ? "" : "Not ");
2751+
printf(" [0:0] : %#x\tKey Per I/O Capability %s\n", kpioens,
2752+
kpioens ? "Enabled" : "Disabled");
2753+
printf("\n");
2754+
}
2755+
27352756
static void stdout_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
27362757
unsigned int lba_index, bool cap_only)
27372758
{
@@ -2802,11 +2823,17 @@ static void stdout_id_ns(struct nvme_id_ns *ns, unsigned int nsid,
28022823
printf("mssrl : %u\n", le16_to_cpu(ns->mssrl));
28032824
printf("mcl : %u\n", le32_to_cpu(ns->mcl));
28042825
printf("msrc : %u\n", ns->msrc);
2826+
printf("kpios : %u\n", ns->kpios);
2827+
if (human)
2828+
stdout_id_ns_kpios(ns->kpios);
28052829
}
28062830
printf("nulbaf : %u\n", ns->nulbaf);
28072831
if (!cap_only) {
2832+
printf("kpiodaag: %u\n", le32_to_cpu(ns->kpiodaag));
28082833
printf("anagrpid: %u\n", le32_to_cpu(ns->anagrpid));
28092834
printf("nsattr : %u\n", ns->nsattr);
2835+
if (human)
2836+
stdout_id_ns_nsattr(ns->nsattr);
28102837
printf("nvmsetid: %d\n", le16_to_cpu(ns->nvmsetid));
28112838
printf("endgid : %d\n", le16_to_cpu(ns->endgid));
28122839

0 commit comments

Comments
 (0)