Accepting request 534900 from home:morbidrsa
- Update to version v1.4 (FATE#322735): * Fixup Security send/recv to read data from disk * Unbreak RPM build after bash completion files were moved in 7e4c7596 * fabrics: Fix disconnect_by_device from disconnecting instance 0 on error * lightnvm: allow to init target on factory mode * Fixed problem with security-recv binary output not working correctly * nvme-cli: return 0 if disconnect operation with cfg.nqn successfully * Fix compile for 32-bit * nvme-cli: Fix build on aarch64-linux-android-4.9 * nvme-cli: Huawei plug-in. * nvme-print: Fix line spacing on -H option * id-ctrl: remove new lines from json output * nvme-list: print empty lists when no devices are present * fabrics: add option to override drivers queue depth * nvme-cli: nvme-intel implement json output for smart-log * nvme-cli: Add parsing support for noiob * Fix potential device string truncation * fabrics: add option to override drivers queue depth also for connect-all command * Regenerate man-pages * Release v1.3 * nvme-print: Free only top-level json objects * fix use-after-free in pci.ids parsing * nvme-cli: add fields into identify controller data structure * nvme-cli: show more fields for id-ctrl * nvme-cli: id-ctrl: display additional fields * Show help when no or an invalid device is given * nvme-cli: add id-ctrl for nvme-huawei plug-in. * Fix spelling errors * fabrics: add hostid option to connect command * nvme-cli: add ns-descs subcommand OBS-URL: https://build.opensuse.org/request/show/534900 OBS-URL: https://build.opensuse.org/package/show/Base:System/nvme-cli?expand=0&rev=42
This commit is contained in:
parent
f8dd399eea
commit
27d8b67d1e
@ -1,85 +0,0 @@
|
||||
From c5e4e6fce969ecd5e02ad6668bcbd1f950aebae6 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Date: Wed, 10 May 2017 11:04:12 +0200
|
||||
Subject: fabrics: add option to override drivers queue depth
|
||||
Git-commit: c5e4e6fce969ecd5e02ad6668bcbd1f950aebae6
|
||||
Patch-mainline: Staged for v1.3
|
||||
References: bsc#1037297
|
||||
|
||||
Currently it is not possible to override the fabrics drivers default queue
|
||||
depth with the nvme userspace utility, but only when manually writing the
|
||||
parameters to the /dev/nvme-fabrics character device.
|
||||
|
||||
Add an option to override the drivers default queue depth for NVMe over
|
||||
fabrics.
|
||||
|
||||
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
||||
---
|
||||
Documentation/nvme-connect.txt | 6 ++++++
|
||||
fabrics.c | 11 +++++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
diff --git a/Documentation/nvme-connect.txt b/Documentation/nvme-connect.txt
|
||||
index 38fae39..a746a3a 100644
|
||||
--- a/Documentation/nvme-connect.txt
|
||||
+++ b/Documentation/nvme-connect.txt
|
||||
@@ -16,6 +16,7 @@ SYNOPSIS
|
||||
[--host-traddr=<traddr> | -w <traddr>]
|
||||
[--hostnqn=<hostnqn> | -q <hostnqn>]
|
||||
[--nr-io-queues=<#> | -i <#>]
|
||||
+ [--queue-size=<#> | -Q <#>]
|
||||
[--keep-alive-tmo=<#> | -k <#>]
|
||||
[--reconnect-delay=<#> | -c <#>]
|
||||
|
||||
@@ -73,6 +74,11 @@ OPTIONS
|
||||
--nr-io-queues=<#>::
|
||||
Overrides the default number of I/O queues create by the driver.
|
||||
|
||||
+-Q <#>::
|
||||
+--queue-size=<#>::
|
||||
+ Overrides the default number of elements in the I/O queues created
|
||||
+ by the driver.
|
||||
+
|
||||
-k <#>::
|
||||
--keep-alive-tmo=<#>::
|
||||
Overrides the default keep alive timeout (in seconds).
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 6648bae..a826ecc 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -52,6 +52,7 @@ static struct config {
|
||||
char *host_traddr;
|
||||
char *hostnqn;
|
||||
char *nr_io_queues;
|
||||
+ char *queue_size;
|
||||
char *keep_alive_tmo;
|
||||
char *reconnect_delay;
|
||||
char *raw;
|
||||
@@ -524,6 +525,15 @@ static int build_options(char *argstr, int max_len)
|
||||
max_len -= len;
|
||||
}
|
||||
|
||||
+ if (cfg.queue_size) {
|
||||
+ len = snprintf(argstr, max_len, ",queue_size=%s",
|
||||
+ cfg.queue_size);
|
||||
+ if (len < 0)
|
||||
+ return -EINVAL;
|
||||
+ argstr += len;
|
||||
+ max_len -= len;
|
||||
+ }
|
||||
+
|
||||
if (cfg.keep_alive_tmo) {
|
||||
len = snprintf(argstr, max_len, ",keep_alive_tmo=%s", cfg.keep_alive_tmo);
|
||||
if (len < 0)
|
||||
@@ -805,6 +815,7 @@ int connect(const char *desc, int argc, char **argv)
|
||||
{"host-traddr", 'w', "LIST", CFG_STRING, &cfg.host_traddr, required_argument, "host traddr (e.g. FC WWN's)" },
|
||||
{"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument, "user-defined hostnqn" },
|
||||
{"nr-io-queues", 'i', "LIST", CFG_STRING, &cfg.nr_io_queues, required_argument, "number of io queues to use (default is core count)" },
|
||||
+ {"queue-size", 'Q', "LIST", CFG_STRING, &cfg.queue_size, required_argument, "number of io queue elements to use (default 128)" },
|
||||
{"keep-alive-tmo", 'k', "LIST", CFG_STRING, &cfg.keep_alive_tmo, required_argument, "keep alive timeout period in seconds" },
|
||||
{"reconnect-delay", 'c', "LIST", CFG_STRING, &cfg.reconnect_delay, required_argument, "reconnect timeout period in seconds" },
|
||||
{NULL},
|
||||
--
|
||||
2.12.0
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 1d42c362af841aa3a67f9fd2be9c305df87dbbdb Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Date: Thu, 11 May 2017 19:44:30 +0200
|
||||
Subject: fabrics: add option to override drivers queue depth also for
|
||||
connect-all command
|
||||
Patch-mainline: Submitted, http://lists.infradead.org/pipermail/linux-nvme/2017-May/010144.html
|
||||
References: bsc#1037297
|
||||
|
||||
Currently it is not possible to override the fabrics drivers default
|
||||
queue depth with the nvme userspace utility's 'connect-all' command,
|
||||
but only when using the 'connect' command.
|
||||
|
||||
Add an option to override the drivers default queue depth for NVMe
|
||||
over fabrics with the 'connect-all' command as we did previouslt with the
|
||||
'connect' command.
|
||||
|
||||
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
---
|
||||
Documentation/nvme-connect-all.txt | 5 +++++
|
||||
fabrics.c | 1 +
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/Documentation/nvme-connect-all.txt b/Documentation/nvme-connect-all.txt
|
||||
index b4b3e40..03adac5 100644
|
||||
--- a/Documentation/nvme-connect-all.txt
|
||||
+++ b/Documentation/nvme-connect-all.txt
|
||||
@@ -81,6 +81,11 @@ OPTIONS
|
||||
and dump it to a raw binary file. By default 'nvme connect-all' will
|
||||
dump the output to stdout.
|
||||
|
||||
+-Q <#>::
|
||||
+--queue-size=<#>::
|
||||
+ Overrides the default number of elements in the I/O queues created
|
||||
+ by the driver.
|
||||
+
|
||||
EXAMPLES
|
||||
--------
|
||||
* Connect to all records returned by the Discover Controller with IP4 address
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index a826ecc..bbcca47 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -782,6 +782,7 @@ int discover(const char *desc, int argc, char **argv, bool connect)
|
||||
{"trsvcid", 's', "LIST", CFG_STRING, &cfg.trsvcid, required_argument, "transport service id (e.g. IP port)" },
|
||||
{"host-traddr", 'w', "LIST", CFG_STRING, &cfg.host_traddr, required_argument, "host traddr (e.g. FC WWN's)" },
|
||||
{"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument, "user-defined hostnqn (if default not used)" },
|
||||
+ {"queue-size", 'Q', "LIST", CFG_STRING, &cfg.queue_size, required_argument, "number of io queue elements to use (default 128)" },
|
||||
{"raw", 'r', "LIST", CFG_STRING, &cfg.raw, required_argument, "raw output file" },
|
||||
{NULL},
|
||||
};
|
||||
--
|
||||
2.12.0
|
||||
|
@ -1,96 +0,0 @@
|
||||
From 176ce81b8d3784a72a2d95888ce4a6f3e205e6e6 Mon Sep 17 00:00:00 2001
|
||||
From: Guan Junxiong <guanjunxiong@huawei.com>
|
||||
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 <sagi@grimberg.me>
|
||||
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
||||
---
|
||||
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));
|
@ -1,159 +0,0 @@
|
||||
From 05b094b4e8af7dd5298b4d8e0903d6b85c1fd045 Mon Sep 17 00:00:00 2001
|
||||
From: "Schremmer, Steven" <Steve.Schremmer@netapp.com>
|
||||
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 <keith.busch@intel.com>
|
||||
---
|
||||
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);
|
||||
|
@ -1,325 +0,0 @@
|
||||
From 84937e83e86e11328c8931abc60f7655fae44823 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Date: Fri, 23 Jun 2017 09:36:35 +0200
|
||||
Subject: nvme-cli: add ns-descs subcommand
|
||||
Git-commit: 84937e83e86e11328c8931abc60f7655fae44823
|
||||
Patch-mainline: v1.4
|
||||
References: bsc#1038235
|
||||
|
||||
NVMe 1.3 defines the "Namespace Identification Descriptor" command in
|
||||
NVMe Identify NS. This command returns a list of so called Namespace
|
||||
Identificastion Descriptors which currently can either be a EUI-64,
|
||||
a NGUID or a UUID.
|
||||
|
||||
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
||||
---
|
||||
linux/nvme.h | 14 +++++++
|
||||
nvme-builtin.h | 1 +
|
||||
nvme-ioctl.c | 6 +++
|
||||
nvme-ioctl.h | 1 +
|
||||
nvme-print.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
nvme-print.h | 2 +
|
||||
nvme.c | 63 +++++++++++++++++++++++++++++
|
||||
7 files changed, 209 insertions(+)
|
||||
|
||||
diff --git a/linux/nvme.h b/linux/nvme.h
|
||||
index 08bf0b1..d1a322b 100644
|
||||
--- a/linux/nvme.h
|
||||
+++ b/linux/nvme.h
|
||||
@@ -863,6 +863,20 @@ struct nvme_command {
|
||||
};
|
||||
};
|
||||
|
||||
+#define NVME_IDENTIFY_CMD_LEN 4096
|
||||
+#define NVME_ID_CNS_NS_DESC_LIST 0x3
|
||||
+enum {
|
||||
+ NVME_NIDT_EUI64 = 0x1,
|
||||
+ NVME_NIDT_NGUID = 0x2,
|
||||
+ NVME_NIDT_UUID = 0x3,
|
||||
+};
|
||||
+
|
||||
+struct nvme_ns_id_desc {
|
||||
+ __u8 nidt;
|
||||
+ __u8 nidl;
|
||||
+ __u16 reserved;
|
||||
+};
|
||||
+
|
||||
static inline bool nvme_is_write(struct nvme_command *cmd)
|
||||
{
|
||||
/*
|
||||
diff --git a/nvme-builtin.h b/nvme-builtin.h
|
||||
index 087fc19..91f361d 100644
|
||||
--- a/nvme-builtin.h
|
||||
+++ b/nvme-builtin.h
|
||||
@@ -11,6 +11,7 @@ COMMAND_LIST(
|
||||
ENTRY("id-ctrl", "Send NVMe Identify Controller", id_ctrl)
|
||||
ENTRY("id-ns", "Send NVMe Identify Namespace, display structure", id_ns)
|
||||
ENTRY("list-ns", "Send NVMe Identify List, display structure", list_ns)
|
||||
+ ENTRY("ns-descs", "Send NVMe Namespace Descriptor List, display structure", ns_descs)
|
||||
ENTRY("create-ns", "Creates a namespace with the provided parameters", create_ns)
|
||||
ENTRY("delete-ns", "Deletes a namespace from the controller", delete_ns)
|
||||
ENTRY("attach-ns", "Attaches a namespace to requested controller(s)", attach_ns)
|
||||
diff --git a/nvme-ioctl.c b/nvme-ioctl.c
|
||||
index a22399a..e3e9af4 100644
|
||||
--- a/nvme-ioctl.c
|
||||
+++ b/nvme-ioctl.c
|
||||
@@ -364,6 +364,12 @@ int nvme_identify_ctrl_list(int fd, __u32 nsid, __u16 cntid, void *data)
|
||||
return nvme_identify(fd, nsid, (cntid << 16) | cns, data);
|
||||
}
|
||||
|
||||
+int nvme_identify_ns_descs(int fd, __u32 nsid, void *data)
|
||||
+{
|
||||
+
|
||||
+ return nvme_identify(fd, nsid, NVME_ID_CNS_CTRL_LIST, data);
|
||||
+}
|
||||
+
|
||||
int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data)
|
||||
{
|
||||
struct nvme_admin_cmd cmd = {
|
||||
diff --git a/nvme-ioctl.h b/nvme-ioctl.h
|
||||
index 3beddf8..8faf345 100644
|
||||
--- a/nvme-ioctl.h
|
||||
+++ b/nvme-ioctl.h
|
||||
@@ -77,6 +77,7 @@ int nvme_identify_ctrl(int fd, void *data);
|
||||
int nvme_identify_ns(int fd, __u32 nsid, bool present, void *data);
|
||||
int nvme_identify_ns_list(int fd, __u32 nsid, bool all, void *data);
|
||||
int nvme_identify_ctrl_list(int fd, __u32 nsid, __u16 cntid, void *data);
|
||||
+int nvme_identify_ns_descs(int fd, __u32 nsid, void *data);
|
||||
|
||||
int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data);
|
||||
int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log);
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index 2da5acd..f0f7121 100644
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -3,6 +3,10 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
+#ifdef LIBUUID
|
||||
+#include <uuid/uuid.h>
|
||||
+#endif
|
||||
+
|
||||
#include "nvme-print.h"
|
||||
#include "json.h"
|
||||
#include "nvme-models.h"
|
||||
@@ -599,6 +603,124 @@ void show_nvme_id_ns(struct nvme_id_ns *ns, unsigned int mode)
|
||||
}
|
||||
}
|
||||
|
||||
+void json_nvme_id_ns_descs(void *data)
|
||||
+{
|
||||
+#ifdef LIBUUID
|
||||
+ uuid_t uuid;
|
||||
+ char uuid_str[37];
|
||||
+#endif
|
||||
+ __u8 eui64_desc[8];
|
||||
+ __u8 nguid_desc[16];
|
||||
+ char nguid_str[2 * sizeof(nguid_desc) + 1];
|
||||
+ char eui64_str[2 * sizeof(eui64_desc) + 1];
|
||||
+ char *eui64 = eui64_str;
|
||||
+ char *nguid = nguid_str;
|
||||
+ struct json_object *root;
|
||||
+ off_t off;
|
||||
+ int pos, len = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ root = json_create_object();
|
||||
+
|
||||
+ for (pos = 0; pos < NVME_IDENTIFY_CMD_LEN; pos += len) {
|
||||
+ struct nvme_ns_id_desc *cur = data + pos;
|
||||
+
|
||||
+ off = pos + sizeof(*cur);
|
||||
+
|
||||
+ if (cur->nidl == 0)
|
||||
+ break;
|
||||
+
|
||||
+ switch (cur->nidt) {
|
||||
+ case NVME_NIDT_EUI64:
|
||||
+ memset(eui64, 0, sizeof(eui64_str));
|
||||
+ memcpy(eui64_desc, data + off, sizeof(eui64_desc));
|
||||
+ for (i = 0; i < sizeof(eui64); i++)
|
||||
+ eui64 += sprintf(eui64, "%02x", eui64_desc[i]);
|
||||
+ len += sizeof(eui64);
|
||||
+ json_object_add_value_string(root, "eui64", eui64_str);
|
||||
+ break;
|
||||
+ case NVME_NIDT_NGUID:
|
||||
+ memset(nguid, 0, sizeof(nguid_str));
|
||||
+ memcpy(nguid_desc, data + off, sizeof(nguid_desc));
|
||||
+ for (i = 0; i < sizeof(nguid); i++)
|
||||
+ nguid += sprintf(nguid, "%02x", nguid_desc[i]);
|
||||
+ len += sizeof(nguid);
|
||||
+ json_object_add_value_string(root, "nguid", nguid_str);
|
||||
+ break;
|
||||
+#ifdef LIBUUID
|
||||
+ case NVME_NIDT_UUID:
|
||||
+ memcpy(uuid, data + off, 16);
|
||||
+ uuid_unparse_lower(uuid, uuid_str);
|
||||
+ len += sizeof(uuid);
|
||||
+ json_object_add_value_string(root, "uuid", uuid_str);
|
||||
+ break;
|
||||
+#endif
|
||||
+ default:
|
||||
+ /* Skip unnkown types */
|
||||
+ len = cur->nidl;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ len += sizeof(*cur);
|
||||
+ }
|
||||
+
|
||||
+ json_print_object(root, NULL);
|
||||
+ printf("\n");
|
||||
+ json_free_object(root);
|
||||
+}
|
||||
+
|
||||
+void show_nvme_id_ns_descs(void *data)
|
||||
+{
|
||||
+ int pos, len = 0;
|
||||
+ int i;
|
||||
+#ifdef LIBUUID
|
||||
+ uuid_t uuid;
|
||||
+ char uuid_str[37];
|
||||
+#endif
|
||||
+ __u8 eui64[8];
|
||||
+ __u8 nguid[16];
|
||||
+
|
||||
+ for (pos = 0; pos < NVME_IDENTIFY_CMD_LEN; pos += len) {
|
||||
+ struct nvme_ns_id_desc *cur = data + pos;
|
||||
+
|
||||
+ if (cur->nidl == 0)
|
||||
+ break;
|
||||
+
|
||||
+ switch (cur->nidt) {
|
||||
+ case NVME_NIDT_EUI64:
|
||||
+ memcpy(eui64, data + pos + sizeof(*cur), sizeof(eui64));
|
||||
+ printf("eui64 : ");
|
||||
+ for (i = 0; i < 8; i++)
|
||||
+ printf("%02x", eui64[i]);
|
||||
+ printf("\n");
|
||||
+ len += sizeof(eui64);
|
||||
+ break;
|
||||
+ case NVME_NIDT_NGUID:
|
||||
+ memcpy(nguid, data + pos + sizeof(*cur), sizeof(nguid));
|
||||
+ printf("nguid : ");
|
||||
+ for (i = 0; i < 16; i++)
|
||||
+ printf("%02x", nguid[i]);
|
||||
+ printf("\n");
|
||||
+ len += sizeof(nguid);
|
||||
+ break;
|
||||
+#ifdef LIBUUID
|
||||
+ case NVME_NIDT_UUID:
|
||||
+ memcpy(uuid, data + pos + sizeof(*cur), 16);
|
||||
+ uuid_unparse_lower(uuid, uuid_str);
|
||||
+ printf("uuid : %s\n", uuid_str);
|
||||
+ len += sizeof(uuid);
|
||||
+ break;
|
||||
+#endif
|
||||
+ default:
|
||||
+ /* Skip unnkown types */
|
||||
+ len = cur->nidl;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ len += sizeof(*cur);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void print_ps_power_and_scale(__le16 ctr_power, __u8 scale)
|
||||
{
|
||||
__u16 power = le16_to_cpu(ctr_power);
|
||||
diff --git a/nvme-print.h b/nvme-print.h
|
||||
index 0502d0d..d39bc63 100644
|
||||
--- a/nvme-print.h
|
||||
+++ b/nvme-print.h
|
||||
@@ -26,6 +26,7 @@ void show_error_log(struct nvme_error_log_page *err_log, int entries, const char
|
||||
void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char *devname);
|
||||
void show_fw_log(struct nvme_firmware_log_page *fw_log, const char *devname);
|
||||
void show_ctrl_registers(void *bar, unsigned int mode);
|
||||
+void show_nvme_id_ns_descs(void *data);
|
||||
|
||||
void nvme_feature_show_fields(__u32 fid, unsigned int result, unsigned char *buf);
|
||||
char *nvme_status_to_string(__u32 status);
|
||||
@@ -39,6 +40,7 @@ void json_error_log(struct nvme_error_log_page *err_log, int entries, const char
|
||||
void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char *devname);
|
||||
void json_fw_log(struct nvme_firmware_log_page *fw_log, const char *devname);
|
||||
void json_print_list_items(struct list_item *items, unsigned amnt);
|
||||
+void json_nvme_id_ns_descs(void *data);
|
||||
|
||||
|
||||
#endif
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index a4e1b71..a2d6e7d 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -952,6 +952,69 @@ static int id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *pl
|
||||
return __id_ctrl(argc, argv, cmd, plugin, NULL);
|
||||
}
|
||||
|
||||
+static int ns_descs(int argc, char **argv, struct command *cmd, struct plugin *plugin)
|
||||
+{
|
||||
+ const char *desc = "Send Namespace Identification Descriptoprs commadn to the "\
|
||||
+ "given device, returns the namespace identifcation descriptors "\
|
||||
+ "of the specific namespace in either human-readable or binary format.";
|
||||
+ const char *raw_binary = "show infos in binary format";
|
||||
+ const char *namespace_id = "identifier of desired namespace";
|
||||
+ int err, fmt, fd;
|
||||
+ char *nsdescs[0x1000] = { };
|
||||
+ struct config {
|
||||
+ __u32 namespace_id;
|
||||
+ int raw_binary;
|
||||
+ char *output_format;
|
||||
+ };
|
||||
+
|
||||
+ struct config cfg = {
|
||||
+ .namespace_id = 0,
|
||||
+ .output_format = "normal",
|
||||
+ };
|
||||
+
|
||||
+ const struct argconfig_commandline_options command_line_options[] = {
|
||||
+ {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
|
||||
+ {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
|
||||
+ {"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
|
||||
+ {NULL}
|
||||
+ };
|
||||
+
|
||||
+ if (posix_memalign((void *)&nsdescs, getpagesize(), 0x1000)) {
|
||||
+ fprintf(stderr, "can not allocate controller list payload\n");
|
||||
+ return ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
|
||||
+ if (fd < 0)
|
||||
+ return fd;
|
||||
+
|
||||
+ fmt = validate_output_format(cfg.output_format);
|
||||
+ if (fmt < 0)
|
||||
+ return fmt;
|
||||
+ if (cfg.raw_binary)
|
||||
+ fmt = BINARY;
|
||||
+ if (!cfg.namespace_id)
|
||||
+ cfg.namespace_id = get_nsid(fd);
|
||||
+
|
||||
+ err = nvme_identify_ns_descs(fd, cfg.namespace_id, &nsdescs);
|
||||
+ if (!err) {
|
||||
+ if (fmt == BINARY)
|
||||
+ d_raw((unsigned char *)&nsdescs, 0x1000);
|
||||
+ else if (fmt == JSON)
|
||||
+ json_nvme_id_ns_descs(&nsdescs);
|
||||
+ else {
|
||||
+ printf("NVME Namespace Identification Descriptors NS %d:\n", cfg.namespace_id);
|
||||
+ show_nvme_id_ns_descs(&nsdescs);
|
||||
+ }
|
||||
+ }
|
||||
+ else if (err > 0)
|
||||
+ fprintf(stderr, "NVMe Status:%s(%x) NSID:%d\n",
|
||||
+ nvme_status_to_string(err), err, cfg.namespace_id);
|
||||
+ else
|
||||
+ perror("identify namespace");
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plugin)
|
||||
{
|
||||
const char *desc = "Send an Identify Namespace command to the "\
|
@ -1,150 +0,0 @@
|
||||
From 9fcf19a9ecbfb46d3beee42d31205fefa9ab3ca2 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Date: Tue, 20 Jun 2017 14:42:26 +0200
|
||||
Subject: [PATCH nvme-cli] fabrics: add hostid option to connect command
|
||||
|
||||
Add an option to pass in the hostid either via command line or a new config
|
||||
file /etc/nvme/hostid.
|
||||
|
||||
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
|
||||
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
||||
---
|
||||
fabrics.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||
linux/nvme.h | 1 +
|
||||
nvme.spec.in | 4 ++++
|
||||
3 files changed, 47 insertions(+)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index bbcca470c72a..87cdba2851d1 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -51,6 +51,7 @@ static struct config {
|
||||
char *trsvcid;
|
||||
char *host_traddr;
|
||||
char *hostnqn;
|
||||
+ char *hostid;
|
||||
char *nr_io_queues;
|
||||
char *queue_size;
|
||||
char *keep_alive_tmo;
|
||||
@@ -63,6 +64,7 @@ static struct config {
|
||||
#define PATH_NVME_FABRICS "/dev/nvme-fabrics"
|
||||
#define PATH_NVMF_DISC "/etc/nvme/discovery.conf"
|
||||
#define PATH_NVMF_HOSTNQN "/etc/nvme/hostnqn"
|
||||
+#define PATH_NVMF_HOSTID "/etc/nvme/hostid"
|
||||
#define SYS_NVME "/sys/class/nvme"
|
||||
#define MAX_DISC_ARGS 10
|
||||
|
||||
@@ -456,6 +458,29 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int nvmf_hostid_file(void)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+ char hostid[NVMF_HOSTID_SIZE];
|
||||
+ int ret = false;
|
||||
+
|
||||
+ f = fopen(PATH_NVMF_HOSTID, "r");
|
||||
+ if (f == NULL)
|
||||
+ return false;
|
||||
+
|
||||
+ if (fgets(hostid, sizeof(hostid), f) == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ cfg.hostid = strdup(hostid);
|
||||
+ if (!cfg.hostid)
|
||||
+ goto out;
|
||||
+
|
||||
+ ret = true;
|
||||
+out:
|
||||
+ fclose(f);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int build_options(char *argstr, int max_len)
|
||||
{
|
||||
int len;
|
||||
@@ -516,6 +541,14 @@ static int build_options(char *argstr, int max_len)
|
||||
max_len -= len;
|
||||
}
|
||||
|
||||
+ if (cfg.hostid || nvmf_hostid_file()) {
|
||||
+ len = snprintf(argstr, max_len, ",hostid=%s", cfg.hostid);
|
||||
+ if (len < 0)
|
||||
+ return -EINVAL;
|
||||
+ argstr += len;
|
||||
+ max_len -= len;
|
||||
+ }
|
||||
+
|
||||
if (cfg.nr_io_queues) {
|
||||
len = snprintf(argstr, max_len, ",nr_io_queues=%s",
|
||||
cfg.nr_io_queues);
|
||||
@@ -582,6 +615,13 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
|
||||
p += len;
|
||||
}
|
||||
|
||||
+ if (cfg.hostid) {
|
||||
+ len = sprintf(p, ",hostid=%s", cfg.hostid);
|
||||
+ if (len < 0)
|
||||
+ return -EINVAL;
|
||||
+ p += len;
|
||||
+ }
|
||||
+
|
||||
switch (e->trtype) {
|
||||
case NVMF_TRTYPE_LOOP: /* loop */
|
||||
len = sprintf(p, ",transport=loop");
|
||||
@@ -782,6 +822,7 @@ int discover(const char *desc, int argc, char **argv, bool connect)
|
||||
{"trsvcid", 's', "LIST", CFG_STRING, &cfg.trsvcid, required_argument, "transport service id (e.g. IP port)" },
|
||||
{"host-traddr", 'w', "LIST", CFG_STRING, &cfg.host_traddr, required_argument, "host traddr (e.g. FC WWN's)" },
|
||||
{"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument, "user-defined hostnqn (if default not used)" },
|
||||
+ {"hostid", 'I', "LIST", CFG_STRING, &cfg.hostid, required_argument, "user-defined hostid (if default not used)"},
|
||||
{"queue-size", 'Q', "LIST", CFG_STRING, &cfg.queue_size, required_argument, "number of io queue elements to use (default 128)" },
|
||||
{"raw", 'r', "LIST", CFG_STRING, &cfg.raw, required_argument, "raw output file" },
|
||||
{NULL},
|
||||
@@ -815,6 +856,7 @@ int connect(const char *desc, int argc, char **argv)
|
||||
{"trsvcid", 's', "LIST", CFG_STRING, &cfg.trsvcid, required_argument, "transport service id (e.g. IP port)" },
|
||||
{"host-traddr", 'w', "LIST", CFG_STRING, &cfg.host_traddr, required_argument, "host traddr (e.g. FC WWN's)" },
|
||||
{"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument, "user-defined hostnqn" },
|
||||
+ {"hostid", 'I', "LIST", CFG_STRING, &cfg.hostid, required_argument, "user-defined hostid (if default not used)"},
|
||||
{"nr-io-queues", 'i', "LIST", CFG_STRING, &cfg.nr_io_queues, required_argument, "number of io queues to use (default is core count)" },
|
||||
{"queue-size", 'Q', "LIST", CFG_STRING, &cfg.queue_size, required_argument, "number of io queue elements to use (default 128)" },
|
||||
{"keep-alive-tmo", 'k', "LIST", CFG_STRING, &cfg.keep_alive_tmo, required_argument, "keep alive timeout period in seconds" },
|
||||
diff --git a/linux/nvme.h b/linux/nvme.h
|
||||
index b2c8dbb2244b..08bf0b13cf38 100644
|
||||
--- a/linux/nvme.h
|
||||
+++ b/linux/nvme.h
|
||||
@@ -23,6 +23,7 @@
|
||||
/* However the max length of a qualified name is another size */
|
||||
#define NVMF_NQN_SIZE 223
|
||||
|
||||
+#define NVMF_HOSTID_SIZE 36
|
||||
#define NVMF_TRSVCID_SIZE 32
|
||||
#define NVMF_TRADDR_SIZE 256
|
||||
#define NVMF_TSAS_SIZE 256
|
||||
diff --git a/nvme.spec.in b/nvme.spec.in
|
||||
index c14b3f0f96dc..0be61e398fd0 100644
|
||||
--- a/nvme.spec.in
|
||||
+++ b/nvme.spec.in
|
||||
@@ -7,6 +7,7 @@ Group: Development/Tools
|
||||
URL: https://github.com/linux-nvme/nvme-cli/
|
||||
Source: nvme-@@VERSION@@.tar.gz
|
||||
Provides: nvme
|
||||
+Requires(post): uuidgen
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
@@ -39,6 +40,9 @@ if [ $1 = 1 ]; then # 1 : This package is being installed for the first time
|
||||
install -D /dev/null /etc/nvme/hostnqn
|
||||
echo $(nvme gen-hostnqn) > /etc/nvme/hostnqn
|
||||
fi
|
||||
+ if [ ! -f /etc/nvme/hostid ]; then
|
||||
+ uuidgen > /etc/nvme/hostid
|
||||
+ fi
|
||||
fi
|
||||
|
||||
%preun
|
||||
--
|
||||
2.12.3
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 0832d06cd62d3541489a3b74e6280b6b68522880 Mon Sep 17 00:00:00 2001
|
||||
From: Guan Junxiong <guanjunxiong@huawei.com>
|
||||
Date: Thu, 3 Aug 2017 21:38:16 +0800
|
||||
Subject: [PATCH] nvme-cli: fix connecting failure due to invalid uuid format
|
||||
of hostid
|
||||
|
||||
When we connect or discover a target with --hostid option via the
|
||||
/etc/nvme/hostid file, we fails this operation because the hostid
|
||||
is only 35 not 36 bytes which doesn't pass the uuid checking in the
|
||||
kernel.The last character is overridden with null bytes because fgets
|
||||
reads at most one less than sizeof of buffer characters.
|
||||
|
||||
Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
||||
---
|
||||
fabrics.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index da4e04e..9ed1127 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -463,7 +463,7 @@ static int nvmf_hostnqn_file(void)
|
||||
static int nvmf_hostid_file(void)
|
||||
{
|
||||
FILE *f;
|
||||
- char hostid[NVMF_HOSTID_SIZE];
|
||||
+ char hostid[NVMF_HOSTID_SIZE + 1];
|
||||
int ret = false;
|
||||
|
||||
f = fopen(PATH_NVMF_HOSTID, "r");
|
@ -1,42 +0,0 @@
|
||||
From 7352a2c76a4061196b5be1d1fac516135fd1f1f9 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Verkamp <daniel.verkamp@intel.com>
|
||||
Date: Wed, 30 Aug 2017 15:25:16 -0700
|
||||
Subject: [PATCH] nvme-cli: generate spec-compliant UUID NQNs
|
||||
|
||||
The gen-hostnqn command previously generated UUID NQNs in a format that
|
||||
does not match the NVMe specification.
|
||||
|
||||
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
||||
---
|
||||
Documentation/nvme-gen-hostnqn.txt | 2 +-
|
||||
nvme.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Documentation/nvme-gen-hostnqn.txt b/Documentation/nvme-gen-hostnqn.txt
|
||||
index 6d5346f..9efefb5 100644
|
||||
--- a/Documentation/nvme-gen-hostnqn.txt
|
||||
+++ b/Documentation/nvme-gen-hostnqn.txt
|
||||
@@ -13,7 +13,7 @@ SYNOPSIS
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Generate a random host NQN in the form:
|
||||
-nqn.2014-08.org.nvmexpress:NVMf:uuid:1b4e28ba-2fa1-11d2-883f-0016d3cca427
|
||||
+nqn.2014-08.org.nvmexpress:uuid:1b4e28ba-2fa1-11d2-883f-0016d3cca427
|
||||
and prints it to stdout.
|
||||
|
||||
OPTIONS
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index 676e8bf..f1d6d65 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -3217,7 +3217,7 @@ static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struc
|
||||
|
||||
uuid_generate_random(uuid);
|
||||
uuid_unparse_lower(uuid, uuid_str);
|
||||
- printf("nqn.2014-08.org.nvmexpress:NVMf:uuid:%s\n", uuid_str);
|
||||
+ printf("nqn.2014-08.org.nvmexpress:uuid:%s\n", uuid_str);
|
||||
return 0;
|
||||
}
|
||||
#else
|
@ -3,7 +3,8 @@ From: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
Date: Mon, 16 Oct 2017 13:01:05 +0200
|
||||
Subject: [PATCH nvme-cli] fabrics: also set queue_size and nr_io_queues on connect-all connects
|
||||
References: bsc#1063462
|
||||
Patch-mainline: Submitted, http://lists.infradead.org/pipermail/linux-nvme/2017-October/013303.html
|
||||
Git-commit: 6d0325499981b3418624b6ff9c2d43285c711d3c
|
||||
Patch-mainline: Targeted v1.5
|
||||
|
||||
Although nvme connect-all -Q does set the queue_size parameter for the initial
|
||||
discovery connection, it does not set it for the subsequent connections to the
|
||||
|
4
_service
4
_service
@ -3,8 +3,8 @@
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://github.com/linux-nvme/nvme-cli.git</param>
|
||||
<param name="filename">nvme-cli</param>
|
||||
<param name="version">v1.2</param>
|
||||
<param name="revision">v1.2</param>
|
||||
<param name="version">v1.4</param>
|
||||
<param name="revision">v1.4</param>
|
||||
<param name="exclude">.git</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">https://github.com/linux-nvme/nvme-cli.git</param>
|
||||
<param name="changesrevision">891899661cae31be232a8046bded2c1e928be8d7</param></service></servicedata>
|
||||
<param name="changesrevision">10e0bf6130ddd3c0b937093dabfc93b4fb5614d7</param></service></servicedata>
|
@ -1,33 +0,0 @@
|
||||
From: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
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 <jthumshirn@suse.de>
|
||||
---
|
||||
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;
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e107fbc59c04e74d5efdd67ee0cdf3e7cf87f2def3a666f7d003303950a8613
|
||||
size 238181
|
3
nvme-cli-v1.4.tar.gz
Normal file
3
nvme-cli-v1.4.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:749aa78c53d621398c9d326bd6d13648060864070af3dc1af9f45ba122bd2eb3
|
||||
size 270763
|
@ -1,3 +1,94 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 18 07:11:40 UTC 2017 - jthumshirn@suse.com
|
||||
|
||||
- Update to version v1.4 (FATE#322735):
|
||||
* Fixup Security send/recv to read data from disk
|
||||
* Unbreak RPM build after bash completion files were moved in 7e4c7596
|
||||
* fabrics: Fix disconnect_by_device from disconnecting instance 0 on error
|
||||
* lightnvm: allow to init target on factory mode
|
||||
* Fixed problem with security-recv binary output not working correctly
|
||||
* nvme-cli: return 0 if disconnect operation with cfg.nqn successfully
|
||||
* Fix compile for 32-bit
|
||||
* nvme-cli: Fix build on aarch64-linux-android-4.9
|
||||
* nvme-cli: Huawei plug-in.
|
||||
* nvme-print: Fix line spacing on -H option
|
||||
* id-ctrl: remove new lines from json output
|
||||
* nvme-list: print empty lists when no devices are present
|
||||
* fabrics: add option to override drivers queue depth
|
||||
* nvme-cli: nvme-intel implement json output for smart-log
|
||||
* nvme-cli: Add parsing support for noiob
|
||||
* Fix potential device string truncation
|
||||
* fabrics: add option to override drivers queue depth also for connect-all command
|
||||
* Regenerate man-pages
|
||||
* Release v1.3
|
||||
* nvme-print: Free only top-level json objects
|
||||
* fix use-after-free in pci.ids parsing
|
||||
* nvme-cli: add fields into identify controller data structure
|
||||
* nvme-cli: show more fields for id-ctrl
|
||||
* nvme-cli: id-ctrl: display additional fields
|
||||
* Show help when no or an invalid device is given
|
||||
* nvme-cli: add id-ctrl for nvme-huawei plug-in.
|
||||
* Fix spelling errors
|
||||
* fabrics: add hostid option to connect command
|
||||
* nvme-cli: add ns-descs subcommand
|
||||
* nvme-cli: Get Feature support for Extended Host Id
|
||||
* nvme-cli: Fix typo in Intel plugin and improve generic help text
|
||||
* Implement Intel Vendor specific logs
|
||||
* nvme-cli: add thermal management fields for smart-log
|
||||
* nvme-cli: add temperature sensor fields in json_smart_log
|
||||
* nvme-cli: add output-format discription for smart-log
|
||||
* Formatting update
|
||||
* Regenerate documentation
|
||||
* nvme-cli: add error message for nvme list.
|
||||
* Fix typo of flbas in nvme_create_max_ns_test
|
||||
* Show help for get-ns-id
|
||||
* Show help for nvme reset and subsystem-reset
|
||||
* nvme-cli: Extended Data Structure in resv-report
|
||||
* Update docs
|
||||
* resync nvme.h with the kernel nvme.h
|
||||
* nvme-cli : add support for sanitize command.
|
||||
* nvme-cli : add sanitize command documentation.
|
||||
* nvme-cli : add support for retrieving sanitize log.
|
||||
* nvme-cli : add sanitize-log command documentation.
|
||||
* fix build without libuuid
|
||||
* nvme-cli : wdc-plug-in : return on invalid input device.
|
||||
* nvme-cli : only print help text and return for nvme list -h option.
|
||||
* nvme-cli/list-ns: fix identifying active or allocated namespaces list
|
||||
* Fixed get_internal_log to parse the entire nlog and allow selection of specific regions to be parsed.
|
||||
* NVMe-CLI Fix Sanitize Command Parameter Types
|
||||
* Fix app tag and mask setting
|
||||
* Fix app tag field sizes
|
||||
* nvme-cli/list: fix when nvme device can not be open
|
||||
* nvme-cli/list: change fd returned by open operation from unsigned to signed.
|
||||
* Makefile: allow linker override for cross uuid test
|
||||
* nvme-cli: fix connecting failure due to invalid uuid format of hostid
|
||||
* nvme-cli/fabrics: Add ctrl-loss-tmo param to connect cmd
|
||||
* Fixing macro definitions to avoid issues when these are used in expressions
|
||||
* nvme-cli: add nvme directive command support
|
||||
* nvme-cli: add documentation for directive commands
|
||||
* fix for issue 219, show-regs reports AQA.ACQS and AQA.ASQS as bytes
|
||||
* nvme-cli: Fix nvme ns desc
|
||||
* new bit fields (6, 7, and 8) for OACS from NVMe rev 1.3
|
||||
* added new bit field (6) to ONCS from NVMe rev 1.3
|
||||
* nvme-cli: Describe action 3 of nvme activate
|
||||
* nvme-cli: generate spec-compliant UUID NQNs
|
||||
* NVMe-CLI Fixed Status Code check for reset type on fw-activate.
|
||||
* Added handling for temperature threshold values below 0C(273K) and removed buffer check for human readable output as Temperature threshold feature does not use Memory Buffer for Attributes
|
||||
* Update nvme.c
|
||||
* nvme-cli : Add Namespace Rescan Command
|
||||
* nvme-cli : Add man documentation files for ns-rescan command.
|
||||
* Version 1.4 Release
|
||||
* Drop upstream patches:
|
||||
- 0001-fabrics-add-option-to-override-drivers-queue-depth.patch
|
||||
- 0002-fabrics-add-option-to-override-drivers-queue-depth-a.patch
|
||||
- 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
|
||||
- 0005-nvme-cli-add-ns-descs-subcommand.patch
|
||||
- 0006-fabrics-add-hostid-option-to-connect-command.patch
|
||||
- 0007-nvme-cli-fix-connecting-failure-due-to-invalid-uuid-format.patch
|
||||
- 0008-nvme-cli-generate-spec-compliant-uuid-nqns.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 17 08:55:35 UTC 2017 - jthumshirn@suse.com
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: nvme-cli
|
||||
Version: 1.2
|
||||
Version: 1.4
|
||||
Release: 0
|
||||
Summary: Core nvme tools
|
||||
License: GPL-2.0
|
||||
@ -29,15 +29,6 @@ BuildRequires: libuuid-devel
|
||||
BuildRequires: xmlto
|
||||
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
|
||||
Patch5: 0005-nvme-cli-add-ns-descs-subcommand.patch
|
||||
Patch6: 0006-fabrics-add-hostid-option-to-connect-command.patch
|
||||
Patch7: 0007-nvme-cli-fix-connecting-failure-due-to-invalid-uuid-format.patch
|
||||
Patch8: 0008-nvme-cli-generate-spec-compliant-uuid-nqns.patch
|
||||
Patch9: 0009-fabrics-also-set-queue_size-and-nr_io_queues-on-conn.patch
|
||||
|
||||
%description
|
||||
@ -46,15 +37,6 @@ cli rpm installs core management tools with minimal dependencies.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-v%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
|
||||
%build
|
||||
|
Loading…
Reference in New Issue
Block a user