From b3b0d41e94e1d2f5ba23aa39614ed9d5b5c0be31ca009ea3e2b9c864575dc126 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 14 Jun 2017 07:28:31 +0000 Subject: [PATCH] Accepting request 503608 from home:morbidrsa - Add NVMe over Fabrics specific id-ctrl fields (bsc#1037293) + add-missing-nvme_id_crtl-fileds.patch + 0003-nvme-cli-show-more-fields-for-id-ctrl.patch + 0004-nvme-cli-id-ctrl-display-additional-fields.patch OBS-URL: https://build.opensuse.org/request/show/503608 OBS-URL: https://build.opensuse.org/package/show/Base:System/nvme-cli?expand=0&rev=26 --- ...vme-cli-show-more-fields-for-id-ctrl.patch | 96 +++++++++++ ...li-id-ctrl-display-additional-fields.patch | 159 ++++++++++++++++++ add-missing-nvme_id_crtl-fileds.patch | 33 ++++ nvme-cli.changes | 8 + nvme-cli.spec | 6 + 5 files changed, 302 insertions(+) create mode 100644 0003-nvme-cli-show-more-fields-for-id-ctrl.patch create mode 100644 0004-nvme-cli-id-ctrl-display-additional-fields.patch create mode 100644 add-missing-nvme_id_crtl-fileds.patch diff --git a/0003-nvme-cli-show-more-fields-for-id-ctrl.patch b/0003-nvme-cli-show-more-fields-for-id-ctrl.patch new file mode 100644 index 0000000..0728691 --- /dev/null +++ b/0003-nvme-cli-show-more-fields-for-id-ctrl.patch @@ -0,0 +1,96 @@ +From 176ce81b8d3784a72a2d95888ce4a6f3e205e6e6 Mon Sep 17 00:00:00 2001 +From: Guan Junxiong +Date: Fri, 2 Jun 2017 15:18:19 +0800 +Subject: nvme-cli: show more fields for id-ctrl +Git-commit: 176ce81b8d3784a72a2d95888ce4a6f3e205e6e6 +Patch-mainline: v1.4 + +NVMe 1.3 inctrodues new fields such as EDSTT, DSTO, FWUG, HCTMA, MNTMT, +MXTMT, SANICAP into the idenfity controller data structure. The id-ctrl +command should print them or write them into json format. Note that +although KAS field is included in the previous NVMe 1.2.1 spec, this +patch also supports this field. + +Reviewed-by: Sagi Grimberg +Signed-off-by: Keith Busch +--- + nvme-print.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 52 insertions(+) + +diff --git a/nvme-print.c b/nvme-print.c +index 60fe119..ffa63ad 100644 +--- a/nvme-print.c ++++ b/nvme-print.c +@@ -198,6 +198,38 @@ static void show_nvme_id_ctrl_rpmbs(__le32 ctrl_rpmbs) + printf("\n"); + } + ++static void show_nvme_id_ctrl_hctma(__le16 ctrl_hctma) ++{ ++ __u16 hctma = le16_to_cpu(ctrl_hctma); ++ __u16 rsvd = (hctma & 0xFFFE) >> 1; ++ __u16 hctm = hctma & 0x1; ++ ++ if (rsvd) ++ printf(" [15:1] : %#x\tReserved\n", rsvd); ++ printf(" [0:0] : %#x\tHost Controlled Thermal Management %sSupported\n", ++ hctm, hctm ? "" : "Not "); ++ printf("\n"); ++} ++ ++static void show_nvme_id_ctrl_sanicap(__le32 ctrl_sanicap) ++{ ++ __u32 sanicap = le32_to_cpu(ctrl_sanicap); ++ __u32 rsvd = (sanicap & 0xFFFFFFF8) >> 3; ++ __u32 owr = (sanicap & 0x4) >> 2; ++ __u32 ber = (sanicap & 0x2) >> 1; ++ __u32 cer = sanicap & 0x1; ++ ++ if (rsvd) ++ printf(" [31:3] : %#x\tReserved\n", rsvd); ++ printf(" [2:2] : %#x\tOverwrite Sanitize Operation %sSupported\n", ++ owr, owr ? "" : "Not "); ++ printf(" [1:1] : %#x\tBlock Erase Sanitize Operation %sSupported\n", ++ ber, ber ? "" : "Not "); ++ printf(" [0:0] : %#x\tCrypto Erase Sanitize Operation %sSupported\n", ++ cer, cer ? "" : "Not "); ++ printf("\n"); ++} ++ + static void show_nvme_id_ctrl_sqes(__u8 sqes) + { + __u8 msqes = (sqes & 0xF0) >> 4; +@@ -643,6 +675,18 @@ void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve + printf("rpmbs : %#x\n", le32_to_cpu(ctrl->rpmbs)); + if (human) + show_nvme_id_ctrl_rpmbs(ctrl->rpmbs); ++ printf("edstt : %d\n", le16_to_cpu(ctrl->edstt)); ++ printf("dsto : %d\n", ctrl->dsto); ++ printf("fwug : %d\n", ctrl->fwug); ++ printf("kas : %d\n", le16_to_cpu(ctrl->kas)); ++ printf("hctma : %#x\n", le16_to_cpu(ctrl->hctma)); ++ if (human) ++ show_nvme_id_ctrl_hctma(ctrl->hctma); ++ printf("mntmt : %d\n", le16_to_cpu(ctrl->mntmt)); ++ printf("mxtmt : %d\n", le16_to_cpu(ctrl->mxtmt)); ++ printf("sanicap : %#x\n", le32_to_cpu(ctrl->sanicap)); ++ if (human) ++ show_nvme_id_ctrl_sanicap(ctrl->sanicap); + printf("sqes : %#x\n", ctrl->sqes); + if (human) + show_nvme_id_ctrl_sqes(ctrl->sqes); +@@ -1269,6 +1313,14 @@ void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*vs)( + json_object_add_value_float(root, "tnvmcap", tnvmcap); + json_object_add_value_float(root, "unvmcap", unvmcap); + json_object_add_value_int(root, "rpmbs", le32_to_cpu(ctrl->rpmbs)); ++ json_object_add_value_int(root, "edstt", le16_to_cpu(ctrl->edstt)); ++ json_object_add_value_int(root, "dsto", ctrl->dsto); ++ json_object_add_value_int(root, "fwug", ctrl->fwug); ++ json_object_add_value_int(root, "kas", le16_to_cpu(ctrl->kas)); ++ json_object_add_value_int(root, "hctma", le16_to_cpu(ctrl->hctma)); ++ json_object_add_value_int(root, "mntmt", le16_to_cpu(ctrl->mntmt)); ++ json_object_add_value_int(root, "mxtmt", le16_to_cpu(ctrl->mxtmt)); ++ json_object_add_value_int(root, "sanicap", le32_to_cpu(ctrl->sanicap)); + json_object_add_value_int(root, "sqes", ctrl->sqes); + json_object_add_value_int(root, "cqes", ctrl->cqes); + json_object_add_value_int(root, "nn", le32_to_cpu(ctrl->nn)); diff --git a/0004-nvme-cli-id-ctrl-display-additional-fields.patch b/0004-nvme-cli-id-ctrl-display-additional-fields.patch new file mode 100644 index 0000000..0fdb6a3 --- /dev/null +++ b/0004-nvme-cli-id-ctrl-display-additional-fields.patch @@ -0,0 +1,159 @@ +From 05b094b4e8af7dd5298b4d8e0903d6b85c1fd045 Mon Sep 17 00:00:00 2001 +From: "Schremmer, Steven" +Date: Wed, 7 Jun 2017 21:24:26 +0000 +Subject: [PATCH] nvme-cli: id-ctrl: display additional fields +Patch-mainline: v1.4 +Git-commit: 05b094b4e8af7dd5298b4d8e0903d6b85c1fd045 + +Additional fields displayed: ctratt, maxcmd, ioccsz, iorcsz, icdoff, +ctrattr, msdbd +Additional human-readable decode for lpa and sgls fields. + +Signed-off-by: Keith Busch +--- + nvme-print.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 57 insertions(+), 5 deletions(-) + +--- a/nvme-print.c ++++ b/nvme-print.c +@@ -106,6 +106,19 @@ static void show_nvme_id_ctrl_oaes(__le3 + printf("\n"); + } + ++static void show_nvme_id_ctrl_ctratt(__le32 ctrl_ctratt) ++{ ++ __u32 ctratt = le32_to_cpu(ctrl_ctratt); ++ __u32 rsvd0 = (ctratt & 0xFFFFFFFE) >> 1; ++ __u32 hostid128 = ctratt & 0x1; ++ ++ if (rsvd0) ++ printf(" [31:1] : %#x\tReserved\n", rsvd0); ++ printf(" [0:0] : %#x\t128-bit Host Identifier %sSupported\n", ++ hostid128, hostid128 ? "" : "Not "); ++ printf("\n"); ++} ++ + static void show_nvme_id_ctrl_oacs(__le16 ctrl_oacs) + { + __u16 oacs = le16_to_cpu(ctrl_oacs); +@@ -146,11 +159,14 @@ static void show_nvme_id_ctrl_frmw(__u8 + + static void show_nvme_id_ctrl_lpa(__u8 lpa) + { +- __u8 rsvd = (lpa & 0xFC) >> 2; ++ __u8 rsvd = (lpa & 0xF8) >> 3; ++ __u8 ed = (lpa & 0x4) >> 2; + __u8 celp = (lpa & 0x2) >> 1; + __u8 smlp = lpa & 0x1; + if (rsvd) +- printf(" [7:2] : %#x\tReserved\n", rsvd); ++ printf(" [7:3] : %#x\tReserved\n", rsvd); ++ printf(" [2:2] : %#x\tExtended data for Get Log Page %sSupported\n", ++ ed, ed ? "" : "Not "); + printf(" [1:1] : %#x\tCommand Effects Log Page %sSupported\n", + celp, celp ? "" : "Not "); + printf(" [0:0] : %#x\tSMART/Health Log Page per NS %sSupported\n", +@@ -335,7 +351,9 @@ static void show_nvme_id_ctrl_sgls(__le3 + __u32 sglltb = (sgls & 0x40000) >> 18; + __u32 bacmdb = (sgls & 0x20000) >> 17; + __u32 bbs = (sgls & 0x10000) >> 16; +- __u32 rsvd1 = (sgls & 0xFFFE) >> 1; ++ __u32 rsvd1 = (sgls & 0xFFF8) >> 3; ++ __u32 key = (sgls & 0x4) >> 2; ++ __u32 rsvd2 = (sgls & 0x2) >> 1; + __u32 sglsp = sgls & 0x1; + + if (rsvd0) +@@ -350,12 +368,28 @@ static void show_nvme_id_ctrl_sgls(__le3 + printf(" [16:16]: %#x\tSGL Bit-Bucket %sSupported\n", + bbs, bbs ? "" : "Not "); + if (rsvd1) +- printf(" [15:1] : %#x\tReserved\n", rsvd1); ++ printf(" [15:3] : %#x\tReserved\n", rsvd1); ++ if (sglsp || (!sglsp && key)) ++ printf(" [16:16]: %#x\tKeyed SGL Data Block descriptor %sSupported\n", ++ key, key ? "" : "Not "); ++ if (rsvd2) ++ printf(" [1:1] : %#x\tReserved\n", rsvd2); + printf(" [0:0] : %#x\tScatter-Gather Lists %sSupported\n", + sglsp, sglsp ? "" : "Not "); + printf("\n"); + } + ++static void show_nvme_id_ctrl_ctrattr(__u8 ctrattr) ++{ ++ __u8 rsvd = (ctrattr & 0xFE) >> 1; ++ __u8 scm = ctrattr & 0x1; ++ if (rsvd) ++ printf(" [7:1] : %#x\tReserved\n", rsvd); ++ printf(" [0:0] : %#x\t%s Controller Model\n", ++ scm, scm ? "Static" : "Dynamic"); ++ printf("\n"); ++} ++ + static void show_nvme_id_ns_nsfeat(__u8 nsfeat) + { + __u8 rsvd = (nsfeat & 0xF8) >> 3; +@@ -645,6 +679,9 @@ void __show_nvme_id_ctrl(struct nvme_id_ + printf("oaes : %#x\n", le32_to_cpu(ctrl->oaes)); + if (human) + show_nvme_id_ctrl_oaes(ctrl->oaes); ++ printf("ctratt : %#x\n", le32_to_cpu(ctrl->ctratt)); ++ if (human) ++ show_nvme_id_ctrl_ctratt(ctrl->ctratt); + printf("oacs : %#x\n", le16_to_cpu(ctrl->oacs)); + if (human) + show_nvme_id_ctrl_oacs(ctrl->oacs); +@@ -692,6 +729,7 @@ void __show_nvme_id_ctrl(struct nvme_id_ + printf("cqes : %#x\n", ctrl->cqes); + if (human) + show_nvme_id_ctrl_cqes(ctrl->cqes); ++ printf("maxcmd : %d\n", le16_to_cpu(ctrl->maxcmd)); + printf("nn : %d\n", le32_to_cpu(ctrl->nn)); + printf("oncs : %#x\n", le16_to_cpu(ctrl->oncs)); + if (human) +@@ -714,8 +752,14 @@ void __show_nvme_id_ctrl(struct nvme_id_ + printf("sgls : %x\n", le32_to_cpu(ctrl->sgls)); + if (human) + show_nvme_id_ctrl_sgls(ctrl->sgls); +- + printf("subnqn : %-.*s\n", (int)sizeof(ctrl->subnqn), ctrl->subnqn); ++ printf("ioccsz : %d\n", le32_to_cpu(ctrl->ioccsz)); ++ printf("iorcsz : %d\n", le32_to_cpu(ctrl->iorcsz)); ++ printf("icdoff : %d\n", le16_to_cpu(ctrl->icdoff)); ++ printf("ctrattr : %x\n", ctrl->ctrattr); ++ if (human) ++ show_nvme_id_ctrl_ctrattr(ctrl->ctrattr); ++ printf("msdbd : %d\n", ctrl->msdbd); + + show_nvme_id_ctrl_power(ctrl); + if (vendor_show) +@@ -1294,6 +1338,7 @@ void json_nvme_id_ctrl(struct nvme_id_ct + json_object_add_value_int(root, "rtd3r", le32_to_cpu(ctrl->rtd3r)); + json_object_add_value_int(root, "rtd3e", le32_to_cpu(ctrl->rtd3e)); + json_object_add_value_int(root, "oaes", le32_to_cpu(ctrl->oaes)); ++ json_object_add_value_int(root, "ctratt", le32_to_cpu(ctrl->ctratt)); + json_object_add_value_int(root, "oacs", le16_to_cpu(ctrl->oacs)); + json_object_add_value_int(root, "acl", ctrl->acl); + json_object_add_value_int(root, "aerl", ctrl->aerl); +@@ -1321,6 +1366,7 @@ void json_nvme_id_ctrl(struct nvme_id_ct + json_object_add_value_int(root, "sanicap", le32_to_cpu(ctrl->sanicap)); + json_object_add_value_int(root, "sqes", ctrl->sqes); + json_object_add_value_int(root, "cqes", ctrl->cqes); ++ json_object_add_value_int(root, "maxcmd", le16_to_cpu(ctrl->maxcmd)); + json_object_add_value_int(root, "nn", le32_to_cpu(ctrl->nn)); + json_object_add_value_int(root, "oncs", le16_to_cpu(ctrl->oncs)); + json_object_add_value_int(root, "fuses", le16_to_cpu(ctrl->fuses)); +@@ -1333,6 +1379,12 @@ void json_nvme_id_ctrl(struct nvme_id_ct + json_object_add_value_int(root, "sgls", le32_to_cpu(ctrl->sgls)); + json_object_add_value_string(root, "subnqn", subnqn); + ++ json_object_add_value_int(root, "ioccsz", le32_to_cpu(ctrl->ioccsz)); ++ json_object_add_value_int(root, "iorcsz", le32_to_cpu(ctrl->iorcsz)); ++ json_object_add_value_int(root, "icdoff", le16_to_cpu(ctrl->icdoff)); ++ json_object_add_value_int(root, "ctrattr", ctrl->ctrattr); ++ json_object_add_value_int(root, "msdbd", ctrl->msdbd); ++ + psds = json_create_array(); + json_object_add_value_array(root, "psds", psds); + diff --git a/add-missing-nvme_id_crtl-fileds.patch b/add-missing-nvme_id_crtl-fileds.patch new file mode 100644 index 0000000..b7d8637 --- /dev/null +++ b/add-missing-nvme_id_crtl-fileds.patch @@ -0,0 +1,33 @@ +From: Johannes Thumshirn +Subject: add missing nvme_id_ctrl fields +Date: Wed Jun 14 09:19:39 CEST 2017 +Patch-mainline: Never, SUSE backport specific + +Add missing fields in the nvme_id_ctrl structure introduced with NVMe +over Fabrics and needed for pretty printing NVMf information. + +Signed-off-by: Johannes Thumshirn +--- + linux/nvme.h | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/linux/nvme.h ++++ b/linux/nvme.h +@@ -207,9 +207,15 @@ struct nvme_id_ctrl { + __u8 tnvmcap[16]; + __u8 unvmcap[16]; + __le32 rpmbs; +- __u8 rsvd316[4]; ++ __le16 edstt; ++ __u8 dsto; ++ __u8 fwug; + __le16 kas; +- __u8 rsvd322[190]; ++ __le16 hctma; ++ __le16 mntmt; ++ __le16 mxtmt; ++ __le32 sanicap; ++ __u8 rsvd332[180]; + __u8 sqes; + __u8 cqes; + __le16 maxcmd; diff --git a/nvme-cli.changes b/nvme-cli.changes index 3303105..edb95cb 100644 --- a/nvme-cli.changes +++ b/nvme-cli.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Jun 14 07:01:27 UTC 2017 - jthumshirn@suse.com + +- Add NVMe over Fabrics specific id-ctrl fields (bsc#1037293) + + add-missing-nvme_id_crtl-fileds.patch + + 0003-nvme-cli-show-more-fields-for-id-ctrl.patch + + 0004-nvme-cli-id-ctrl-display-additional-fields.patch + ------------------------------------------------------------------- Fri May 12 07:10:37 UTC 2017 - jthumshirn@suse.com diff --git a/nvme-cli.spec b/nvme-cli.spec index 75db950..3d6de6c 100644 --- a/nvme-cli.spec +++ b/nvme-cli.spec @@ -28,6 +28,9 @@ BuildRequires: pkgconfig(libudev) BuildRoot: %{_tmppath}/%{name}-%{version}-build Patch0: 0001-fabrics-add-option-to-override-drivers-queue-depth.patch Patch1: 0002-fabrics-add-option-to-override-drivers-queue-depth-a.patch +Patch2: add-missing-nvme_id_crtl-fileds.patch +Patch3: 0003-nvme-cli-show-more-fields-for-id-ctrl.patch +Patch4: 0004-nvme-cli-id-ctrl-display-additional-fields.patch %description NVMe is a fast, scalable, direct attached storage interface. The nvme @@ -37,6 +40,9 @@ cli rpm installs core management tools with minimal dependencies. %setup -q -n %{name}-v%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build echo %{version} > version