Compare commits
No commits in common. 'c8' and 'c9' have entirely different histories.
@ -1 +1 @@
|
||||
SOURCES/v1.16.tar.gz
|
||||
SOURCES/nvme-cli-2.4.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
2706485a7adb8134943102ff3f1a087e003f2b1f SOURCES/v1.16.tar.gz
|
||||
6583ee6fa9f715cbff11dd40aae7417e9e791691 SOURCES/nvme-cli-2.4.tar.gz
|
||||
|
@ -1,32 +0,0 @@
|
||||
From f74ac1b841b0aae73969debaed0444f0ecb03dba Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Mon, 15 Nov 2021 16:00:47 +0530
|
||||
Subject: [PATCH] fabrics: fix 'nvme connect' segfault if transport type is
|
||||
omitted
|
||||
|
||||
Check if the transport type is available before dereferencing
|
||||
it in discovery_trsvcid().
|
||||
|
||||
Fixes: 362c90f ("fabrics: add default port number for NVMe/TCP I/O
|
||||
controllers")
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
fabrics.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index d691191..adca89b 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -1070,6 +1070,8 @@ static void set_discovery_kato(struct fabrics_config *cfg)
|
||||
|
||||
static void discovery_trsvcid(struct fabrics_config *fabrics_cfg, bool discover)
|
||||
{
|
||||
+ if (!fabrics_cfg->transport)
|
||||
+ return;
|
||||
if (!strcmp(fabrics_cfg->transport, "tcp")) {
|
||||
if (discover) {
|
||||
/* Default port for NVMe/TCP discovery controllers */
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,75 @@
|
||||
From 34c197e0ac2d57734ab775f00b2d0758aca7b82f Mon Sep 17 00:00:00 2001
|
||||
From: John Meneghini <jmeneghi@redhat.com>
|
||||
Date: Fri, 14 Apr 2023 10:53:58 -0400
|
||||
Subject: [PATCH] nbft: make lookup_ctrl function public
|
||||
|
||||
To prepare for the addition of nbft functionality fixup the fabrics
|
||||
declarations.
|
||||
|
||||
Signed-off-by: John Meneghini <jmeneghi@redhat.com>
|
||||
---
|
||||
fabrics.c | 12 ++----------
|
||||
fabrics.h | 10 ++++++++++
|
||||
2 files changed, 12 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index f8078e59..80827b16 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "libnvme.h"
|
||||
#include "nvme-print.h"
|
||||
#include "nvme-print-json.h"
|
||||
+#include "fabrics.h"
|
||||
|
||||
#define PATH_NVMF_DISC SYSCONFDIR "/nvme/discovery.conf"
|
||||
#define PATH_NVMF_CONFIG SYSCONFDIR "/nvme/config.json"
|
||||
@@ -110,15 +111,6 @@ static const char *nvmf_config_file = "Use specified JSON configuration file or
|
||||
OPT_FLAG("data-digest", 'G', &c.data_digest, nvmf_data_digest), \
|
||||
OPT_FLAG("tls", 0, &c.tls, nvmf_tls) \
|
||||
|
||||
-struct tr_config {
|
||||
- const char *subsysnqn;
|
||||
- const char *transport;
|
||||
- const char *traddr;
|
||||
- const char *host_traddr;
|
||||
- const char *host_iface;
|
||||
- const char *trsvcid;
|
||||
-};
|
||||
-
|
||||
/*
|
||||
* Compare two C strings and handle NULL pointers gracefully.
|
||||
* If either of the two strings is NULL, return 0
|
||||
@@ -202,7 +194,7 @@ static nvme_ctrl_t lookup_discovery_ctrl(nvme_root_t r, struct tr_config *trcfg)
|
||||
return __lookup_ctrl(r, trcfg, disc_ctrl_config_match);
|
||||
}
|
||||
|
||||
-static nvme_ctrl_t lookup_ctrl(nvme_root_t r, struct tr_config *trcfg)
|
||||
+nvme_ctrl_t lookup_ctrl(nvme_root_t r, struct tr_config *trcfg)
|
||||
{
|
||||
return __lookup_ctrl(r, trcfg, ctrl_config_match);
|
||||
}
|
||||
diff --git a/fabrics.h b/fabrics.h
|
||||
index d1e16fc5..02cebf5d 100644
|
||||
--- a/fabrics.h
|
||||
+++ b/fabrics.h
|
||||
@@ -2,6 +2,16 @@
|
||||
#ifndef _FABRICS_H
|
||||
#define _FABRICS_H
|
||||
|
||||
+struct tr_config {
|
||||
+ const char *subsysnqn;
|
||||
+ const char *transport;
|
||||
+ const char *traddr;
|
||||
+ const char *host_traddr;
|
||||
+ const char *host_iface;
|
||||
+ const char *trsvcid;
|
||||
+};
|
||||
+
|
||||
+extern nvme_ctrl_t lookup_ctrl(nvme_root_t r, struct tr_config *trcfg);
|
||||
extern int nvmf_discover(const char *desc, int argc, char **argv, bool connect);
|
||||
extern int nvmf_connect(const char *desc, int argc, char **argv);
|
||||
extern int nvmf_disconnect(const char *desc, int argc, char **argv);
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From ff8f9b6f59b574fda24a071fb0af4381c0cc6d9f Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Thu, 9 Dec 2021 12:21:51 +0100
|
||||
Subject: [PATCH 1/6] fabrics: fix a buffer overrun
|
||||
|
||||
the uuid buffer size must be at least 37 bytes to avoid
|
||||
corrupting the memory
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
fabrics.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index adca89b..0766729 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -883,7 +883,7 @@ static char *hostnqn_generate_systemd(void)
|
||||
|
||||
static char *hostnqn_read_dmi(void)
|
||||
{
|
||||
- char uuid[16];
|
||||
+ char uuid[37];
|
||||
char *ret = NULL;
|
||||
|
||||
if (uuid_from_dmi(uuid) < 0)
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,451 @@
|
||||
From a71a08532b5f06ee19ee2ff118a23cec4ecb6719 Mon Sep 17 00:00:00 2001
|
||||
From: Stuart Hayes <stuart_hayes@dell.com>
|
||||
Date: Wed, 15 Jun 2022 11:42:50 -0500
|
||||
Subject: [PATCH] nbft: added NBFT v1.0 table support
|
||||
|
||||
Added support for parsing the contents of the NBFT table (per NVMe-oF
|
||||
boot specification v1.0) with the connect-all and discover commands.
|
||||
|
||||
nvme discover/connect-all --nbft ignore /etc/nvme config and use NBFT tables
|
||||
nvme discover/connect-all --no-nbft ignore NBFT tables and use /etc/nvme config
|
||||
nvme discover/connect-all --nbft-path=<STR> user-defined path for NBFT tables
|
||||
|
||||
Signed-off-by: Stuart Hayes <stuart_hayes@dell.com>
|
||||
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
|
||||
|
||||
Use the new nbft public API.
|
||||
|
||||
Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: John Meneghini <jmeneghi@redhat.com>
|
||||
---
|
||||
Documentation/nvme-connect-all.txt | 25 ++++
|
||||
Documentation/nvme-discover.txt | 27 +++-
|
||||
fabrics.c | 17 +++
|
||||
meson.build | 1 +
|
||||
nbft.c | 202 +++++++++++++++++++++++++++++
|
||||
nbft.h | 19 +++
|
||||
6 files changed, 290 insertions(+), 1 deletion(-)
|
||||
create mode 100644 nbft.c
|
||||
create mode 100644 nbft.h
|
||||
|
||||
diff --git a/Documentation/nvme-connect-all.txt b/Documentation/nvme-connect-all.txt
|
||||
index 44bb4f94..cbb7ca6c 100644
|
||||
--- a/Documentation/nvme-connect-all.txt
|
||||
+++ b/Documentation/nvme-connect-all.txt
|
||||
@@ -35,6 +35,9 @@ SYNOPSIS
|
||||
[--tls ]
|
||||
[--quiet | -S]
|
||||
[--dump-config | -O]
|
||||
+ [--nbft]
|
||||
+ [--no-nbft]
|
||||
+ [--nbft-path=<STR>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -198,6 +201,16 @@ OPTIONS
|
||||
--dump-config::
|
||||
Print out resulting JSON configuration file to stdout.
|
||||
|
||||
+--nbft::
|
||||
+ Only look at NBFT tables
|
||||
+
|
||||
+--no-nbft::
|
||||
+ Do not look at NBFT tables
|
||||
+
|
||||
+--nbft-path=<STR>::
|
||||
+ Use a user-defined path to the NBFT tables
|
||||
+
|
||||
+
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
@@ -210,6 +223,18 @@ the RDMA network. Port 4420 is used by default:
|
||||
--hostnqn=host1-rogue-nqn
|
||||
------------
|
||||
+
|
||||
+* Issue a 'nvme connect-all' command using the default system defined NBFT tables:
|
||||
++
|
||||
+-----------
|
||||
+# nvme connect-all --nbft
|
||||
+------------
|
||||
++
|
||||
+* Issue a 'nvme connect-all' command with a user-defined path for the NBFT table:
|
||||
++
|
||||
+-----------
|
||||
+# nvme connet-all --nbft-path=/sys/firmware/acpi/tables/NBFT1
|
||||
+------------
|
||||
++
|
||||
* Issue a 'nvme connect-all' command using a @SYSCONFDIR@/nvme/discovery.conf file:
|
||||
+
|
||||
-----------
|
||||
diff --git a/Documentation/nvme-discover.txt b/Documentation/nvme-discover.txt
|
||||
index d4df75c2..b040c688 100644
|
||||
--- a/Documentation/nvme-discover.txt
|
||||
+++ b/Documentation/nvme-discover.txt
|
||||
@@ -37,6 +37,9 @@ SYNOPSIS
|
||||
[--dump-config | -O]
|
||||
[--output-format=<fmt> | -o <fmt>]
|
||||
[--force]
|
||||
+ [--nbft]
|
||||
+ [--no-nbft]
|
||||
+ [--nbft-path=<STR>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -68,7 +71,7 @@ Note that the base NVMe specification defines the NQN (NVMe Qualified
|
||||
Name) format which an NVMe endpoint (device, subsystem, etc) must
|
||||
follow to guarantee a unique name under the NVMe standard.
|
||||
In particular, the Host NQN uniquely identifies the NVMe Host, and
|
||||
-may be used by the the Discovery Controller to control what NVMe Target
|
||||
+may be used by the Discovery Controller to control what NVMe Target
|
||||
resources are allocated to the NVMe Host for a connection.
|
||||
|
||||
A Discovery Controller has it's own NQN defined in the NVMe-over-Fabrics
|
||||
@@ -229,6 +232,16 @@ OPTIONS
|
||||
Combined with --persistent flag, always create new
|
||||
persistent discovery connection.
|
||||
|
||||
+--nbft::
|
||||
+ Only look at NBFT tables
|
||||
+
|
||||
+--no-nbft::
|
||||
+ Do not look at NBFT tables
|
||||
+
|
||||
+--nbft-path=<STR>::
|
||||
+ Use a user-defined path to the NBFT tables
|
||||
+
|
||||
+
|
||||
EXAMPLES
|
||||
--------
|
||||
* Query the Discover Controller with IP4 address 192.168.1.3 for all
|
||||
@@ -240,6 +253,18 @@ Port 4420 is used by default:
|
||||
--hostnqn=host1-rogue-nqn
|
||||
------------
|
||||
+
|
||||
+* Issue a 'nvme discover' command using the default system defined NBFT tables:
|
||||
++
|
||||
+-----------
|
||||
+# nvme discover --nbft
|
||||
+------------
|
||||
++
|
||||
+* Issue a 'nvme discover' command with a user-defined path for the NBFT table:
|
||||
++
|
||||
+-----------
|
||||
+# nvme discover --nbft-path=/sys/firmware/acpi/tables/NBFT1
|
||||
+------------
|
||||
++
|
||||
* Issue a 'nvme discover' command using a @SYSCONFDIR@/nvme/discovery.conf file:
|
||||
+
|
||||
-----------
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 80827b16..0edbd299 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "nvme.h"
|
||||
+#include "nbft.h"
|
||||
#include "libnvme.h"
|
||||
#include "nvme-print.h"
|
||||
#include "nvme-print-json.h"
|
||||
@@ -710,6 +711,7 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
{
|
||||
char *subsysnqn = NVME_DISC_SUBSYS_NAME;
|
||||
char *hostnqn = NULL, *hostid = NULL, *hostkey = NULL;
|
||||
+ char *hostnqn_arg, *hostid_arg;
|
||||
char *transport = NULL, *traddr = NULL, *trsvcid = NULL;
|
||||
char *config_file = PATH_NVMF_CONFIG;
|
||||
char *hnqn = NULL, *hid = NULL;
|
||||
@@ -724,6 +726,8 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
char *device = NULL;
|
||||
bool force = false;
|
||||
bool json_config = false;
|
||||
+ bool nbft = false, nonbft = false;
|
||||
+ char *nbft_path = NBFT_SYSFS_PATH;
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
OPT_STRING("device", 'd', "DEV", &device, "use existing discovery controller device"),
|
||||
@@ -736,6 +740,9 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
OPT_INCR("verbose", 'v', &verbose, "Increase logging verbosity"),
|
||||
OPT_FLAG("dump-config", 'O', &dump_config, "Dump configuration file to stdout"),
|
||||
OPT_FLAG("force", 0, &force, "Force persistent discovery controller creation"),
|
||||
+ OPT_FLAG("nbft", 0, &nbft, "Only look at NBFT tables"),
|
||||
+ OPT_FLAG("no-nbft", 0, &nonbft, "Do not look at NBFT tables"),
|
||||
+ OPT_STRING("nbft-path", 0, "STR", &nbft_path, "user-defined path for NBFT tables"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
@@ -768,6 +775,8 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
if (!nvme_read_config(r, config_file))
|
||||
json_config = true;
|
||||
|
||||
+ hostnqn_arg = hostnqn;
|
||||
+ hostid_arg = hostid;
|
||||
if (!hostnqn)
|
||||
hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
if (!hostnqn)
|
||||
@@ -789,6 +798,14 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
nvme_host_set_dhchap_key(h, hostkey);
|
||||
|
||||
if (!device && !transport && !traddr) {
|
||||
+ if (!nonbft)
|
||||
+ discover_from_nbft(r, hostnqn_arg, hostid_arg,
|
||||
+ hostnqn, hostid, desc, connect,
|
||||
+ &cfg, nbft_path, flags, verbose);
|
||||
+
|
||||
+ if (nbft)
|
||||
+ goto out_free;
|
||||
+
|
||||
if (json_config)
|
||||
ret = discover_from_json_config_file(r, h, desc,
|
||||
connect, &cfg,
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 43ce5f9b..7ec357a9 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -240,6 +240,7 @@ incdir = include_directories(['ccan'])
|
||||
|
||||
################################################################################
|
||||
sources = [
|
||||
+ 'nbft.c',
|
||||
'fabrics.c',
|
||||
'nvme.c',
|
||||
'nvme-models.c',
|
||||
diff --git a/nbft.c b/nbft.c
|
||||
new file mode 100644
|
||||
index 00000000..14347287
|
||||
--- /dev/null
|
||||
+++ b/nbft.c
|
||||
@@ -0,0 +1,202 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+#include <fnmatch.h>
|
||||
+
|
||||
+#include "nvme.h"
|
||||
+#include "nbft.h"
|
||||
+#include "libnvme.h"
|
||||
+#include "fabrics.h"
|
||||
+
|
||||
+#define NBFT_SYSFS_FILENAME "NBFT*"
|
||||
+
|
||||
+static void print_connect_msg(nvme_ctrl_t c)
|
||||
+{
|
||||
+ printf("device: %s\n", nvme_ctrl_get_name(c));
|
||||
+}
|
||||
+
|
||||
+static void json_connect_msg(nvme_ctrl_t c)
|
||||
+{
|
||||
+ struct json_object *root;
|
||||
+
|
||||
+ root = json_create_object();
|
||||
+ json_object_add_value_string(root, "device", nvme_ctrl_get_name(c));
|
||||
+
|
||||
+ json_print_object(root, NULL);
|
||||
+ printf("\n");
|
||||
+ json_free_object(root);
|
||||
+}
|
||||
+
|
||||
+int nbft_filter(const struct dirent *dent)
|
||||
+{
|
||||
+ return !fnmatch(NBFT_SYSFS_FILENAME, dent->d_name, FNM_PATHNAME);
|
||||
+}
|
||||
+
|
||||
+int read_nbft_files(struct list_head *nbft_list, char *path)
|
||||
+{
|
||||
+ struct dirent **dent;
|
||||
+ char filename[PATH_MAX];
|
||||
+ int i, count, ret;
|
||||
+ struct nbft_file_entry *entry;
|
||||
+ struct nbft_info *nbft;
|
||||
+
|
||||
+ count = scandir(path, &dent, nbft_filter, NULL);
|
||||
+ if (count < 0) {
|
||||
+ fprintf(stderr, "Failed to open %s.\n", path);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ snprintf(filename, sizeof(filename), "%s/%s", path, dent[i]->d_name);
|
||||
+ ret = nvme_nbft_read(&nbft, filename);
|
||||
+ if (!ret) {
|
||||
+ entry = calloc(1, sizeof(*entry));
|
||||
+ entry->nbft = nbft;
|
||||
+ list_add_tail(nbft_list, &entry->node);
|
||||
+ }
|
||||
+ free(dent[i]);
|
||||
+ }
|
||||
+ free(dent);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void free_nbfts(struct list_head *nbft_list)
|
||||
+{
|
||||
+ struct nbft_file_entry *entry;
|
||||
+
|
||||
+ while ((entry = list_pop(nbft_list, struct nbft_file_entry, node))) {
|
||||
+ nvme_nbft_free(entry->nbft);
|
||||
+ free(entry);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg,
|
||||
+ char *hostnqn_sys, char *hostid_sys,
|
||||
+ const char *desc, bool connect,
|
||||
+ const struct nvme_fabrics_config *cfg, char *nbft_path,
|
||||
+ enum nvme_print_flags flags, bool verbose)
|
||||
+{
|
||||
+ char *hostnqn = NULL, *hostid = NULL, *host_traddr = NULL;
|
||||
+ nvme_host_t h;
|
||||
+ nvme_ctrl_t c;
|
||||
+ int ret, i;
|
||||
+ struct list_head nbft_list;
|
||||
+ struct nbft_file_entry *entry;
|
||||
+ struct nbft_info_subsystem_ns **ss;
|
||||
+ struct nbft_info_hfi *hfi;
|
||||
+
|
||||
+ if (!connect)
|
||||
+ /* to do: print discovery-type info from NBFT tables */
|
||||
+ return 0;
|
||||
+
|
||||
+ list_head_init(&nbft_list);
|
||||
+ ret = read_nbft_files(&nbft_list, nbft_path);
|
||||
+ if (ret)
|
||||
+ goto out_free_2;
|
||||
+
|
||||
+ list_for_each(&nbft_list, entry, node)
|
||||
+ for (ss = entry->nbft->subsystem_ns_list; ss && *ss; ss++)
|
||||
+ for (i = 0; i < (*ss)->num_hfis; i++) {
|
||||
+ nvme_ctrl_t cl;
|
||||
+
|
||||
+ hfi = (*ss)->hfis[i];
|
||||
+ if (hostnqn_arg)
|
||||
+ hostnqn = hostnqn_arg;
|
||||
+ else {
|
||||
+ hostnqn = entry->nbft->host.nqn;
|
||||
+ if (!hostnqn)
|
||||
+ hostnqn = hostnqn_sys;
|
||||
+ }
|
||||
+
|
||||
+ if (hostid_arg)
|
||||
+ hostid = hostid_arg;
|
||||
+ else if (*entry->nbft->host.id) {
|
||||
+ hostid = (char *)util_uuid_to_string(entry->nbft->host.id);
|
||||
+ if (!hostid)
|
||||
+ hostid = hostid_sys;
|
||||
+ }
|
||||
+
|
||||
+ h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
+ if (!h) {
|
||||
+ errno = ENOMEM;
|
||||
+ goto out_free;
|
||||
+ }
|
||||
+
|
||||
+ if (!cfg->host_traddr) {
|
||||
+ host_traddr = NULL;
|
||||
+ if (!strncmp((*ss)->transport, "tcp", 3))
|
||||
+ host_traddr = hfi->tcp_info.ipaddr;
|
||||
+ }
|
||||
+
|
||||
+ struct tr_config trcfg = {
|
||||
+ .subsysnqn = (*ss)->subsys_nqn,
|
||||
+ .transport = (*ss)->transport,
|
||||
+ .traddr = (*ss)->traddr,
|
||||
+ .host_traddr = host_traddr,
|
||||
+ .host_iface = NULL,
|
||||
+ .trsvcid = (*ss)->trsvcid,
|
||||
+ };
|
||||
+
|
||||
+ /* Already connected ? */
|
||||
+ cl = lookup_ctrl(r, &trcfg);
|
||||
+ if (cl && nvme_ctrl_get_name(cl))
|
||||
+ continue;
|
||||
+
|
||||
+ c = nvme_create_ctrl(r, (*ss)->subsys_nqn, (*ss)->transport,
|
||||
+ (*ss)->traddr, host_traddr, NULL,
|
||||
+ (*ss)->trsvcid);
|
||||
+ if (!c) {
|
||||
+ errno = ENOMEM;
|
||||
+ goto out_free;
|
||||
+ }
|
||||
+
|
||||
+ errno = 0;
|
||||
+ ret = nvmf_add_ctrl(h, c, cfg);
|
||||
+
|
||||
+ /*
|
||||
+ * With TCP/DHCP, it can happen that the OS
|
||||
+ * obtains a different local IP address than the
|
||||
+ * firmware had. Retry without host_traddr.
|
||||
+ */
|
||||
+ if (ret == -1 && errno == ENVME_CONNECT_WRITE &&
|
||||
+ !strcmp((*ss)->transport, "tcp") &&
|
||||
+ strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
|
||||
+ nvme_free_ctrl(c);
|
||||
+
|
||||
+ trcfg.host_traddr = NULL;
|
||||
+ cl = lookup_ctrl(r, &trcfg);
|
||||
+ if (cl && nvme_ctrl_get_name(cl))
|
||||
+ continue;
|
||||
+
|
||||
+ c = nvme_create_ctrl(r, (*ss)->subsys_nqn, (*ss)->transport,
|
||||
+ (*ss)->traddr,
|
||||
+ NULL, NULL, (*ss)->trsvcid);
|
||||
+ if (!c) {
|
||||
+ errno = ENOMEM;
|
||||
+ goto out_free;
|
||||
+ }
|
||||
+ errno = 0;
|
||||
+ ret = nvmf_add_ctrl(h, c, cfg);
|
||||
+ if (ret == 0 && verbose >= 1)
|
||||
+ fprintf(stderr,
|
||||
+ "connect with host_traddr=\"%s\" failed, success after omitting host_traddr\n",
|
||||
+ host_traddr);
|
||||
+ }
|
||||
+
|
||||
+ if (ret)
|
||||
+ fprintf(stderr, "no controller found\n");
|
||||
+ else {
|
||||
+ if (flags == NORMAL)
|
||||
+ print_connect_msg(c);
|
||||
+ else if (flags == JSON)
|
||||
+ json_connect_msg(c);
|
||||
+ }
|
||||
+out_free:
|
||||
+ if (errno == ENOMEM)
|
||||
+ goto out_free_2;
|
||||
+ }
|
||||
+out_free_2:
|
||||
+ free_nbfts(&nbft_list);
|
||||
+ return errno;
|
||||
+}
|
||||
diff --git a/nbft.h b/nbft.h
|
||||
new file mode 100644
|
||||
index 00000000..0e09733f
|
||||
--- /dev/null
|
||||
+++ b/nbft.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
+
|
||||
+#include <ccan/list/list.h>
|
||||
+
|
||||
+#define NBFT_SYSFS_PATH "/sys/firmware/acpi/tables"
|
||||
+
|
||||
+struct nbft_file_entry {
|
||||
+ struct list_node node;
|
||||
+ struct nbft_info *nbft;
|
||||
+};
|
||||
+
|
||||
+int read_nbft_files(struct list_head *nbft_list, char *path);
|
||||
+void free_nbfts(struct list_head *nbft_list);
|
||||
+
|
||||
+extern int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg,
|
||||
+ char *hostnqn_sys, char *hostid_sys,
|
||||
+ const char *desc, bool connect,
|
||||
+ const struct nvme_fabrics_config *cfg, char *nbft_path,
|
||||
+ enum nvme_print_flags flags, bool verbose);
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 821935cccfcad6b18da78d42f9ddf49f4cbe0b8e Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Wagner <dwagner@suse.de>
|
||||
Date: Thu, 9 Dec 2021 15:40:26 +0100
|
||||
Subject: [PATCH 2/6] bash: Fix nvme completion
|
||||
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
---
|
||||
completions/bash-nvme-completion.sh | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh
|
||||
index 41938d7..902da01 100644
|
||||
--- a/completions/bash-nvme-completion.sh
|
||||
+++ b/completions/bash-nvme-completion.sh
|
||||
@@ -101,8 +101,7 @@ _cmds="list list-subsys id-ctrl id-ns \
|
||||
connect disconnect disconnect-all gen-hostnqn \
|
||||
show-hostnqn dir-receive dir-send virt-mgmt \
|
||||
rpmb boot-part-log fid-support-effects-log \
|
||||
- supported-log-pages lockdown"
|
||||
- supported-log-pages list-endgrp"
|
||||
+ supported-log-pages lockdown list-endgrp"
|
||||
|
||||
# Add plugins:
|
||||
for plugin in "${!_plugin_subcmds[@]}"; do
|
||||
@@ -1368,7 +1367,7 @@ plugin_ymtc_opts () {
|
||||
opts+=" --namespace-id= -n --raw-binary -b"
|
||||
;;
|
||||
"help")
|
||||
- opts+=NO_OPTS
|
||||
+ opts+=$NO_OPTS
|
||||
;;
|
||||
esac
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,640 @@
|
||||
From 23daeedc53be9b5225cc6806434888c0a7a8e9bf Mon Sep 17 00:00:00 2001
|
||||
From: Stuart Hayes <stuart_hayes@dell.com>
|
||||
Date: Fri, 14 Apr 2023 22:01:07 -0400
|
||||
Subject: [PATCH] nbft: add the nbft show plugin
|
||||
|
||||
Display contents of the ACPI NBFT files.
|
||||
|
||||
Usage: nvme nbft show <device> [OPTIONS]
|
||||
|
||||
Options:
|
||||
[ --output-format=<FMT>, -o <FMT> ] --- Output format: normal|json
|
||||
[ --subsystem, -s ] --- show NBFT subsystems
|
||||
[ --hfi, -H ] --- show NBFT HFIs
|
||||
[ --discovery, -d ] --- show NBFT discovery controllers
|
||||
[ --nbft-path=<STR> ] --- user-defined path for NBFT tables
|
||||
|
||||
Signed-off-by: Stuart Hayes <stuart_hayes@dell.com>
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: John Meneghini <jmeneghi@redhat.com>
|
||||
---
|
||||
plugins/meson.build | 1 +
|
||||
plugins/nbft/nbft-plugin.c | 568 +++++++++++++++++++++++++++++++++++++
|
||||
plugins/nbft/nbft-plugin.h | 18 ++
|
||||
3 files changed, 587 insertions(+)
|
||||
create mode 100644 plugins/nbft/nbft-plugin.c
|
||||
create mode 100644 plugins/nbft/nbft-plugin.h
|
||||
|
||||
diff --git a/plugins/meson.build b/plugins/meson.build
|
||||
index 2cf2486f..38b7cded 100644
|
||||
--- a/plugins/meson.build
|
||||
+++ b/plugins/meson.build
|
||||
@@ -12,6 +12,7 @@ if json_c_dep.found()
|
||||
'plugins/intel/intel-nvme.c',
|
||||
'plugins/memblaze/memblaze-nvme.c',
|
||||
'plugins/micron/micron-nvme.c',
|
||||
+ 'plugins/nbft/nbft-plugin.c',
|
||||
'plugins/netapp/netapp-nvme.c',
|
||||
'plugins/nvidia/nvidia-nvme.c',
|
||||
'plugins/scaleflux/sfx-nvme.c',
|
||||
diff --git a/plugins/nbft/nbft-plugin.c b/plugins/nbft/nbft-plugin.c
|
||||
new file mode 100644
|
||||
index 00000000..6ae2525a
|
||||
--- /dev/null
|
||||
+++ b/plugins/nbft/nbft-plugin.c
|
||||
@@ -0,0 +1,568 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+#include <fnmatch.h>
|
||||
+
|
||||
+#include "nvme-print.h"
|
||||
+#include "nvme.h"
|
||||
+#include "nbft.h"
|
||||
+#include "libnvme.h"
|
||||
+#include "fabrics.h"
|
||||
+
|
||||
+#define CREATE_CMD
|
||||
+#include "nbft-plugin.h"
|
||||
+
|
||||
+static const char dash[100] = {[0 ... 98] = '-', [99] = '\0'};
|
||||
+
|
||||
+#define PCI_SEGMENT(sbdf) ((sbdf & 0xffff0000) >> 16)
|
||||
+#define PCI_BUS(sbdf) ((sbdf & 0x0000ff00) >> 8)
|
||||
+#define PCI_DEV(sbdf) ((sbdf & 0x000000f8) >> 3)
|
||||
+#define PCI_FUNC(sbdf) ((sbdf & 0x00000007) >> 0)
|
||||
+
|
||||
+static const char *pci_sbdf_to_string(__u16 pci_sbdf)
|
||||
+{
|
||||
+ static char pcidev[13];
|
||||
+
|
||||
+ snprintf(pcidev, sizeof(pcidev), "%x:%x:%x.%x",
|
||||
+ PCI_SEGMENT(pci_sbdf),
|
||||
+ PCI_BUS(pci_sbdf),
|
||||
+ PCI_DEV(pci_sbdf),
|
||||
+ PCI_FUNC(pci_sbdf));
|
||||
+ return pcidev;
|
||||
+}
|
||||
+
|
||||
+static char *mac_addr_to_string(unsigned char mac_addr[6])
|
||||
+{
|
||||
+ static char mac_string[18];
|
||||
+
|
||||
+ snprintf(mac_string, sizeof(mac_string), "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
+ mac_addr[0],
|
||||
+ mac_addr[1],
|
||||
+ mac_addr[2],
|
||||
+ mac_addr[3],
|
||||
+ mac_addr[4],
|
||||
+ mac_addr[5]);
|
||||
+ return mac_string;
|
||||
+}
|
||||
+
|
||||
+static json_object *hfi_to_json(struct nbft_info_hfi *hfi)
|
||||
+{
|
||||
+ struct json_object *hfi_json;
|
||||
+
|
||||
+ hfi_json = json_create_object();
|
||||
+ if (!hfi_json)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (json_object_add_value_int(hfi_json, "index", hfi->index)
|
||||
+ || json_object_add_value_string(hfi_json, "transport", hfi->transport))
|
||||
+ goto fail;
|
||||
+
|
||||
+ if (strcmp(hfi->transport, "tcp") == 0) {
|
||||
+ if (json_object_add_value_string(hfi_json, "pcidev",
|
||||
+ pci_sbdf_to_string(hfi->tcp_info.pci_sbdf))
|
||||
+ || json_object_add_value_string(hfi_json, "mac_addr",
|
||||
+ mac_addr_to_string(hfi->tcp_info.mac_addr))
|
||||
+ || json_object_add_value_int(hfi_json, "vlan",
|
||||
+ hfi->tcp_info.vlan)
|
||||
+ || json_object_add_value_int(hfi_json, "ip_origin",
|
||||
+ hfi->tcp_info.ip_origin)
|
||||
+ || json_object_add_value_string(hfi_json, "ipaddr",
|
||||
+ hfi->tcp_info.ipaddr)
|
||||
+ || json_object_add_value_int(hfi_json, "subnet_mask_prefix",
|
||||
+ hfi->tcp_info.subnet_mask_prefix)
|
||||
+ || json_object_add_value_string(hfi_json, "gateway_ipaddr",
|
||||
+ hfi->tcp_info.gateway_ipaddr)
|
||||
+ || json_object_add_value_int(hfi_json, "route_metric",
|
||||
+ hfi->tcp_info.route_metric)
|
||||
+ || json_object_add_value_string(hfi_json, "primary_dns_ipaddr",
|
||||
+ hfi->tcp_info.primary_dns_ipaddr)
|
||||
+ || json_object_add_value_string(hfi_json, "secondary_dns_ipaddr",
|
||||
+ hfi->tcp_info.secondary_dns_ipaddr)
|
||||
+ || json_object_add_value_string(hfi_json, "dhcp_server_ipaddr",
|
||||
+ hfi->tcp_info.dhcp_server_ipaddr)
|
||||
+ || (hfi->tcp_info.host_name
|
||||
+ && json_object_add_value_string(hfi_json, "host_name",
|
||||
+ hfi->tcp_info.host_name))
|
||||
+ || json_object_add_value_int(hfi_json, "this_hfi_is_default_route",
|
||||
+ hfi->tcp_info.this_hfi_is_default_route)
|
||||
+ || json_object_add_value_int(hfi_json, "dhcp_override",
|
||||
+ hfi->tcp_info.dhcp_override))
|
||||
+ goto fail;
|
||||
+ else
|
||||
+ return hfi_json;
|
||||
+ }
|
||||
+fail:
|
||||
+ json_free_object(hfi_json);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static json_object *ssns_to_json(struct nbft_info_subsystem_ns *ss)
|
||||
+{
|
||||
+ struct json_object *ss_json;
|
||||
+ struct json_object *hfi_array_json;
|
||||
+ char json_str[40];
|
||||
+ char *json_str_p;
|
||||
+ int i;
|
||||
+
|
||||
+ ss_json = json_create_object();
|
||||
+ if (!ss_json)
|
||||
+ return NULL;
|
||||
+
|
||||
+ hfi_array_json = json_create_array();
|
||||
+ if (!hfi_array_json)
|
||||
+ goto fail;
|
||||
+
|
||||
+ for (i = 0; i < ss->num_hfis; i++)
|
||||
+ if (json_array_add_value_object(hfi_array_json,
|
||||
+ json_object_new_int(ss->hfis[i]->index)))
|
||||
+ goto fail;
|
||||
+
|
||||
+ if (json_object_add_value_int(ss_json, "index", ss->index)
|
||||
+ || json_object_add_value_int(ss_json, "num_hfis", ss->num_hfis)
|
||||
+ || json_object_object_add(ss_json, "hfis", hfi_array_json)
|
||||
+ || json_object_add_value_string(ss_json, "transport", ss->transport)
|
||||
+ || json_object_add_value_string(ss_json, "traddr", ss->traddr)
|
||||
+ || json_object_add_value_string(ss_json, "trsvcid", ss->trsvcid)
|
||||
+ || json_object_add_value_int(ss_json, "subsys_port_id", ss->subsys_port_id)
|
||||
+ || json_object_add_value_int(ss_json, "nsid", ss->nsid))
|
||||
+ goto fail;
|
||||
+
|
||||
+ memset(json_str, 0, sizeof(json_str));
|
||||
+ json_str_p = json_str;
|
||||
+
|
||||
+ switch (ss->nid_type) {
|
||||
+ case NBFT_INFO_NID_TYPE_EUI64:
|
||||
+ if (json_object_add_value_string(ss_json, "nid_type", "eui64"))
|
||||
+ goto fail;
|
||||
+ for (i = 0; i < 8; i++)
|
||||
+ json_str_p += sprintf(json_str_p, "%02x", ss->nid[i]);
|
||||
+ break;
|
||||
+
|
||||
+ case NBFT_INFO_NID_TYPE_NGUID:
|
||||
+ if (json_object_add_value_string(ss_json, "nid_type", "nguid"))
|
||||
+ goto fail;
|
||||
+ for (i = 0; i < 16; i++)
|
||||
+ json_str_p += sprintf(json_str_p, "%02x", ss->nid[i]);
|
||||
+ break;
|
||||
+
|
||||
+ case NBFT_INFO_NID_TYPE_NS_UUID:
|
||||
+ if (json_object_add_value_string(ss_json, "nid_type", "uuid"))
|
||||
+ goto fail;
|
||||
+ nvme_uuid_to_string(ss->nid, json_str);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ if (json_object_add_value_string(ss_json, "nid", json_str))
|
||||
+ goto fail;
|
||||
+
|
||||
+ if ((ss->subsys_nqn
|
||||
+ && json_object_add_value_string(ss_json, "subsys_nqn", ss->subsys_nqn))
|
||||
+ || json_object_add_value_int(ss_json, "controller_id", ss->controller_id)
|
||||
+ || json_object_add_value_int(ss_json, "asqsz", ss->asqsz)
|
||||
+ || (ss->dhcp_root_path_string
|
||||
+ && json_object_add_value_string(ss_json, "dhcp_root_path_string",
|
||||
+ ss->dhcp_root_path_string))
|
||||
+ || json_object_add_value_int(ss_json, "pdu_header_digest_required",
|
||||
+ ss->pdu_header_digest_required)
|
||||
+ || json_object_add_value_int(ss_json, "data_digest_required",
|
||||
+ ss->data_digest_required))
|
||||
+ goto fail;
|
||||
+
|
||||
+ return ss_json;
|
||||
+fail:
|
||||
+ json_free_object(ss_json);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static json_object *discovery_to_json(struct nbft_info_discovery *disc)
|
||||
+{
|
||||
+ struct json_object *disc_json;
|
||||
+
|
||||
+ disc_json = json_create_object();
|
||||
+ if (!disc_json)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (json_object_add_value_int(disc_json, "index", disc->index)
|
||||
+ || (disc->security
|
||||
+ && json_object_add_value_int(disc_json, "security", disc->security->index))
|
||||
+ || (disc->hfi
|
||||
+ && json_object_add_value_int(disc_json, "hfi", disc->hfi->index))
|
||||
+ || (disc->uri
|
||||
+ && json_object_add_value_string(disc_json, "uri", disc->uri))
|
||||
+ || (disc->nqn
|
||||
+ && json_object_add_value_string(disc_json, "nqn", disc->nqn))) {
|
||||
+ json_free_object(disc_json);
|
||||
+ return NULL;
|
||||
+ } else
|
||||
+ return disc_json;
|
||||
+}
|
||||
+
|
||||
+static const char *primary_admin_host_flag_to_str(unsigned int primary)
|
||||
+{
|
||||
+ static const char * const str[] = {
|
||||
+ [NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_NOT_INDICATED] = "not indicated",
|
||||
+ [NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_UNSELECTED] = "unselected",
|
||||
+ [NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_SELECTED] = "selected",
|
||||
+ [NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_RESERVED] = "reserved",
|
||||
+ };
|
||||
+
|
||||
+ if (primary > NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_RESERVED)
|
||||
+ return "INVALID";
|
||||
+ return str[primary];
|
||||
+}
|
||||
+
|
||||
+static struct json_object *nbft_to_json(struct nbft_info *nbft, bool show_subsys,
|
||||
+ bool show_hfi, bool show_discovery)
|
||||
+{
|
||||
+ struct json_object *nbft_json, *host_json;
|
||||
+
|
||||
+ nbft_json = json_create_object();
|
||||
+ if (!nbft_json)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (json_object_add_value_string(nbft_json, "filename", nbft->filename))
|
||||
+ goto fail;
|
||||
+
|
||||
+ host_json = json_create_object();
|
||||
+ if (!host_json)
|
||||
+ goto fail;
|
||||
+ if ((nbft->host.nqn
|
||||
+ && json_object_add_value_string(host_json, "nqn", nbft->host.nqn))
|
||||
+ || (nbft->host.id
|
||||
+ && json_object_add_value_string(host_json, "id",
|
||||
+ util_uuid_to_string(nbft->host.id))))
|
||||
+ goto fail;
|
||||
+ json_object_add_value_int(host_json, "host_id_configured",
|
||||
+ nbft->host.host_id_configured);
|
||||
+ json_object_add_value_int(host_json, "host_nqn_configured",
|
||||
+ nbft->host.host_nqn_configured);
|
||||
+ json_object_add_value_string(host_json, "primary_admin_host_flag",
|
||||
+ primary_admin_host_flag_to_str(nbft->host.primary));
|
||||
+ if (json_object_object_add(nbft_json, "host", host_json)) {
|
||||
+ json_free_object(host_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (show_subsys) {
|
||||
+ struct json_object *subsys_array_json, *subsys_json;
|
||||
+ struct nbft_info_subsystem_ns **ss;
|
||||
+
|
||||
+ subsys_array_json = json_create_array();
|
||||
+ if (!subsys_array_json)
|
||||
+ goto fail;
|
||||
+ for (ss = nbft->subsystem_ns_list; ss && *ss; ss++) {
|
||||
+ subsys_json = ssns_to_json(*ss);
|
||||
+ if (!subsys_json)
|
||||
+ goto fail;
|
||||
+ if (json_object_array_add(subsys_array_json, subsys_json)) {
|
||||
+ json_free_object(subsys_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (json_object_object_add(nbft_json, "subsystem", subsys_array_json)) {
|
||||
+ json_free_object(subsys_array_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (show_hfi) {
|
||||
+ struct json_object *hfi_array_json, *hfi_json;
|
||||
+ struct nbft_info_hfi **hfi;
|
||||
+
|
||||
+ hfi_array_json = json_create_array();
|
||||
+ if (!hfi_array_json)
|
||||
+ goto fail;
|
||||
+ for (hfi = nbft->hfi_list; hfi && *hfi; hfi++) {
|
||||
+ hfi_json = hfi_to_json(*hfi);
|
||||
+ if (!hfi_json)
|
||||
+ goto fail;
|
||||
+ if (json_object_array_add(hfi_array_json, hfi_json)) {
|
||||
+ json_free_object(hfi_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (json_object_object_add(nbft_json, "hfi", hfi_array_json)) {
|
||||
+ json_free_object(hfi_array_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (show_discovery) {
|
||||
+ struct json_object *discovery_array_json, *discovery_json;
|
||||
+ struct nbft_info_discovery **disc;
|
||||
+
|
||||
+ discovery_array_json = json_create_array();
|
||||
+ if (!discovery_array_json)
|
||||
+ goto fail;
|
||||
+ for (disc = nbft->discovery_list; disc && *disc; disc++) {
|
||||
+ discovery_json = discovery_to_json(*disc);
|
||||
+ if (!discovery_json)
|
||||
+ goto fail;
|
||||
+ if (json_object_array_add(discovery_array_json, discovery_json)) {
|
||||
+ json_free_object(discovery_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (json_object_object_add(nbft_json, "discovery", discovery_array_json)) {
|
||||
+ json_free_object(discovery_array_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ return nbft_json;
|
||||
+fail:
|
||||
+ json_free_object(nbft_json);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int json_show_nbfts(struct list_head *nbft_list, bool show_subsys,
|
||||
+ bool show_hfi, bool show_discovery)
|
||||
+{
|
||||
+ struct json_object *nbft_json_array, *nbft_json;
|
||||
+ struct nbft_file_entry *entry;
|
||||
+
|
||||
+ nbft_json_array = json_create_array();
|
||||
+ if (!nbft_json_array)
|
||||
+ return ENOMEM;
|
||||
+
|
||||
+ list_for_each(nbft_list, entry, node) {
|
||||
+ nbft_json = nbft_to_json(entry->nbft, show_subsys, show_hfi, show_discovery);
|
||||
+ if (!nbft_json)
|
||||
+ goto fail;
|
||||
+ if (json_object_array_add(nbft_json_array, nbft_json)) {
|
||||
+ json_free_object(nbft_json);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ json_print_object(nbft_json_array, NULL);
|
||||
+ printf("\n");
|
||||
+ json_free_object(nbft_json_array);
|
||||
+ return 0;
|
||||
+fail:
|
||||
+ json_free_object(nbft_json_array);
|
||||
+ return ENOMEM;
|
||||
+}
|
||||
+
|
||||
+static void print_nbft_hfi_info(struct nbft_info *nbft)
|
||||
+{
|
||||
+ struct nbft_info_hfi **hfi;
|
||||
+ unsigned int ip_width = 8, gw_width = 8, dns_width = 8;
|
||||
+
|
||||
+ hfi = nbft->hfi_list;
|
||||
+ if (!hfi || !*hfi)
|
||||
+ return;
|
||||
+
|
||||
+ for (; *hfi; hfi++) {
|
||||
+ unsigned int len;
|
||||
+
|
||||
+ len = strlen((*hfi)->tcp_info.ipaddr);
|
||||
+ if (len > ip_width)
|
||||
+ ip_width = len;
|
||||
+ len = strlen((*hfi)->tcp_info.gateway_ipaddr);
|
||||
+ if (len > gw_width)
|
||||
+ gw_width = len;
|
||||
+ len = strlen((*hfi)->tcp_info.primary_dns_ipaddr);
|
||||
+ if (len > dns_width)
|
||||
+ dns_width = len;
|
||||
+ }
|
||||
+
|
||||
+ printf("\nNBFT HFIs:\n\n");
|
||||
+ printf("%-3.3s|%-4.4s|%-10.10s|%-17.17s|%-4.4s|%-*.*s|%-4.4s|%-*.*s|%-*.*s\n",
|
||||
+ "Idx", "Trsp", "PCI Addr", "MAC Addr", "DHCP",
|
||||
+ ip_width, ip_width, "IP Addr", "Mask",
|
||||
+ gw_width, gw_width, "Gateway", dns_width, dns_width, "DNS");
|
||||
+ printf("%-.3s+%-.4s+%-.10s+%-.17s+%-.4s+%-.*s+%-.4s+%-.*s+%-.*s\n",
|
||||
+ dash, dash, dash, dash, dash, ip_width, dash, dash,
|
||||
+ gw_width, dash, dns_width, dash);
|
||||
+ for (hfi = nbft->hfi_list; *hfi; hfi++)
|
||||
+ printf("%-3d|%-4.4s|%-10.10s|%-17.17s|%-4.4s|%-*.*s|%-4d|%-*.*s|%-*.*s\n",
|
||||
+ (*hfi)->index,
|
||||
+ (*hfi)->transport,
|
||||
+ pci_sbdf_to_string((*hfi)->tcp_info.pci_sbdf),
|
||||
+ mac_addr_to_string((*hfi)->tcp_info.mac_addr),
|
||||
+ (*hfi)->tcp_info.dhcp_override ? "yes" : "no",
|
||||
+ ip_width, ip_width, (*hfi)->tcp_info.ipaddr,
|
||||
+ (*hfi)->tcp_info.subnet_mask_prefix,
|
||||
+ gw_width, gw_width, (*hfi)->tcp_info.gateway_ipaddr,
|
||||
+ dns_width, dns_width, (*hfi)->tcp_info.primary_dns_ipaddr);
|
||||
+}
|
||||
+
|
||||
+static void print_nbft_discovery_info(struct nbft_info *nbft)
|
||||
+{
|
||||
+ struct nbft_info_discovery **disc;
|
||||
+ unsigned int nqn_width = 20, uri_width = 12;
|
||||
+
|
||||
+ disc = nbft->discovery_list;
|
||||
+ if (!disc || !*disc)
|
||||
+ return;
|
||||
+
|
||||
+ for (; *disc; disc++) {
|
||||
+ size_t len;
|
||||
+
|
||||
+ len = strlen((*disc)->uri);
|
||||
+ if (len > uri_width)
|
||||
+ uri_width = len;
|
||||
+ len = strlen((*disc)->nqn);
|
||||
+ if (len > nqn_width)
|
||||
+ nqn_width = len;
|
||||
+ }
|
||||
+
|
||||
+ printf("\nNBFT Discovery Controllers:\n\n");
|
||||
+ printf("%-3.3s|%-*.*s|%-*.*s\n", "Idx", uri_width, uri_width, "URI",
|
||||
+ nqn_width, nqn_width, "NQN");
|
||||
+ printf("%-.3s+%-.*s+%-.*s\n", dash, uri_width, dash, nqn_width, dash);
|
||||
+ for (disc = nbft->discovery_list; *disc; disc++)
|
||||
+ printf("%-3d|%-*.*s|%-*.*s\n", (*disc)->index,
|
||||
+ uri_width, uri_width, (*disc)->uri,
|
||||
+ nqn_width, nqn_width, (*disc)->nqn);
|
||||
+}
|
||||
+
|
||||
+#define HFIS_LEN 20
|
||||
+static size_t print_hfis(const struct nbft_info_subsystem_ns *ss, char buf[HFIS_LEN])
|
||||
+{
|
||||
+ char hfi_buf[HFIS_LEN];
|
||||
+ size_t len, ofs;
|
||||
+ int i;
|
||||
+
|
||||
+ len = snprintf(hfi_buf, sizeof(hfi_buf), "%d", ss->hfis[0]->index);
|
||||
+ for (i = 1; i < ss->num_hfis; i++) {
|
||||
+ ofs = len;
|
||||
+ len += snprintf(hfi_buf + ofs, sizeof(hfi_buf) - ofs, ",%d",
|
||||
+ ss->hfis[i]->index);
|
||||
+ /*
|
||||
+ * If the list doesn't fit in HFIS_LEN characters,
|
||||
+ * truncate and end with "..."
|
||||
+ */
|
||||
+ if (len >= sizeof(hfi_buf)) {
|
||||
+ while (ofs < sizeof(hfi_buf) - 1)
|
||||
+ hfi_buf[ofs++] = '.';
|
||||
+ hfi_buf[ofs] = '\0';
|
||||
+ len = sizeof(hfi_buf) - 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (buf)
|
||||
+ memcpy(buf, hfi_buf, len + 1);
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void print_nbft_subsys_info(struct nbft_info *nbft)
|
||||
+{
|
||||
+ struct nbft_info_subsystem_ns **ss;
|
||||
+ unsigned int nqn_width = 20, adr_width = 8, hfi_width = 4;
|
||||
+
|
||||
+ ss = nbft->subsystem_ns_list;
|
||||
+ if (!ss || !*ss)
|
||||
+ return;
|
||||
+ for (; *ss; ss++) {
|
||||
+ size_t len;
|
||||
+
|
||||
+ len = strlen((*ss)->subsys_nqn);
|
||||
+ if (len > nqn_width)
|
||||
+ nqn_width = len;
|
||||
+ len = strlen((*ss)->traddr);
|
||||
+ if (len > adr_width)
|
||||
+ adr_width = len;
|
||||
+ len = print_hfis(*ss, NULL);
|
||||
+ if (len > hfi_width)
|
||||
+ hfi_width = len;
|
||||
+ }
|
||||
+
|
||||
+ printf("\nNBFT Subsystems:\n\n");
|
||||
+ printf("%-3.3s|%-*.*s|%-4.4s|%-*.*s|%-5.5s|%-*.*s\n",
|
||||
+ "Idx", nqn_width, nqn_width, "NQN",
|
||||
+ "Trsp", adr_width, adr_width, "Address", "SvcId", hfi_width, hfi_width, "HFIs");
|
||||
+ printf("%-.3s+%-.*s+%-.4s+%-.*s+%-.5s+%-.*s\n",
|
||||
+ dash, nqn_width, dash, dash, adr_width, dash, dash, hfi_width, dash);
|
||||
+ for (ss = nbft->subsystem_ns_list; *ss; ss++) {
|
||||
+ char hfi_buf[HFIS_LEN];
|
||||
+
|
||||
+ print_hfis(*ss, hfi_buf);
|
||||
+ printf("%-3d|%-*.*s|%-4.4s|%-*.*s|%-5.5s|%-*.*s\n",
|
||||
+ (*ss)->index, nqn_width, nqn_width, (*ss)->subsys_nqn,
|
||||
+ (*ss)->transport, adr_width, adr_width, (*ss)->traddr,
|
||||
+ (*ss)->trsvcid, hfi_width, hfi_width, hfi_buf);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void normal_show_nbft(struct nbft_info *nbft, bool show_subsys,
|
||||
+ bool show_hfi, bool show_discovery)
|
||||
+{
|
||||
+ printf("%s:\n", nbft->filename);
|
||||
+ if ((!nbft->hfi_list || !*nbft->hfi_list) &&
|
||||
+ (!nbft->security_list || !*nbft->security_list) &&
|
||||
+ (!nbft->discovery_list || !*nbft->discovery_list) &&
|
||||
+ (!nbft->subsystem_ns_list || !*nbft->subsystem_ns_list))
|
||||
+ printf("(empty)\n");
|
||||
+ else {
|
||||
+ if (show_subsys)
|
||||
+ print_nbft_subsys_info(nbft);
|
||||
+ if (show_hfi)
|
||||
+ print_nbft_hfi_info(nbft);
|
||||
+ if (show_discovery)
|
||||
+ print_nbft_discovery_info(nbft);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void normal_show_nbfts(struct list_head *nbft_list, bool show_subsys,
|
||||
+ bool show_hfi, bool show_discovery)
|
||||
+{
|
||||
+ bool not_first = false;
|
||||
+ struct nbft_file_entry *entry;
|
||||
+
|
||||
+ list_for_each(nbft_list, entry, node) {
|
||||
+ if (not_first)
|
||||
+ printf("\n");
|
||||
+ normal_show_nbft(entry->nbft, show_subsys, show_hfi, show_discovery);
|
||||
+ not_first = true;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int show_nbft(int argc, char **argv, struct command *cmd, struct plugin *plugin)
|
||||
+{
|
||||
+ const char *desc = "Display contents of the ACPI NBFT files.";
|
||||
+ struct list_head nbft_list;
|
||||
+ char *format = "normal";
|
||||
+ char *nbft_path = NBFT_SYSFS_PATH;
|
||||
+ enum nvme_print_flags flags = -1;
|
||||
+ int ret;
|
||||
+ bool show_subsys = false, show_hfi = false, show_discovery = false;
|
||||
+
|
||||
+ OPT_ARGS(opts) = {
|
||||
+ OPT_FMT("output-format", 'o', &format, "Output format: normal|json"),
|
||||
+ OPT_FLAG("subsystem", 's', &show_subsys, "show NBFT subsystems"),
|
||||
+ OPT_FLAG("hfi", 'H', &show_hfi, "show NBFT HFIs"),
|
||||
+ OPT_FLAG("discovery", 'd', &show_discovery, "show NBFT discovery controllers"),
|
||||
+ OPT_STRING("nbft-path", 0, "STR", &nbft_path, "user-defined path for NBFT tables"),
|
||||
+ OPT_END()
|
||||
+ };
|
||||
+
|
||||
+ ret = argconfig_parse(argc, argv, desc, opts);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (!(show_subsys || show_hfi || show_discovery))
|
||||
+ show_subsys = show_hfi = show_discovery = true;
|
||||
+
|
||||
+ if (!strcmp(format, ""))
|
||||
+ flags = -1;
|
||||
+ else if (!strcmp(format, "normal"))
|
||||
+ flags = NORMAL;
|
||||
+ else if (!strcmp(format, "json"))
|
||||
+ flags = JSON;
|
||||
+ else
|
||||
+ return EINVAL;
|
||||
+
|
||||
+ list_head_init(&nbft_list);
|
||||
+ ret = read_nbft_files(&nbft_list, nbft_path);
|
||||
+ if (!ret) {
|
||||
+ if (flags == NORMAL)
|
||||
+ normal_show_nbfts(&nbft_list, show_subsys, show_hfi, show_discovery);
|
||||
+ else if (flags == JSON)
|
||||
+ ret = json_show_nbfts(&nbft_list, show_subsys, show_hfi, show_discovery);
|
||||
+ free_nbfts(&nbft_list);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/plugins/nbft/nbft-plugin.h b/plugins/nbft/nbft-plugin.h
|
||||
new file mode 100644
|
||||
index 00000000..018349d9
|
||||
--- /dev/null
|
||||
+++ b/plugins/nbft/nbft-plugin.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
+#undef CMD_INC_FILE
|
||||
+#define CMD_INC_FILE plugins/nbft/nbft-plugin
|
||||
+
|
||||
+#if !defined(NBFT) || defined(CMD_HEADER_MULTI_READ)
|
||||
+#define NBFT
|
||||
+
|
||||
+#include "cmd.h"
|
||||
+
|
||||
+PLUGIN(NAME("nbft", "ACPI NBFT table extensions", NVME_VERSION),
|
||||
+ COMMAND_LIST(
|
||||
+ ENTRY("show", "Show contents of ACPI NBFT tables", show_nbft)
|
||||
+ )
|
||||
+);
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+#include "define_cmd.h"
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,35 @@
|
||||
From e1afeffcbb78e252bbb0d21d2f4ed0fffeb59105 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Tue, 23 May 2023 15:08:40 +0200
|
||||
Subject: [PATCH] Revert "nvme: Masks SSTAT in sanize-log output"
|
||||
|
||||
The NVME_SANITIZE_SSTAT_STATUS_MASK is used to mask the
|
||||
3 least significant bits (representing the status of the most recent
|
||||
sanitize operation) of the SSTAT field.
|
||||
|
||||
The SSTAT field is 16 bits wide and contains other information too, such
|
||||
as the Global Data Erased bit and the number of completed passes.
|
||||
|
||||
Revert this commit so nvme-cli will print the entire SSTAT field
|
||||
|
||||
This reverts commit 7092ff55c5d9017231a68fa4dbb9a37b42d61d61.
|
||||
---
|
||||
nvme-print.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index c989435d..735ec193 100644
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -4423,7 +4423,7 @@ void nvme_show_sanitize_log(struct nvme_sanitize_log_page *sanitize,
|
||||
printf("\n");
|
||||
|
||||
printf("Sanitize Status (SSTAT) : %#x\n",
|
||||
- le16_to_cpu(sanitize->sstat) & NVME_SANITIZE_SSTAT_STATUS_MASK);
|
||||
+ le16_to_cpu(sanitize->sstat));
|
||||
if (human)
|
||||
nvme_show_sanitize_log_sstat(le16_to_cpu(sanitize->sstat));
|
||||
|
||||
--
|
||||
2.39.3
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 45223fd3c5a13da9209c4f44d7593cb42cab94fb Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Tue, 14 Dec 2021 10:09:42 +0100
|
||||
Subject: [PATCH 3/6] nvme: do not leak an open file handle
|
||||
|
||||
We performed a "sec_fd=open(cfg.file)" earlier, so we should not
|
||||
overwrite the handle.
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme.c | 9 +--------
|
||||
1 file changed, 1 insertion(+), 8 deletions(-)
|
||||
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index 862f9b6..5beeac7 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -4379,17 +4379,10 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p
|
||||
fprintf(stderr, "WARNING: --tl not dword aligned; unaligned bytes may be truncated\n");
|
||||
|
||||
if (strlen(cfg.file) == 0) {
|
||||
+ close(sec_fd);
|
||||
sec_fd = STDIN_FILENO;
|
||||
sec_size = cfg.tl;
|
||||
} else {
|
||||
- sec_fd = open(cfg.file, O_RDONLY);
|
||||
- if (sec_fd < 0) {
|
||||
- fprintf(stderr, "Failed to open %s: %s\n",
|
||||
- cfg.file, strerror(errno));
|
||||
- err = -EINVAL;
|
||||
- goto close_fd;
|
||||
- }
|
||||
-
|
||||
err = fstat(sec_fd, &sb);
|
||||
if (err < 0) {
|
||||
perror("fstat");
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,35 +0,0 @@
|
||||
From b580886dbc322b2a71d6c0c1b71f9fca7b750b02 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Tue, 14 Dec 2021 09:58:09 +0100
|
||||
Subject: [PATCH 4/6] nvme-topology: fix memory leaks in
|
||||
nvme_logical_block_size_from_ns_char()
|
||||
|
||||
Free the allocated strings before returning from the function
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-topology.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nvme-topology.c b/nvme-topology.c
|
||||
index 0a22f6b..6be2b09 100644
|
||||
--- a/nvme-topology.c
|
||||
+++ b/nvme-topology.c
|
||||
@@ -686,10 +686,13 @@ int nvme_logical_block_size_from_ns_char(const char *dev)
|
||||
return -EINVAL;
|
||||
|
||||
s = nvme_get_ctrl_attr(path, "logical_block_size");
|
||||
+ free(path);
|
||||
if (!s)
|
||||
return -EINVAL;
|
||||
|
||||
- return atoi(s);
|
||||
+ ret = atoi(s);
|
||||
+ free(s);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
void *mmap_registers(const char *dev)
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,118 @@
|
||||
From 94d6c2b5088292e101da3e1d078e155a5af32f56 Mon Sep 17 00:00:00 2001
|
||||
From: Tokunori Ikegami <ikegami.t@gmail.com>
|
||||
Date: Sun, 14 May 2023 17:39:00 +0900
|
||||
Subject: [PATCH] util: Fix suffix_si_parse to parse no decimal point but
|
||||
suffix value correctly
|
||||
|
||||
For example create-ns command --ncap-si paramter value 800G parsed to 0 as invalid value.
|
||||
|
||||
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
|
||||
---
|
||||
unit/test-suffix-si-parse.c | 6 +++++
|
||||
util/suffix.c | 50 +++++++++++++++++++++++++++----------
|
||||
2 files changed, 43 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/unit/test-suffix-si-parse.c b/unit/test-suffix-si-parse.c
|
||||
index bc924552..54cff0e6 100644
|
||||
--- a/unit/test-suffix-si-parse.c
|
||||
+++ b/unit/test-suffix-si-parse.c
|
||||
@@ -43,6 +43,12 @@ static struct tonum_test tonum_tests[] = {
|
||||
{ "2,33", 0, -EINVAL },
|
||||
{ "3..3", 0, -EINVAL },
|
||||
{ "123.12MM", 0, -EINVAL },
|
||||
+ { "800G", 800000000000, 0 },
|
||||
+ { "800GG", 0, -EINVAL },
|
||||
+ { "800G800", 0, -EINVAL },
|
||||
+ { "800.0G", 800000000000, 0 },
|
||||
+ { "800.G", 0, -EINVAL },
|
||||
+ { "800.", 0, -EINVAL },
|
||||
};
|
||||
|
||||
void tonum_test(struct tonum_test *test)
|
||||
diff --git a/util/suffix.c b/util/suffix.c
|
||||
index 8ed080d4..f010f3b6 100644
|
||||
--- a/util/suffix.c
|
||||
+++ b/util/suffix.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
static struct si_suffix {
|
||||
long double magnitude;
|
||||
@@ -68,11 +69,26 @@ const char *suffix_si_get(double *value)
|
||||
return suffix;
|
||||
}
|
||||
|
||||
+static bool suffix_si_check(const char val)
|
||||
+{
|
||||
+ int i;
|
||||
+ struct si_suffix *s;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(si_suffixes); i++) {
|
||||
+ s = &si_suffixes[i];
|
||||
+
|
||||
+ if (val == *s->suffix)
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
int suffix_si_parse(const char *str, char **endptr, uint64_t *val)
|
||||
{
|
||||
- unsigned long long num, frac;
|
||||
+ unsigned long long num, frac = 0;
|
||||
char *sep, *tmp;
|
||||
- int frac_len, len, i;
|
||||
+ int frac_len = 0, len, i;
|
||||
|
||||
num = strtoull(str, endptr, 0);
|
||||
if (str == *endptr ||
|
||||
@@ -93,23 +109,31 @@ int suffix_si_parse(const char *str, char **endptr, uint64_t *val)
|
||||
len = 0;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
+ if (suffix_si_check((*endptr)[i]))
|
||||
+ break;
|
||||
if (((*endptr)[i] == '\0') || (*endptr)[i] != sep[i])
|
||||
return -EINVAL;
|
||||
}
|
||||
- *endptr += len;
|
||||
- tmp = *endptr;
|
||||
|
||||
- /* extract the digits after decimal point */
|
||||
- frac = strtoull(tmp, endptr, 0);
|
||||
- if (tmp == *endptr ||
|
||||
- ((frac == ULLONG_MAX) && errno == ERANGE))
|
||||
- return -EINVAL;
|
||||
+ if (suffix_si_check((*endptr)[i])) {
|
||||
+ if ((*endptr)[i + 1] != '\0')
|
||||
+ return -EINVAL;
|
||||
+ } else {
|
||||
+ *endptr += len;
|
||||
+ tmp = *endptr;
|
||||
+
|
||||
+ /* extract the digits after decimal point */
|
||||
+ frac = strtoull(tmp, endptr, 0);
|
||||
+ if (tmp == *endptr ||
|
||||
+ ((frac == ULLONG_MAX) && errno == ERANGE))
|
||||
+ return -EINVAL;
|
||||
|
||||
- /* test that we have max one character as suffix */
|
||||
- if ((*endptr)[0] != '\0' && (*endptr)[1] != '\0')
|
||||
- return -EINVAL;
|
||||
+ /* test that we have max one character as suffix */
|
||||
+ if ((*endptr)[0] != '\0' && (*endptr)[1] != '\0')
|
||||
+ return -EINVAL;
|
||||
|
||||
- frac_len = *endptr - tmp;
|
||||
+ frac_len = *endptr - tmp;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(si_suffixes); i++) {
|
||||
struct si_suffix *s = &si_suffixes[i];
|
||||
--
|
||||
2.39.3
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 58c23ceb12d16756b2222a55d1d9dc5f34bb4fa4 Mon Sep 17 00:00:00 2001
|
||||
From: James Smart <jsmart2021@gmail.com>
|
||||
Date: Fri, 17 Dec 2021 11:32:32 -0800
|
||||
Subject: [PATCH 5/6] nvme-cli: nvmf-connect@.service: Remove matching from
|
||||
default syntax
|
||||
|
||||
commit 53aab69a0add added the "--matching" argument to the systemd
|
||||
connect script that issues connect-all to a discovery controller. When
|
||||
this argument is used, only discovery log entries whose target port
|
||||
traddr's match the traddr of the discovery controller will be connected
|
||||
to. This eliminates the ability to do referrals by the discovery
|
||||
controller.
|
||||
|
||||
Revert the commit so that the "--matching" argument is not default
|
||||
behavior.
|
||||
|
||||
Signed-off-by: James Smart <jsmart2021@gmail.com>
|
||||
CC: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
Link: https://lore.kernel.org/r/20211217193232.29034-1-jsmart2021@gmail.com
|
||||
---
|
||||
nvmf-autoconnect/systemd/nvmf-connect@.service | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nvmf-autoconnect/systemd/nvmf-connect@.service b/nvmf-autoconnect/systemd/nvmf-connect@.service
|
||||
index 5fbf081..c60f146 100644
|
||||
--- a/nvmf-autoconnect/systemd/nvmf-connect@.service
|
||||
+++ b/nvmf-autoconnect/systemd/nvmf-connect@.service
|
||||
@@ -11,4 +11,4 @@ Requires=nvmf-connect.target
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="CONNECT_ARGS=%i"
|
||||
-ExecStart=/bin/sh -c "nvme connect-all --matching --quiet `/bin/echo -e '${CONNECT_ARGS}'`"
|
||||
+ExecStart=/bin/sh -c "nvme connect-all --quiet `/bin/echo -e '${CONNECT_ARGS}'`"
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,86 +0,0 @@
|
||||
From 1264c6323937c4a0342174fdd9be5a66ab1eaf24 Mon Sep 17 00:00:00 2001
|
||||
From: James Smart <jsmart2021@gmail.com>
|
||||
Date: Fri, 17 Dec 2021 14:20:22 -0800
|
||||
Subject: [PATCH 6/6] nvme-cli: Make connect-all matching be case insensitive
|
||||
|
||||
The comparison routine that checks discovery controller traddr with a
|
||||
discovery log traddr uses a simple strncmp. For FC, which kicks off
|
||||
connect-all requests vay systemd, the nvme-fc transport will build
|
||||
traddr strings with lower case hexadecimal. Some FC discovery
|
||||
controllers return traddr strings with upper case hexadecimal. There
|
||||
was is no rqmt in the NVME-FC spec that it be upper or lower case.
|
||||
Given the case difference, the connect-all fails the match logic and
|
||||
doesn't connect to storage.
|
||||
|
||||
Revise the traddr comparison routine to duplicate the strings and
|
||||
convert them to lower case for comparison.
|
||||
|
||||
Signed-off-by: James Smart <jsmart2021@gmail.com>
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
Link: https://lore.kernel.org/r/20211217222022.30516-1-jsmart2021@gmail.com
|
||||
---
|
||||
fabrics.c | 26 +++++++++++++++++++++++++-
|
||||
1 file changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 0766729..a1e2593 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <stddef.h>
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
+#include <ctype.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
@@ -681,6 +682,12 @@ static int space_strip_len(int max, const char *str)
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
+static void strtolower(char *str)
|
||||
+{
|
||||
+ for ( ; *str; str++)
|
||||
+ *str = tolower(*str);
|
||||
+}
|
||||
+
|
||||
static void print_discovery_log(struct nvmf_disc_rsp_page_hdr *log, int numrec,
|
||||
int instance)
|
||||
{
|
||||
@@ -1385,7 +1392,9 @@ static bool cargs_match_found(struct nvmf_disc_rsp_page_entry *entry)
|
||||
|
||||
static bool should_connect(struct nvmf_disc_rsp_page_entry *entry)
|
||||
{
|
||||
+ char *dctrl_traddr, *log_traddr;
|
||||
int len;
|
||||
+ bool connect = true;
|
||||
|
||||
if (cargs_match_found(entry))
|
||||
return false;
|
||||
@@ -1398,7 +1407,22 @@ static bool should_connect(struct nvmf_disc_rsp_page_entry *entry)
|
||||
return true;
|
||||
|
||||
len = space_strip_len(NVMF_TRADDR_SIZE, entry->traddr);
|
||||
- return !strncmp(fabrics_cfg.traddr, entry->traddr, len);
|
||||
+
|
||||
+ dctrl_traddr = strdup(fabrics_cfg.traddr);
|
||||
+ log_traddr = strndup(entry->traddr, len);
|
||||
+ if (!dctrl_traddr || !log_traddr)
|
||||
+ goto free_exit;
|
||||
+
|
||||
+ strtolower(dctrl_traddr);
|
||||
+ strtolower(log_traddr);
|
||||
+
|
||||
+ connect = (strlen(dctrl_traddr) == len) &&
|
||||
+ !strcmp(dctrl_traddr, log_traddr);
|
||||
+
|
||||
+free_exit:
|
||||
+ free(log_traddr);
|
||||
+ free(dctrl_traddr);
|
||||
+ return connect;
|
||||
}
|
||||
|
||||
static int connect_ctrls(struct nvmf_disc_rsp_page_hdr *log, int numrec)
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,59 +0,0 @@
|
||||
From db50dbf5692325cfef8fb77e56e1e44af83a022e Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Wed, 29 Jun 2022 16:47:30 +0200
|
||||
Subject: [PATCH 1/7] nvme-cli: nvme gen-hostnqn use partition UUID on IBM
|
||||
POWER
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme.c | 27 +++++++++++++++++++++++++--
|
||||
1 file changed, 25 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index 5beeac78..0535ed2b 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -6516,6 +6516,26 @@ static int admin_passthru(int argc, char **argv, struct command *cmd, struct plu
|
||||
return passthru(argc, argv, NVME_IOCTL_ADMIN_CMD, 1, desc, cmd);
|
||||
}
|
||||
|
||||
+#define PATH_UUID_IBM "/proc/device-tree/ibm,partition-uuid"
|
||||
+
|
||||
+static int uuid_from_device_tree(char *system_uuid)
|
||||
+{
|
||||
+ ssize_t len;
|
||||
+ int f;
|
||||
+
|
||||
+ f = open(PATH_UUID_IBM, O_RDONLY);
|
||||
+ if (f < 0)
|
||||
+ return -ENXIO;
|
||||
+
|
||||
+ memset(system_uuid, 0, 37);
|
||||
+ len = read(f, system_uuid, 37 - 1);
|
||||
+ close(f);
|
||||
+ if (len < 0)
|
||||
+ return -ENXIO;
|
||||
+
|
||||
+ return strlen(system_uuid) ? 0 : -ENXIO;
|
||||
+}
|
||||
+
|
||||
static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struct plugin *plugin)
|
||||
{
|
||||
int ret;
|
||||
@@ -6525,8 +6545,11 @@ static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struc
|
||||
#endif
|
||||
|
||||
ret = uuid_from_dmi(uuid_str);
|
||||
- if (ret < 0)
|
||||
- ret = uuid_from_systemd(uuid_str);
|
||||
+ if (ret < 0) {
|
||||
+ ret = uuid_from_device_tree(uuid_str);
|
||||
+ if (ret < 0)
|
||||
+ ret = uuid_from_systemd(uuid_str);
|
||||
+ }
|
||||
#ifdef LIBUUID
|
||||
if (ret < 0) {
|
||||
uuid_generate_random(uuid);
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,41 +0,0 @@
|
||||
From f491884513bfba7bb007428e4664c2dfda21d424 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Wed, 29 Jun 2022 17:33:10 +0200
|
||||
Subject: [PATCH 2/7] Add new events support in PEL
|
||||
|
||||
Add two new events support in header file.
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
linux/nvme.h | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/linux/nvme.h b/linux/nvme.h
|
||||
index 7a925c7a..8b4c6833 100644
|
||||
--- a/linux/nvme.h
|
||||
+++ b/linux/nvme.h
|
||||
@@ -862,6 +862,12 @@ struct nvme_thermal_exc_event {
|
||||
__u8 threshold;
|
||||
};
|
||||
|
||||
+/* persistent event type 0Bh */
|
||||
+struct nvme_set_feature_event {
|
||||
+ __le32 layout;
|
||||
+ __le32 cdw_mem[0];
|
||||
+};
|
||||
+
|
||||
/* persistent event entry head */
|
||||
struct nvme_persistent_event_entry_head {
|
||||
__u8 etype;
|
||||
@@ -909,6 +915,8 @@ enum nvme_persistent_event_types {
|
||||
NVME_FORMAT_COMPLETION_EVENT = 0x08,
|
||||
NVME_SANITIZE_START_EVENT = 0x09,
|
||||
NVME_SANITIZE_COMPLETION_EVENT = 0x0a,
|
||||
+ NVME_SET_FEATURE_EVENT = 0x0b,
|
||||
+ NVME_TELEMETRY_CRT = 0x0c,
|
||||
NVME_THERMAL_EXCURSION_EVENT = 0x0d
|
||||
};
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,146 +0,0 @@
|
||||
From a0db61992c14b34fcf6787b957d5d5d0e77c6f33 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Wed, 29 Jun 2022 18:00:44 +0200
|
||||
Subject: [PATCH 3/7] nvme-cli: Decode "Supported Events Bitmap" in PEL header
|
||||
|
||||
"Supported Events Bitmap" in PEL header shows what events
|
||||
are supported in current nvme devices.
|
||||
|
||||
Persistent Event Log for device: nvme0n1
|
||||
Action for Persistent Event Log: 0
|
||||
..
|
||||
..
|
||||
..
|
||||
Supported Events Bitmap:
|
||||
Support SMART/Health Log Snapshot Event(0x1)
|
||||
Support Firmware Commit Event(0x2)
|
||||
Support Timestamp Change Event(0x3)
|
||||
Support Power-on or Reset Event(0x4)
|
||||
Support NVM Subsystem Hardware Error Event(0x5)
|
||||
Support Change Namespace Event(0x6)
|
||||
Support Format NVM Start Event(0x7)
|
||||
Support Format NVM Completion Event(0x8)
|
||||
Support Sanitize Start Event(0x9)
|
||||
Support Sanitize Completion Event(0xa)
|
||||
Support Set Feature Event(0xb)
|
||||
Support Set Telemetry CRT Event(0xc)
|
||||
Support Thermal Excursion Event(0xd)
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-print.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
nvme.c | 4 ++--
|
||||
2 files changed, 48 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index f631b347..21524a50 100755
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -1015,6 +1015,26 @@ void nvme_show_predictable_latency_event_agg_log(
|
||||
}
|
||||
}
|
||||
|
||||
+const char *nvme_pel_event_to_string(int type)
|
||||
+{
|
||||
+ switch (type) {
|
||||
+ case NVME_SMART_HEALTH_EVENT: return "SMART/Health Log Snapshot Event(0x1)";
|
||||
+ case NVME_FW_COMMIT_EVENT: return "Firmware Commit Event(0x2)";
|
||||
+ case NVME_TIMESTAMP_EVENT: return "Timestamp Change Event(0x3)";
|
||||
+ case NVME_POWER_ON_RESET_EVENT: return "Power-on or Reset Event(0x4)";
|
||||
+ case NVME_NSS_HW_ERROR_EVENT: return "NVM Subsystem Hardware Error Event(0x5)";
|
||||
+ case NVME_CHANGE_NS_EVENT: return "Change Namespace Event(0x6)";
|
||||
+ case NVME_FORMAT_START_EVENT: return "Format NVM Start Event(0x7)";
|
||||
+ case NVME_FORMAT_COMPLETION_EVENT: return "Format NVM Completion Event(0x8)";
|
||||
+ case NVME_SANITIZE_START_EVENT: return "Sanitize Start Event(0x9)";
|
||||
+ case NVME_SANITIZE_COMPLETION_EVENT: return "Sanitize Completion Event(0xa)";
|
||||
+ case NVME_SET_FEATURE_EVENT: return "Set Feature Event(0xb)";
|
||||
+ case NVME_TELEMETRY_CRT: return "Set Telemetry CRT Event(0xc)";
|
||||
+ case NVME_THERMAL_EXCURSION_EVENT: return "Thermal Excursion Event(0xd)";
|
||||
+ default: return NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static const char *nvme_show_nss_hw_error(__u16 error_code)
|
||||
{
|
||||
switch (error_code) {
|
||||
@@ -1043,6 +1063,29 @@ static const char *nvme_show_nss_hw_error(__u16 error_code)
|
||||
}
|
||||
}
|
||||
|
||||
+static void add_bitmap(int i, __u8 seb, struct json_object *root, int json_flag)
|
||||
+{
|
||||
+ char evt_str[50];
|
||||
+ char key[128];
|
||||
+
|
||||
+ for (int bit = 0; bit < 8; bit++) {
|
||||
+ if (nvme_pel_event_to_string(bit + i * 8)) {
|
||||
+ if (json_flag == 1) {
|
||||
+ sprintf(key, "bitmap_%x", (bit + i * 8));
|
||||
+ if ((seb >> bit) & 0x1)
|
||||
+ snprintf(evt_str, sizeof(evt_str), "Support %s",
|
||||
+ nvme_pel_event_to_string(bit + i * 8));
|
||||
+ json_object_add_value_string(root, key, evt_str);
|
||||
+ } else {
|
||||
+ if (nvme_pel_event_to_string(bit + i * 8))
|
||||
+ if ((seb >> bit) & 0x1)
|
||||
+ printf(" Support %s\n",
|
||||
+ nvme_pel_event_to_string(bit + i * 8));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void json_persistent_event_log(void *pevent_log_info, __u32 size)
|
||||
{
|
||||
struct json_object *root;
|
||||
@@ -1112,9 +1155,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (pevent_log_head->supp_event_bm[i] == 0)
|
||||
continue;
|
||||
- sprintf(key, "bitmap_%d", i);
|
||||
- json_object_add_value_uint(root, key,
|
||||
- pevent_log_head->supp_event_bm[i]);
|
||||
+ add_bitmap(i, pevent_log_head->supp_event_bm[i], root, 1);
|
||||
}
|
||||
} else {
|
||||
printf("No log data can be shown with this log len at least " \
|
||||
@@ -1440,12 +1481,11 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
le32_to_cpu(pevent_log_head->rci));
|
||||
if(human)
|
||||
nvme_show_persistent_event_log_rci(pevent_log_head->rci);
|
||||
- printf("Supported Events Bitmap: ");
|
||||
+ printf("Supported Events Bitmap: \n");
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (pevent_log_head->supp_event_bm[i] == 0)
|
||||
continue;
|
||||
- printf("BitMap[%d] is 0x%x\n", i,
|
||||
- pevent_log_head->supp_event_bm[i]);
|
||||
+ add_bitmap(i, pevent_log_head->supp_event_bm[i], NULL, 0);
|
||||
}
|
||||
} else {
|
||||
printf("No log data can be shown with this log len at least " \
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index 0535ed2b..44c53e6b 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -4808,7 +4808,7 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin
|
||||
|
||||
nc = argconfig_parse_comma_sep_array(cfg.ctx_attrs, ctx_attrs, ARRAY_SIZE(ctx_attrs));
|
||||
nb = argconfig_parse_comma_sep_array(cfg.blocks, nlbs, ARRAY_SIZE(nlbs));
|
||||
- ns = argconfig_parse_comma_sep_array_long(cfg.slbas, slbas, ARRAY_SIZE(slbas));
|
||||
+ ns = argconfig_parse_comma_sep_array_long(cfg.slbas, (long long unsigned int *)slbas, ARRAY_SIZE(slbas));
|
||||
nr = max(nc, max(nb, ns));
|
||||
if (!nr || nr > 256) {
|
||||
fprintf(stderr, "No range definition provided\n");
|
||||
@@ -4963,7 +4963,7 @@ static int copy(int argc, char **argv, struct command *cmd, struct plugin *plugi
|
||||
}
|
||||
}
|
||||
|
||||
- copy = nvme_setup_copy_range(nlbs, slbas, eilbrts, elbatms, elbats, nr);
|
||||
+ copy = nvme_setup_copy_range(nlbs, (__u64 *)slbas, eilbrts, elbatms, elbats, nr);
|
||||
if (!copy) {
|
||||
fprintf(stderr, "failed to allocate payload\n");
|
||||
errno = ENOMEM;
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,141 +0,0 @@
|
||||
From 6c916ee527e14bf4c4640ffeef8efdd891ba9ef4 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Thu, 30 Jun 2022 16:17:44 +0200
|
||||
Subject: [PATCH 4/7] nvme-cli: Adds event number in persistent event entries
|
||||
|
||||
Persistent Event Entries:
|
||||
Event Number: 0
|
||||
Event Type: SMART/Health Log Snapshot Event(0x1)
|
||||
Event Type Revision: 1
|
||||
Event Header Length: 21
|
||||
Controller Identifier: 66
|
||||
Event Timestamp: 44392
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-print.c | 30 ++++++++++++++++--------------
|
||||
1 file changed, 16 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index 21524a50..3b82b174 100755
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -1174,8 +1174,9 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
|
||||
break;
|
||||
valid_attrs = json_create_object();
|
||||
|
||||
- json_object_add_value_uint(valid_attrs, "event_type",
|
||||
- pevent_entry_head->etype);
|
||||
+ json_object_add_value_uint(valid_attrs, "event_number", i);
|
||||
+ json_object_add_value_string(valid_attrs, "event_type",
|
||||
+ nvme_pel_event_to_string(pevent_entry_head->etype));
|
||||
json_object_add_value_uint(valid_attrs, "event_type_rev",
|
||||
pevent_entry_head->etype_rev);
|
||||
json_object_add_value_uint(valid_attrs, "event_header_len",
|
||||
@@ -1505,7 +1506,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
le16_to_cpu(pevent_entry_head->el)) >= size)
|
||||
break;
|
||||
|
||||
- printf("Event Type: %u\n", pevent_entry_head->etype);
|
||||
+ printf("Event Number: %u\n", i);
|
||||
+ printf("Event Type: %s\n", nvme_pel_event_to_string(pevent_entry_head->etype));
|
||||
printf("Event Type Revision: %u\n", pevent_entry_head->etype_rev);
|
||||
printf("Event Header Length: %u\n", pevent_entry_head->ehl);
|
||||
printf("Controller Identifier: %u\n",
|
||||
@@ -1521,12 +1523,12 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
switch (pevent_entry_head->etype) {
|
||||
case NVME_SMART_HEALTH_EVENT:
|
||||
smart_event = pevent_log_info + offset;
|
||||
- printf("Smart Health Event: \n");
|
||||
+ printf("Smart Health Event Entry: \n");
|
||||
nvme_show_smart_log(smart_event, NVME_NSID_ALL, devname, flags);
|
||||
break;
|
||||
case NVME_FW_COMMIT_EVENT:
|
||||
fw_commit_event = pevent_log_info + offset;
|
||||
- printf("FW Commit Event: \n");
|
||||
+ printf("FW Commit Event Entry: \n");
|
||||
printf("Old Firmware Revision: %"PRIu64"\n",
|
||||
le64_to_cpu(fw_commit_event->old_fw_rev));
|
||||
printf("New Firmware Revision: %"PRIu64"\n",
|
||||
@@ -1543,7 +1545,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_TIMESTAMP_EVENT:
|
||||
ts_change_event = pevent_log_info + offset;
|
||||
- printf("Time Stamp Change Event: \n");
|
||||
+ printf("Time Stamp Change Event Entry: \n");
|
||||
printf("Previous Timestamp: %"PRIu64"\n",
|
||||
le64_to_cpu(ts_change_event->previous_timestamp));
|
||||
printf("Milliseconds Since Reset: %"PRIu64"\n",
|
||||
@@ -1555,7 +1557,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
|
||||
por_info_list = por_info_len / sizeof(*por_event);
|
||||
|
||||
- printf("Power On Reset Event: \n");
|
||||
+ printf("Power On Reset Event Entry: \n");
|
||||
fw_rev = pevent_log_info + offset;
|
||||
printf("Firmware Revision: %"PRIu64"\n", le64_to_cpu(*fw_rev));
|
||||
printf("Reset Information List: \n");
|
||||
@@ -1578,13 +1580,13 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_NSS_HW_ERROR_EVENT:
|
||||
nss_hw_err_event = pevent_log_info + offset;
|
||||
- printf("NVM Subsystem Hardware Error Event Code: %u, %s\n",
|
||||
+ printf("NVM Subsystem Hardware Error Event Code Entry: %u, %s\n",
|
||||
le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code),
|
||||
nvme_show_nss_hw_error(nss_hw_err_event->nss_hw_err_event_code));
|
||||
break;
|
||||
case NVME_CHANGE_NS_EVENT:
|
||||
ns_event = pevent_log_info + offset;
|
||||
- printf("Change Namespace Event: \n");
|
||||
+ printf("Change Namespace Event Entry: \n");
|
||||
printf("Namespace Management CDW10: %u\n",
|
||||
le32_to_cpu(ns_event->nsmgt_cdw10));
|
||||
printf("Namespace Size: %"PRIu64"\n",
|
||||
@@ -1603,7 +1605,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_FORMAT_START_EVENT:
|
||||
format_start_event = pevent_log_info + offset;
|
||||
- printf("Format NVM Start Event: \n");
|
||||
+ printf("Format NVM Start Event Entry: \n");
|
||||
printf("Namespace Identifier: %u\n",
|
||||
le32_to_cpu(format_start_event->nsid));
|
||||
printf("Format NVM Attributes: %u\n",
|
||||
@@ -1613,7 +1615,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_FORMAT_COMPLETION_EVENT:
|
||||
format_cmpln_event = pevent_log_info + offset;
|
||||
- printf("Format NVM Completion Event: \n");
|
||||
+ printf("Format NVM Completion Event Entry: \n");
|
||||
printf("Namespace Identifier: %u\n",
|
||||
le32_to_cpu(format_cmpln_event->nsid));
|
||||
printf("Smallest Format Progress Indicator: %u\n",
|
||||
@@ -1627,7 +1629,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_SANITIZE_START_EVENT:
|
||||
sanitize_start_event = pevent_log_info + offset;
|
||||
- printf("Sanitize Start Event: \n");
|
||||
+ printf("Sanitize Start Event Entry: \n");
|
||||
printf("SANICAP: %u\n", sanitize_start_event->sani_cap);
|
||||
printf("Sanitize CDW10: %u\n",
|
||||
le32_to_cpu(sanitize_start_event->sani_cdw10));
|
||||
@@ -1636,7 +1638,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_SANITIZE_COMPLETION_EVENT:
|
||||
sanitize_cmpln_event = pevent_log_info + offset;
|
||||
- printf("Sanitize Completion Event: \n");
|
||||
+ printf("Sanitize Completion Event Entry: \n");
|
||||
printf("Sanitize Progress: %u\n",
|
||||
le16_to_cpu(sanitize_cmpln_event->sani_prog));
|
||||
printf("Sanitize Status: %u\n",
|
||||
@@ -1646,7 +1648,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
break;
|
||||
case NVME_THERMAL_EXCURSION_EVENT:
|
||||
thermal_exc_event = pevent_log_info + offset;
|
||||
- printf("Thermal Excursion Event: \n");
|
||||
+ printf("Thermal Excursion Event Entry: \n");
|
||||
printf("Over Temperature: %u\n", thermal_exc_event->over_temp);
|
||||
printf("Threshold: %u\n", thermal_exc_event->threshold);
|
||||
break;
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,113 +0,0 @@
|
||||
From 7e858ab53eb23083205d75f590ca2c2b256c2a7b Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Thu, 30 Jun 2022 16:37:40 +0200
|
||||
Subject: [PATCH 5/7] nvme-cli: Adds readable firmware level in persistent
|
||||
|
||||
For example, In Firmware Commit Event:
|
||||
|
||||
Old Firmware Revision: 3617604718875264338
|
||||
New Firmware Revision: 3833777500989048146
|
||||
|
||||
changes to
|
||||
Old Firmware Revision: 3617604718875264338 (REV.SP42)
|
||||
New Firmware Revision: 3833777500989048146 (REV.SP45)
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-print.c | 43 ++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 28 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index 3b82b174..74ecd95a 100755
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -104,12 +104,15 @@ const char *nvme_cmd_to_string(int admin, __u8 opcode)
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
-static char *fw_to_string(__u8 fw[])
|
||||
+static const char *fw_to_string(char *c)
|
||||
{
|
||||
- static char frs[9];
|
||||
+ static char ret[9];
|
||||
+ int i;
|
||||
|
||||
- snprintf(frs, sizeof(frs), "%-.*s", 8, fw);
|
||||
- return frs;
|
||||
+ for (i = 0; i < 8; i++)
|
||||
+ ret[i] = c[i] >= '!' && c[i] <= '~' ? c[i] : '.';
|
||||
+ ret[i] = '\0';
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static const char *get_sanitize_log_sstat_status_str(__u16 status)
|
||||
@@ -1094,6 +1097,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
|
||||
__u32 offset, por_info_len, por_info_list;
|
||||
__u64 *fw_rev;
|
||||
char key[128];
|
||||
+ char fw_str[50];
|
||||
struct nvme_smart_log *smart_event;
|
||||
struct nvme_fw_commit_event *fw_commit_event;
|
||||
struct nvme_time_stamp_change_event *ts_change_event;
|
||||
@@ -1266,10 +1270,14 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
|
||||
break;
|
||||
case NVME_FW_COMMIT_EVENT:
|
||||
fw_commit_event = pevent_log_info + offset;
|
||||
- json_object_add_value_uint(valid_attrs, "old_fw_rev",
|
||||
- le64_to_cpu(fw_commit_event->old_fw_rev));
|
||||
- json_object_add_value_uint(valid_attrs, "new_fw_rev",
|
||||
- le64_to_cpu(fw_commit_event->new_fw_rev));
|
||||
+ snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)",
|
||||
+ le64_to_cpu(fw_commit_event->old_fw_rev),
|
||||
+ fw_to_string((char *)&fw_commit_event->old_fw_rev));
|
||||
+ json_object_add_value_string(valid_attrs, "old_fw_rev", fw_str);
|
||||
+ snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)",
|
||||
+ le64_to_cpu(fw_commit_event->new_fw_rev),
|
||||
+ fw_to_string((char *)&fw_commit_event->new_fw_rev));
|
||||
+ json_object_add_value_string(valid_attrs, "new_fw_rev", fw_str);
|
||||
json_object_add_value_uint(valid_attrs, "fw_commit_action",
|
||||
fw_commit_event->fw_commit_action);
|
||||
json_object_add_value_uint(valid_attrs, "fw_slot",
|
||||
@@ -1297,8 +1305,10 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
|
||||
por_info_list = por_info_len / sizeof(*por_event);
|
||||
|
||||
fw_rev = pevent_log_info + offset;
|
||||
- json_object_add_value_uint(valid_attrs, "fw_rev",
|
||||
- le64_to_cpu(*fw_rev));
|
||||
+ snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)",
|
||||
+ le64_to_cpu(*fw_rev),
|
||||
+ fw_to_string((char *)fw_rev));
|
||||
+ json_object_add_value_string(valid_attrs, "fw_rev", fw_str);
|
||||
for (int i = 0; i < por_info_list; i++) {
|
||||
por_event = pevent_log_info + offset +
|
||||
sizeof(*fw_rev) + i * sizeof(*por_event);
|
||||
@@ -1529,10 +1539,12 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
case NVME_FW_COMMIT_EVENT:
|
||||
fw_commit_event = pevent_log_info + offset;
|
||||
printf("FW Commit Event Entry: \n");
|
||||
- printf("Old Firmware Revision: %"PRIu64"\n",
|
||||
- le64_to_cpu(fw_commit_event->old_fw_rev));
|
||||
- printf("New Firmware Revision: %"PRIu64"\n",
|
||||
- le64_to_cpu(fw_commit_event->new_fw_rev));
|
||||
+ printf("Old Firmware Revision: %"PRIu64" (%s)\n",
|
||||
+ le64_to_cpu(fw_commit_event->old_fw_rev),
|
||||
+ fw_to_string((char *)&fw_commit_event->old_fw_rev));
|
||||
+ printf("New Firmware Revision: %"PRIu64" (%s)\n",
|
||||
+ le64_to_cpu(fw_commit_event->new_fw_rev),
|
||||
+ fw_to_string((char *)&fw_commit_event->new_fw_rev));
|
||||
printf("FW Commit Action: %u\n",
|
||||
fw_commit_event->fw_commit_action);
|
||||
printf("FW Slot: %u\n", fw_commit_event->fw_slot);
|
||||
@@ -1559,7 +1571,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
|
||||
printf("Power On Reset Event Entry: \n");
|
||||
fw_rev = pevent_log_info + offset;
|
||||
- printf("Firmware Revision: %"PRIu64"\n", le64_to_cpu(*fw_rev));
|
||||
+ printf("Firmware Revision: %"PRIu64" (%s)\n", le64_to_cpu(*fw_rev),
|
||||
+ fw_to_string((char *)fw_rev));
|
||||
printf("Reset Information List: \n");
|
||||
|
||||
for (int i = 0; i < por_info_list; i++) {
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 859b8ee99a725bdcfbb7c8352c50449d126cffc4 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Thu, 30 Jun 2022 16:41:59 +0200
|
||||
Subject: [PATCH 6/7] nvme-cli: Add support set feature event in PEL
|
||||
|
||||
Add "Set Feature" event in PEL.
|
||||
|
||||
Persistent Event Entries:
|
||||
Event Number: 0
|
||||
Event Type: Set Feature Event(0xb)
|
||||
Event Type Revision: 1
|
||||
Event Header Length: 21
|
||||
Controller Identifier: 65
|
||||
Event Timestamp: 564587204146155
|
||||
Vendor Specific Information Length: 0
|
||||
Event Length: 16
|
||||
Set Feature Event Entry:
|
||||
Set Feature ID :0x7 (Number of Queues), value:0x270027
|
||||
Number of IO Completion Queues Allocated (NCQA): 40
|
||||
Number of IO Submission Queues Allocated (NSQA): 40
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-print.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index 74ecd95a..37011dbe 100755
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -1436,6 +1436,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
{
|
||||
__u32 offset, por_info_len, por_info_list;
|
||||
__u64 *fw_rev;
|
||||
+ int fid, cdw11, dword_cnt;
|
||||
+ unsigned char *mem_buf = NULL;
|
||||
struct nvme_smart_log *smart_event;
|
||||
struct nvme_fw_commit_event *fw_commit_event;
|
||||
struct nvme_time_stamp_change_event *ts_change_event;
|
||||
@@ -1446,6 +1448,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
struct nvme_format_nvm_compln_event *format_cmpln_event;
|
||||
struct nvme_sanitize_start_event *sanitize_start_event;
|
||||
struct nvme_sanitize_compln_event *sanitize_cmpln_event;
|
||||
+ struct nvme_set_feature_event *set_feat_event;
|
||||
struct nvme_thermal_exc_event *thermal_exc_event;
|
||||
struct nvme_persistent_event_log_head *pevent_log_head;
|
||||
struct nvme_persistent_event_entry_head *pevent_entry_head;
|
||||
@@ -1659,6 +1662,18 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
printf("Completion Information: %u\n",
|
||||
le16_to_cpu(sanitize_cmpln_event->cmpln_info));
|
||||
break;
|
||||
+ case NVME_SET_FEATURE_EVENT:
|
||||
+ set_feat_event = pevent_log_info + offset;
|
||||
+ printf("Set Feature Event Entry: \n");
|
||||
+ dword_cnt = set_feat_event->layout & 0x03;
|
||||
+ fid = le32_to_cpu(set_feat_event->cdw_mem[0]) & 0x000f;
|
||||
+ cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]);
|
||||
+ if (((set_feat_event->layout & 0xff) >> 2) != 0)
|
||||
+ mem_buf = (unsigned char *)(set_feat_event + 4 + dword_cnt * 4);
|
||||
+ printf("Set Feature ID :%#02x (%s), value:%#08x\n", fid,
|
||||
+ nvme_feature_to_string(fid), cdw11);
|
||||
+ nvme_feature_show_fields(fid, cdw11, mem_buf);
|
||||
+ break;
|
||||
case NVME_THERMAL_EXCURSION_EVENT:
|
||||
thermal_exc_event = pevent_log_info + offset;
|
||||
printf("Thermal Excursion Event Entry: \n");
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 44b23d2daf246db0ac09a4a79a9a5161843a4936 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Thu, 30 Jun 2022 16:44:07 +0200
|
||||
Subject: [PATCH 7/7] nvme-cli: Add support Telemetry CRT in PEL
|
||||
|
||||
Add "Telemetry CRT" event in PEL.
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-print.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index 37011dbe..992b9b83 100755
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -1674,6 +1674,9 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
|
||||
nvme_feature_to_string(fid), cdw11);
|
||||
nvme_feature_show_fields(fid, cdw11, mem_buf);
|
||||
break;
|
||||
+ case NVME_TELEMETRY_CRT:
|
||||
+ d(pevent_log_info + offset, 512, 16, 1);
|
||||
+ break;
|
||||
case NVME_THERMAL_EXCURSION_EVENT:
|
||||
thermal_exc_event = pevent_log_info + offset;
|
||||
printf("Thermal Excursion Event Entry: \n");
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From b3db6509e1f70bdde9205ab97bd87fbb94a49f0a Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Fri, 15 Jul 2022 11:10:59 +0200
|
||||
Subject: [PATCH] fix firmware log page frs variable sign
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
linux/nvme.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux/nvme.h b/linux/nvme.h
|
||||
index 8b4c6833..2c402688 100644
|
||||
--- a/linux/nvme.h
|
||||
+++ b/linux/nvme.h
|
||||
@@ -1539,7 +1539,7 @@ struct nvme_error_log_page {
|
||||
struct nvme_firmware_log_page {
|
||||
__u8 afi;
|
||||
__u8 resv[7];
|
||||
- __u8 frs[7][8];
|
||||
+ char frs[7][8];
|
||||
__u8 resv2[448];
|
||||
};
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,19 +0,0 @@
|
||||
From f9b6c2100db88e9f317f15f17faaed59b725ac9b Mon Sep 17 00:00:00 2001
|
||||
From: Keith Busch <kbusch@kernel.org>
|
||||
Date: Tue, 24 Aug 2021 11:49:16 -0700
|
||||
Subject: [PATCH] fix file permissions (nvme-print.c)
|
||||
|
||||
It's not executable.
|
||||
|
||||
Signed-off-by: Keith Busch <kbusch@kernel.org>
|
||||
---
|
||||
nvme-print.c | 0
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
mode change 100755 => 100644 nvme-print.c
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,65 +0,0 @@
|
||||
From ad9f35c0bf8a71c6a4b7586d7553b8e9d171f48e Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Wagner <dwagner@suse.de>
|
||||
Date: Tue, 7 Mar 2023 10:24:01 +0100
|
||||
Subject: [PATCH] fabrics: Fix ordering for auto connect services
|
||||
|
||||
In order to be able to mount file systems via /etc/fstab we have to
|
||||
make sure that the corresponding auto connect services have been
|
||||
executed. Because the mounting of the local filesystem happens very
|
||||
early in the boot we have to carefully sort these service file into the
|
||||
boot process.
|
||||
|
||||
First, we have to disable the DefaultDependency as this will
|
||||
automatically add dependency on sysinit.target which is too late (after
|
||||
local mounts). Though without the default dependency we have to provide
|
||||
a Before and After conditions.
|
||||
|
||||
The Before is simple as we have a local-fs-pre target. The After
|
||||
is a bit tricky as there are no targets available.
|
||||
|
||||
Because the whole autoconnect machinery depends on udev events being
|
||||
delivered we place the service after systemd-udevd has been started.
|
||||
|
||||
Link: https://www.freedesktop.org/software/systemd/man/bootup.html
|
||||
Reported-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Reported-by: Wen Xiong <wenxiong@linux.ibm.com>
|
||||
Tested-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Tested-by: Wen Xiong <wenxiong@linux.ibm.com>
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
---
|
||||
nvmf-autoconnect/systemd/nvmefc-boot-connections.service.in | 3 +++
|
||||
nvmf-autoconnect/systemd/nvmf-connect@.service.in | 4 +++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nvmf-autoconnect/systemd/nvmefc-boot-connections.service b/nvmf-autoconnect/systemd/nvmefc-boot-connections.service
|
||||
index 33ab8c1f..7036625c 100644
|
||||
--- a/nvmf-autoconnect/systemd/nvmefc-boot-connections.service
|
||||
+++ b/nvmf-autoconnect/systemd/nvmefc-boot-connections.service
|
||||
@@ -1,6 +1,9 @@
|
||||
[Unit]
|
||||
Description=Auto-connect to subsystems on FC-NVME devices found during boot
|
||||
ConditionPathExists=/sys/class/fc/fc_udev_device/nvme_discovery
|
||||
+DefaultDependencies=no
|
||||
+After=systemd-udevd.service
|
||||
+Before=local-fs-pre.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
diff --git a/nvmf-autoconnect/systemd/nvmf-connect@.service b/nvmf-autoconnect/systemd/nvmf-connect@.service
|
||||
index 90f774c5..dd245ee6 100644
|
||||
--- a/nvmf-autoconnect/systemd/nvmf-connect@.service
|
||||
+++ b/nvmf-autoconnect/systemd/nvmf-connect@.service
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
[Unit]
|
||||
Description=NVMf auto-connect scan upon nvme discovery controller Events
|
||||
-After=syslog.target
|
||||
+DefaultDependencies=no
|
||||
+After=systemd-udevd.service
|
||||
+Before=local-fs-pre.target
|
||||
PartOf=nvmf-connect.target
|
||||
Requires=nvmf-connect.target
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 00909e8bc7e5a1b7a1129f8e18c60eedca0248f7 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Mon, 17 Apr 2023 15:39:56 +0200
|
||||
Subject: [PATCH] nvme: fix rnlpt to_string() values.
|
||||
|
||||
"Reservation Notification Log Page Type" values do not start
|
||||
from 0x1 but from 0x0.
|
||||
|
||||
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
||||
---
|
||||
nvme-print.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/nvme-print.c b/nvme-print.c
|
||||
index 8bd2174f..1ed34572 100644
|
||||
--- a/nvme-print.c
|
||||
+++ b/nvme-print.c
|
||||
@@ -610,10 +610,10 @@ void nvme_show_lba_status_log(void *lba_status, __u32 size,
|
||||
static const char *resv_notif_to_string(__u8 type)
|
||||
{
|
||||
switch (type) {
|
||||
- case 0x1: return "Empty Log Page";
|
||||
- case 0x2: return "Registration Preempted";
|
||||
- case 0x3: return "Reservation Released";
|
||||
- case 0x4: return "Reservation Preempted";
|
||||
+ case 0x0: return "Empty Log Page";
|
||||
+ case 0x1: return "Registration Preempted";
|
||||
+ case 0x2: return "Reservation Released";
|
||||
+ case 0x3: return "Reservation Preempted";
|
||||
default: return "Reserved";
|
||||
}
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,13 +0,0 @@
|
||||
--- nvme-cli-1.9/Makefile.orig 2020-05-27 14:04:56.259961135 -0400
|
||||
+++ nvme-cli-1.9/Makefile 2020-05-27 14:05:22.796185371 -0400
|
||||
@@ -125,8 +125,8 @@
|
||||
$(INSTALL) -m 644 -T ./etc/discovery.conf.in $(DESTDIR)$(SYSCONFDIR)/nvme/discovery.conf; \
|
||||
fi
|
||||
|
||||
-install-spec: install-bin install-man install-bash-completion install-zsh-completion install-etc install-systemd install-udev install-dracut
|
||||
-install: install-spec install-hostparams
|
||||
+install-spec: install-bin install-man install-bash-completion install-zsh-completion install-systemd install-udev install-dracut
|
||||
+install: install-spec
|
||||
|
||||
nvme.spec: nvme.spec.in NVME-VERSION-FILE
|
||||
sed -e 's/@@VERSION@@/$(NVME_VERSION)/g' < $< > $@+
|
Loading…
Reference in new issue