Accepting request 702761 from Base:System

OBS-URL: https://build.opensuse.org/request/show/702761
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nvme-cli?expand=0&rev=33
This commit is contained in:
Dominique Leuenberger 2019-05-15 10:24:42 +00:00 committed by Git OBS Bridge
commit 26c257db30
25 changed files with 156 additions and 5644 deletions

View File

@ -1,783 +0,0 @@
From 502986eb3d8a818e28a19d37565e86ea82fec197 Mon Sep 17 00:00:00 2001
From: Dong Ho <Dong.Ho@wdc.com>
Date: Fri, 11 Jan 2019 00:37:06 +0000
Subject: [PATCH] wdc: Change device capability checking
Changes the way device VID and type are checked for compatibility
purposes. Other minor changes for command names, update the respective
documentation file names, and remove deprecated C1 log functionality.
---
... => nvme-wdc-clear-pcie-correctable-errors.txt} | 12 +-
...t-add-log.txt => nvme-wdc-vs-smart-add-log.txt} | 14 +-
plugins/wdc/wdc-nvme.c | 444 +++++++--------------
plugins/wdc/wdc-nvme.h | 6 +-
4 files changed, 165 insertions(+), 311 deletions(-)
rename Documentation/{nvme-wdc-clear-pcie-corr.txt => nvme-wdc-clear-pcie-correctable-errors.txt} (66%)
rename Documentation/{nvme-wdc-smart-add-log.txt => nvme-wdc-vs-smart-add-log.txt} (95%)
diff --git a/Documentation/nvme-wdc-clear-pcie-corr.txt b/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt
similarity index 66%
rename from Documentation/nvme-wdc-clear-pcie-corr.txt
rename to Documentation/nvme-wdc-clear-pcie-correctable-errors.txt
index a65978e..4788f1f 100644
--- a/Documentation/nvme-wdc-clear-pcie-corr.txt
+++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt
@@ -1,18 +1,18 @@
-nvme-wdc-clear-pcie-corr(1)
-===========================
+nvme-wdc-clear-pcie-correctable-errors(1)
+=========================================
NAME
----
-nvme-wdc-clear-pcie-corr - Clears the pcie correctable errors field returned in the smart-log-add command.
+nvme-wdc-clear-pcie-correctable-errors - Clears the pcie correctable errors field returned in the smart-log-add command.
SYNOPSIS
--------
[verse]
-'nvme wdc clear-pcie-corr' <device>
+'nvme wdc clear-pcie-correctable-errors' <device>
DESCRIPTION
-----------
-For the NVMe device given, sends the wdc vendor unique clear pcie
+For the NVMe device given, sends the wdc vendor unique clear pcie
correctable errors command.
The <device> parameter is mandatory and may be either the NVMe
@@ -31,7 +31,7 @@ EXAMPLES
* Clears the PCIe Correctable Error Count field returned in the smart-log-add command:
+
------------
-# nvme wdc clear-pcie-corr /dev/nvme0
+# nvme wdc clear-pcie-correctable-errors /dev/nvme0
------------
diff --git a/Documentation/nvme-wdc-smart-add-log.txt b/Documentation/nvme-wdc-vs-smart-add-log.txt
similarity index 95%
rename from Documentation/nvme-wdc-smart-add-log.txt
rename to Documentation/nvme-wdc-vs-smart-add-log.txt
index e82debf..a9c4ead 100644
--- a/Documentation/nvme-wdc-smart-add-log.txt
+++ b/Documentation/nvme-wdc-vs-smart-add-log.txt
@@ -1,18 +1,18 @@
-nvme-wdc-smart-add-log(1)
-=========================
+nvme-wdc-vs-smart-add-log(1)
+============================
NAME
----
-nvme-wdc-smart-add-log - Send NVMe WDC smart-add-log Vendor Unique Command, return result
+nvme-wdc-vs-smart-add-log - Send NVMe WDC vs-smart-add-log Vendor Unique Command, return result
SYNOPSIS
--------
[verse]
-'nvme wdc smart-add-log' <device> [--interval=<NUM>, -i <NUM>] [--output-format=<normal|json> -o <normal|json>]
+'nvme wdc vs-smart-add-log' <device> [--interval=<NUM>, -i <NUM>] [--output-format=<normal|json> -o <normal|json>]
DESCRIPTION
-----------
-For the NVMe device given, send a Vendor Unique WDC smart-add-log command and
+For the NVMe device given, send a Vendor Unique WDC vs-smart-add-log command and
provide the additional smart log. The --interval option will return performance
statistics from the specified reporting interval.
@@ -257,10 +257,10 @@ a detrimental effect on the overall performance of the device.
EXAMPLES
--------
-* Has the program issue WDC smart-add-log Vendor Unique Command with default interval (14) :
+* Has the program issue WDC vs-smart-add-log Vendor Unique Command with default interval (14) :
+
------------
-# nvme wdc smart-add-log /dev/nvme0
+# nvme wdc vs-smart-add-log /dev/nvme0
------------
NVME
diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c
index 5ef965d..d198571 100644
--- a/plugins/wdc/wdc-nvme.c
+++ b/plugins/wdc/wdc-nvme.c
@@ -52,18 +52,33 @@
#define WDC_NVME_LOG_SIZE_HDR_LEN 0x08
/* Device Config */
-#define WDC_NVME_VID 0x1c58
-#define WDC_NVME_SN100_DEV_ID 0x0003
-#define WDC_NVME_SN200_DEV_ID 0x0023
-#define WDC_NVME_VID_2 0x1b96
-#define WDC_NVME_SN310_DEV_ID 0x2200
-#define WDC_NVME_SN510_DEV_ID 0x2300
-
-#define WDC_NVME_SNDK_VID 0x15b7
-#define WDC_NVME_SXSLCL_DEV_ID 0x2001
-#define WDC_NVME_SN520_DEV_ID_1 0x5003
-#define WDC_NVME_SN520_DEV_ID_2 0x5005
-#define WDC_NVME_SN720_DEV_ID 0x5002
+#define WDC_NVME_VID 0x1c58
+#define WDC_NVME_VID_2 0x1b96
+#define WDC_NVME_SNDK_VID 0x15b7
+
+#define WDC_NVME_SN100_DEV_ID 0x0003
+#define WDC_NVME_SN200_DEV_ID 0x0023
+#define WDC_NVME_SN630_DEV_ID 0x2200
+#define WDC_NVME_SN630_DEV_ID_1 0x2201
+#define WDC_NVME_SN840_DEV_ID 0x2300
+#define WDC_NVME_SN640_DEV_ID 0x2400
+#define WDC_NVME_SN640_DEV_ID_1 0x2401
+#define WDC_NVME_SN640_DEV_ID_2 0x2402
+#define WDC_NVME_SXSLCL_DEV_ID 0x2001
+#define WDC_NVME_SN520_DEV_ID 0x5003
+#define WDC_NVME_SN520_DEV_ID_1 0x5004
+#define WDC_NVME_SN520_DEV_ID_2 0x5005
+#define WDC_NVME_SN720_DEV_ID 0x5002
+
+#define WDC_DRIVE_CAP_CAP_DIAG 0x0000000000000001
+#define WDC_DRIVE_CAP_INTERNAL_LOG 0x0000000000000002
+#define WDC_DRIVE_CAP_CA_LOG_PAGE 0x0000000000000008
+#define WDC_DRIVE_CAP_DRIVE_STATUS 0x0000000000000020
+#define WDC_DRIVE_CAP_CLEAR_ASSERT 0x0000000000000040
+#define WDC_DRIVE_CAP_CLEAR_PCIE 0x0000000000000080
+
+#define WDC_DRIVE_CAP_DRIVE_ESSENTIALS 0x0000000100000000
+#define WDC_DRIVE_CAP_DUI_DATA 0x0000000200000000
/* Capture Diagnostics */
#define WDC_NVME_CAP_DIAG_HEADER_TOC_SIZE WDC_NVME_LOG_SIZE_DATA_LEN
@@ -323,7 +338,7 @@ static int wdc_purge(int argc, char **argv,
static int wdc_purge_monitor(int argc, char **argv,
struct command *command, struct plugin *plugin);
static int wdc_nvme_check_supported_log_page(int fd, __u8 log_id);
-static int wdc_clear_pcie_corr(int argc, char **argv, struct command *command,
+static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct command *command,
struct plugin *plugin);
static int wdc_do_drive_essentials(int fd, char *dir, char *key);
static int wdc_drive_essentials(int argc, char **argv, struct command *command,
@@ -427,17 +442,6 @@ struct __attribute__((__packed__)) wdc_ssd_ca_perf_stats {
__le32 rsvd2; /* 0x7C - Reserved */
};
-static double safe_div_fp(double numerator, double denominator)
-{
- return denominator ? numerator / denominator : 0;
-}
-
-static double calc_percent(uint64_t numerator, uint64_t denominator)
-{
- return denominator ?
- (uint64_t)(((double)numerator / (double)denominator) * 100) : 0;
-}
-
static int wdc_get_pci_ids(int *device_id, int *vendor_id)
{
int fd, ret = -1;
@@ -525,40 +529,85 @@ static bool wdc_check_device(int fd)
supported = false;
- /* WDC : Use PCI Vendor and Device ID's to identify WDC Devices */
- if ((le32_to_cpu(read_vendor_id) == WDC_NVME_VID) &&
- ((le32_to_cpu(read_device_id) == WDC_NVME_SN100_DEV_ID) ||
- (le32_to_cpu(read_device_id) == WDC_NVME_SN200_DEV_ID)))
- supported = true;
- else if ((le32_to_cpu(read_vendor_id) == WDC_NVME_SNDK_VID) &&
- (le32_to_cpu(read_device_id) == WDC_NVME_SXSLCL_DEV_ID))
- supported = true;
- else if ((le32_to_cpu(read_vendor_id) == WDC_NVME_VID_2) &&
- ((le32_to_cpu(read_device_id) == WDC_NVME_SN310_DEV_ID) ||
- (le32_to_cpu(read_device_id) == WDC_NVME_SN510_DEV_ID)))
+ if ((le32_to_cpu(read_vendor_id) == WDC_NVME_VID) ||
+ (le32_to_cpu(read_vendor_id) == WDC_NVME_VID_2) ||
+ (le32_to_cpu(read_vendor_id) == WDC_NVME_SNDK_VID))
supported = true;
else
- fprintf(stderr, "WARNING : WDC not supported, Vendor ID = 0x%x, Device ID = 0x%x\n",
+ fprintf(stderr, "ERROR : WDC: unsupported WDC device, Vendor ID = 0x%x, Device ID = 0x%x\n",
le32_to_cpu(read_vendor_id), le32_to_cpu(read_device_id));
return supported;
}
-static bool wdc_check_device_match(int fd, int vendor_id, int device_id)
-{
+static __u64 wdc_get_drive_capabilities(int fd) {
int ret;
int read_device_id, read_vendor_id;
+ __u64 capabilities = 0;
ret = wdc_get_pci_ids((int *)&read_device_id, (int *)&read_vendor_id);
if (ret < 0)
- return false;
+ return capabilities;
- /* WDC : Use PCI Vendor and Device ID's to identify WDC Devices */
- if ((le32_to_cpu(read_vendor_id) == vendor_id) &&
- (le32_to_cpu(read_device_id) == device_id))
- return true;
- else
- return false;
+ switch (read_vendor_id) {
+ case WDC_NVME_VID:
+ switch (read_device_id) {
+ case WDC_NVME_SN100_DEV_ID:
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG);
+ break;
+ case WDC_NVME_SN200_DEV_ID:
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG |
+ WDC_DRIVE_CAP_CA_LOG_PAGE);
+ break;
+ default:
+ capabilities = 0;
+ }
+ break;
+ case WDC_NVME_VID_2:
+ switch (read_device_id) {
+ case WDC_NVME_SN630_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN630_DEV_ID_1:
+ /* FALLTHRU */
+ case WDC_NVME_SN640_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN640_DEV_ID_1:
+ /* FALLTHRU */
+ case WDC_NVME_SN640_DEV_ID_2:
+ /* FALLTHRU */
+ case WDC_NVME_SN840_DEV_ID:
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG |
+ WDC_DRIVE_CAP_CA_LOG_PAGE | WDC_DRIVE_CAP_DRIVE_STATUS |
+ WDC_DRIVE_CAP_CLEAR_ASSERT);
+ break;
+ default:
+ capabilities = 0;
+ }
+ break;
+ case WDC_NVME_SNDK_VID:
+ switch (read_device_id) {
+ case WDC_NVME_SXSLCL_DEV_ID:
+ capabilities = WDC_DRIVE_CAP_DRIVE_ESSENTIALS;
+ break;
+ case WDC_NVME_SN520_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN520_DEV_ID_1:
+ /* FALLTHRU */
+ case WDC_NVME_SN520_DEV_ID_2:
+ /* FALLTHRU */
+ case WDC_NVME_SN720_DEV_ID:
+ capabilities = WDC_DRIVE_CAP_DUI_DATA;
+ break;
+ default:
+ capabilities = 0;
+ }
+
+ break;
+ default:
+ capabilities = 0;
+ }
+
+ return capabilities;
}
static int wdc_get_serial_name(int fd, char *file, size_t len, const char *suffix)
@@ -585,12 +634,11 @@ static int wdc_get_serial_name(int fd, char *file, size_t len, const char *suffi
ctrl.sn[i] = '\0';
i--;
}
-
if (ctrl.sn[sizeof (ctrl.sn) - 1] == '\0') {
ctrl_sn_len = strlen(ctrl.sn);
}
- res_len = snprintf(file, len, "%s%.*s%s.bin", orig, ctrl_sn_len, ctrl.sn, suffix);
+ res_len = snprintf(file, len, "%s%.*s%s", orig, ctrl_sn_len, ctrl.sn, suffix);
if (len <= res_len) {
fprintf(stderr, "ERROR : WDC : cannot format serial number due to data "
"of unexpected length\n");
@@ -957,6 +1005,7 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
char f[PATH_MAX] = {0};
__u32 xfer_size = 0;
int fd;
+ __u64 capabilities = 0;
struct config {
char *file;
@@ -969,10 +1018,10 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
};
const struct argconfig_commandline_options command_line_options[] = {
- {"output-file", 'o', "FILE", CFG_STRING, &cfg.file, required_argument, file},
- {"transfer-size", 's', "NUM", CFG_POSITIVE, &cfg.xfer_size, required_argument, size},
- { NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc},
- {NULL}
+ {"output-file", 'o', "FILE", CFG_STRING, &cfg.file, required_argument, file},
+ {"transfer-size", 's', "NUM", CFG_POSITIVE, &cfg.xfer_size, required_argument, size},
+ { NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc},
+ {NULL}
};
fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0);
@@ -990,19 +1039,17 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
return -1;
}
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN310_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN510_DEV_ID)) {
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_CAP_DIAG) == WDC_DRIVE_CAP_CAP_DIAG) {
+ snprintf(f + strlen(f), PATH_MAX, "%s", ".bin");
return wdc_do_cap_diag(fd, f, xfer_size);
- } else {
- fprintf(stderr, "ERROR : WDC: unsupported device for cap-diag command\n");
- }
+ } else
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return 0;
}
-static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
+static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
char *desc = "Internal Firmware Log.";
@@ -1014,6 +1061,7 @@ static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
int fd;
UtilsTimeInfo timeInfo;
__u8 timeStamp[MAX_PATH_LEN];
+ __u64 capabilities = 0;
struct config {
char *file;
@@ -1036,6 +1084,8 @@ static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
+ if (!wdc_check_device(fd))
+ return -1;
if (cfg.xfer_size != 0) {
xfer_size = cfg.xfer_size;
}
@@ -1057,13 +1107,12 @@ static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
}
fprintf(stderr, "%s: filename = %s\n", __func__, f);
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN310_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN510_DEV_ID)) {
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) {
+ snprintf(f + strlen(f), PATH_MAX, "%s", ".bin");
return wdc_do_cap_diag(fd, f, xfer_size);
} else {
- fprintf(stderr, "ERROR : WDC: unsupported device for internal_fw_log command\n");
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return -1;
}
}
@@ -1226,7 +1275,8 @@ static int wdc_drive_log(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
if (cfg.file != NULL) {
strncpy(f, cfg.file, PATH_MAX - 1);
}
@@ -1243,6 +1293,7 @@ static int wdc_get_crash_dump(int argc, char **argv, struct command *command,
const char *desc = "Get Crash Dump.";
const char *file = "Output file pathname.";
int fd;
+ int ret;
struct config {
char *file;
};
@@ -1261,21 +1312,22 @@ static int wdc_get_crash_dump(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ) {
- return wdc_crash_dump(fd, cfg.file, WDC_NVME_CRASH_DUMP_TYPE);
- } else {
- fprintf(stderr, "ERROR : WDC: unsupported device for get-crash-dump command\n");
+ if (!wdc_check_device(fd))
return -1;
+ ret = wdc_crash_dump(fd, cfg.file, WDC_NVME_CRASH_DUMP_TYPE);
+ if (ret != 0) {
+ fprintf(stderr, "ERROR : WDC : failed to read crash dump\n");
}
+ return ret;
}
static int wdc_get_pfail_dump(int argc, char **argv, struct command *command,
- struct plugin *plugin)
+ struct plugin *plugin)
{
char *desc = "Get Pfail Crash Dump.";
char *file = "Output file pathname.";
int fd;
+ int ret;
struct config {
char *file;
};
@@ -1294,13 +1346,13 @@ static int wdc_get_pfail_dump(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ) {
- return wdc_crash_dump(fd, cfg.file, WDC_NVME_PFAIL_DUMP_TYPE);
- } else {
- fprintf(stderr, "ERROR : WDC: unsupported device for get-pfail-dump command\n");
+ if (!wdc_check_device(fd))
return -1;
+ ret = wdc_crash_dump(fd, cfg.file, WDC_NVME_PFAIL_DUMP_TYPE);
+ if (ret != 0) {
+ fprintf(stderr, "ERROR : WDC : failed to read pfail crash dump\n");
}
+ return ret;
}
static void wdc_do_id_ctrl(__u8 *vs, struct json_object *root)
@@ -1372,7 +1424,8 @@ static int wdc_purge(int argc, char **argv,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
if (ret > 0) {
switch (ret) {
@@ -1419,7 +1472,8 @@ static int wdc_purge_monitor(int argc, char **argv,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
if (ret == 0) {
mon = (struct wdc_nvme_purge_monitor_data *) output;
@@ -1436,136 +1490,6 @@ static int wdc_purge_monitor(int argc, char **argv,
return ret;
}
-static void wdc_print_log_normal(struct wdc_ssd_perf_stats *perf)
-{
- printf(" C1 Log Page Performance Statistics :- \n");
- printf(" Host Read Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_cmds));
- printf(" Host Read Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_blks));
- printf(" Average Read Size %20lf\n",
- safe_div_fp((le64_to_cpu(perf->hr_blks)), (le64_to_cpu(perf->hr_cmds))));
- printf(" Host Read Cache Hit Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_ch_cmds));
- printf(" Host Read Cache Hit_Percentage %20"PRIu64"%%\n",
- (uint64_t) calc_percent(le64_to_cpu(perf->hr_ch_cmds), le64_to_cpu(perf->hr_cmds)));
- printf(" Host Read Cache Hit Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_ch_blks));
- printf(" Average Read Cache Hit Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->hr_ch_blks)), (le64_to_cpu(perf->hr_ch_cmds))));
- printf(" Host Read Commands Stalled %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_st_cmds));
- printf(" Host Read Commands Stalled Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hr_st_cmds)), le64_to_cpu(perf->hr_cmds)));
- printf(" Host Write Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_cmds));
- printf(" Host Write Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_blks));
- printf(" Average Write Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->hw_blks)), (le64_to_cpu(perf->hw_cmds))));
- printf(" Host Write Odd Start Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_os_cmds));
- printf(" Host Write Odd Start Commands Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_os_cmds)), (le64_to_cpu(perf->hw_cmds))));
- printf(" Host Write Odd End Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_oe_cmds));
- printf(" Host Write Odd End Commands Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_oe_cmds)), (le64_to_cpu((perf->hw_cmds)))));
- printf(" Host Write Commands Stalled %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_st_cmds));
- printf(" Host Write Commands Stalled Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_st_cmds)), (le64_to_cpu(perf->hw_cmds))));
- printf(" NAND Read Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nr_cmds));
- printf(" NAND Read Blocks Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nr_blks));
- printf(" Average NAND Read Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->nr_blks)), (le64_to_cpu((perf->nr_cmds)))));
- printf(" Nand Write Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nw_cmds));
- printf(" NAND Write Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nw_blks));
- printf(" Average NAND Write Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->nw_blks)), (le64_to_cpu(perf->nw_cmds))));
- printf(" NAND Read Before Write %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nrbw));
-}
-
-static void wdc_print_log_json(struct wdc_ssd_perf_stats *perf)
-{
- struct json_object *root;
-
- root = json_create_object();
- json_object_add_value_int(root, "Host Read Commands", le64_to_cpu(perf->hr_cmds));
- json_object_add_value_int(root, "Host Read Blocks", le64_to_cpu(perf->hr_blks));
- json_object_add_value_int(root, "Average Read Size",
- safe_div_fp((le64_to_cpu(perf->hr_blks)), (le64_to_cpu(perf->hr_cmds))));
- json_object_add_value_int(root, "Host Read Cache Hit Commands",
- (uint64_t)le64_to_cpu(perf->hr_ch_cmds));
- json_object_add_value_int(root, "Host Read Cache Hit Percentage",
- (uint64_t) calc_percent(le64_to_cpu(perf->hr_ch_cmds), le64_to_cpu(perf->hr_cmds)));
- json_object_add_value_int(root, "Host Read Cache Hit Blocks",
- (uint64_t)le64_to_cpu(perf->hr_ch_blks));
- json_object_add_value_int(root, "Average Read Cache Hit Size",
- safe_div_fp((le64_to_cpu(perf->hr_ch_blks)), (le64_to_cpu(perf->hr_ch_cmds))));
- json_object_add_value_int(root, "Host Read Commands Stalled",
- (uint64_t)le64_to_cpu(perf->hr_st_cmds));
- json_object_add_value_int(root, "Host Read Commands Stalled Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hr_st_cmds)), le64_to_cpu(perf->hr_cmds)));
- json_object_add_value_int(root, "Host Write Commands",
- (uint64_t)le64_to_cpu(perf->hw_cmds));
- json_object_add_value_int(root, "Host Write Blocks",
- (uint64_t)le64_to_cpu(perf->hw_blks));
- json_object_add_value_int(root, "Average Write Size",
- safe_div_fp((le64_to_cpu(perf->hw_blks)), (le64_to_cpu(perf->hw_cmds))));
- json_object_add_value_int(root, "Host Write Odd Start Commands",
- (uint64_t)le64_to_cpu(perf->hw_os_cmds));
- json_object_add_value_int(root, "Host Write Odd Start Commands Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_os_cmds)), (le64_to_cpu(perf->hw_cmds))));
- json_object_add_value_int(root, "Host Write Odd End Commands",
- (uint64_t)le64_to_cpu(perf->hw_oe_cmds));
- json_object_add_value_int(root, "Host Write Odd End Commands Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_oe_cmds)), (le64_to_cpu((perf->hw_cmds)))));
- json_object_add_value_int(root, "Host Write Commands Stalled",
- (uint64_t)le64_to_cpu(perf->hw_st_cmds));
- json_object_add_value_int(root, "Host Write Commands Stalled Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_st_cmds)), (le64_to_cpu(perf->hw_cmds))));
- json_object_add_value_int(root, "NAND Read Commands",
- (uint64_t)le64_to_cpu(perf->nr_cmds));
- json_object_add_value_int(root, "NAND Read Blocks Commands",
- (uint64_t)le64_to_cpu(perf->nr_blks));
- json_object_add_value_int(root, "Average NAND Read Size",
- safe_div_fp((le64_to_cpu(perf->nr_blks)), (le64_to_cpu((perf->nr_cmds)))));
- json_object_add_value_int(root, "Nand Write Commands",
- (uint64_t)le64_to_cpu(perf->nw_cmds));
- json_object_add_value_int(root, "NAND Write Blocks",
- (uint64_t)le64_to_cpu(perf->nw_blks));
- json_object_add_value_int(root, "Average NAND Write Size",
- safe_div_fp((le64_to_cpu(perf->nw_blks)), (le64_to_cpu(perf->nw_cmds))));
- json_object_add_value_int(root, "NAND Read Before Written",
- (uint64_t)le64_to_cpu(perf->nrbw));
- json_print_object(root, NULL);
- printf("\n");
- json_free_object(root);
-}
-
-static int wdc_print_log(struct wdc_ssd_perf_stats *perf, int fmt)
-{
- if (!perf) {
- fprintf(stderr, "ERROR : WDC : Invalid buffer to read perf stats\n");
- return -1;
- }
- switch (fmt) {
- case NORMAL:
- wdc_print_log_normal(perf);
- break;
- case JSON:
- wdc_print_log_json(perf);
- break;
- }
- return 0;
-}
-
static void wdc_print_ca_log_normal(struct wdc_ssd_ca_perf_stats *perf)
{
uint64_t converted = 0;
@@ -1709,7 +1633,8 @@ static int wdc_get_ca_log_page(int fd, char *format)
struct wdc_ssd_ca_perf_stats *perf;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
fmt = validate_output_format(format);
if (fmt < 0) {
fprintf(stderr, "ERROR : WDC : invalid output format\n");
@@ -1746,70 +1671,14 @@ static int wdc_get_ca_log_page(int fd, char *format)
return ret;
}
-static int wdc_get_c1_log_page(int fd, char *format, uint8_t interval)
-{
- int ret = 0;
- int fmt = -1;
- __u8 *data;
- __u8 *p;
- int i;
- int skip_cnt = 4;
- int total_subpages;
- struct wdc_log_page_header *l;
- struct wdc_log_page_subpage_header *sph;
- struct wdc_ssd_perf_stats *perf;
-
- wdc_check_device(fd);
- fmt = validate_output_format(format);
- if (fmt < 0) {
- fprintf(stderr, "ERROR : WDC : invalid output format\n");
- return fmt;
- }
-
- if (interval < 1 || interval > 15) {
- fprintf(stderr, "ERROR : WDC : interval out of range [1-15]\n");
- return -1;
- }
-
- if ((data = (__u8*) malloc(sizeof (__u8) * WDC_ADD_LOG_BUF_LEN)) == NULL) {
- fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
- return -1;
- }
- memset(data, 0, sizeof (__u8) * WDC_ADD_LOG_BUF_LEN);
-
- ret = nvme_get_log(fd, 0x01, WDC_NVME_ADD_LOG_OPCODE,
- false, WDC_ADD_LOG_BUF_LEN, data);
- if (strcmp(format, "json"))
- fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
- if (ret == 0) {
- l = (struct wdc_log_page_header*)data;
- total_subpages = l->num_subpages + WDC_NVME_GET_STAT_PERF_INTERVAL_LIFETIME - 1;
- for (i = 0, p = data + skip_cnt; i < total_subpages; i++, p += skip_cnt) {
- sph = (struct wdc_log_page_subpage_header *) p;
- if (sph->spcode == WDC_GET_LOG_PAGE_SSD_PERFORMANCE) {
- if (sph->pcset == interval) {
- perf = (struct wdc_ssd_perf_stats *) (p + 4);
- ret = wdc_print_log(perf, fmt);
- break;
- }
- }
- skip_cnt = le32_to_cpu(sph->subpage_length) + 4;
- }
- if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read data from buffer\n");
- }
- }
- free(data);
- return ret;
-}
-
-static int wdc_smart_add_log(int argc, char **argv, struct command *command,
+static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
const char *desc = "Retrieve additional performance statistics.";
const char *interval = "Interval to read the statistics from [1, 15].";
int fd;
int ret;
+ __u64 capabilities = 0;
struct config {
uint8_t interval;
@@ -1832,38 +1701,20 @@ static int wdc_smart_add_log(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
-
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID)) {
- // Get the C1 Log Page
- ret = wdc_get_c1_log_page(fd, cfg.output_format, cfg.interval);
-
- if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read C1 Log Page data from buffer\n");
- return ret;
- }
- }
- else if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID)) {
- // Get the CA and C1 Log Page
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & (WDC_DRIVE_CAP_CA_LOG_PAGE)) == (WDC_DRIVE_CAP_CA_LOG_PAGE)) {
+ // Get the CA Log Page
ret = wdc_get_ca_log_page(fd, cfg.output_format);
if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read CA Log Page data from buffer\n");
+ fprintf(stderr, "ERROR : WDC : Unable to read CA Log Page\n");
return ret;
}
-
- ret = wdc_get_c1_log_page(fd, cfg.output_format, cfg.interval);
- if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read C1 Log Page data from buffer\n");
- return ret;
- }
- }
- else {
- fprintf(stderr, "INFO : WDC : Command not supported in this device\n");
- }
-
+ } else
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return 0;
}
-static int wdc_clear_pcie_corr(int argc, char **argv, struct command *command,
+static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
char *desc = "Clear PCIE Correctable Errors.";
@@ -1879,7 +1730,8 @@ static int wdc_clear_pcie_corr(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
memset(&admin_cmd, 0, sizeof (admin_cmd));
admin_cmd.opcode = WDC_NVME_CLEAR_PCIE_CORR_OPCODE;
@@ -2610,13 +2462,15 @@ static int wdc_drive_essentials(int argc, char **argv, struct command *command,
{ NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc},
{NULL}
};
+ __u64 capabilities = 0;
fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0);
if (fd < 0)
return fd;
- if (!wdc_check_device_match(fd, WDC_NVME_SNDK_VID, WDC_NVME_SXSLCL_DEV_ID)) {
- fprintf(stderr, "WARNING : WDC : Device not supported\n");
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_DRIVE_ESSENTIALS) != WDC_DRIVE_CAP_DRIVE_ESSENTIALS) {
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return -1;
}
diff --git a/plugins/wdc/wdc-nvme.h b/plugins/wdc/wdc-nvme.h
index c2d892b..4fcc33b 100644
--- a/plugins/wdc/wdc-nvme.h
+++ b/plugins/wdc/wdc-nvme.h
@@ -15,9 +15,9 @@ PLUGIN(NAME("wdc", "Western Digital vendor specific extensions"),
ENTRY("id-ctrl", "WDC identify controller", wdc_id_ctrl)
ENTRY("purge", "WDC Purge", wdc_purge)
ENTRY("purge-monitor", "WDC Purge Monitor", wdc_purge_monitor)
- ENTRY("vs-internal-log", "WDC Internal Firmware Log", wdc_internal_fw_log)
- ENTRY("smart-add-log", "WDC Additional Smart Log", wdc_smart_add_log)
- ENTRY("clear-pcie-corr", "WDC Clear PCIe Correctable Error Count", wdc_clear_pcie_corr)
+ ENTRY("vs-internal-log", "WDC Internal Firmware Log", wdc_vs_internal_fw_log)
+ ENTRY("vs-smart-add-log", "WDC Additional Smart Log", wdc_vs_smart_add_log)
+ ENTRY("clear-pcie-correctable-errors", "WDC Clear PCIe Correctable Error Count", wdc_clear_pcie_correctable_errors)
ENTRY("drive-essentials", "WDC Drive Essentials", wdc_drive_essentials)
)
);
--
2.13.7

View File

@ -1,327 +0,0 @@
From 47384b5e28a13cd060dddbf24d18cf0a8c11fd03 Mon Sep 17 00:00:00 2001
From: Dong Ho <Dong.Ho@wdc.com>
Date: Fri, 11 Jan 2019 00:37:09 +0000
Subject: [PATCH] wdc: Add additional device for vs-internal-log
Add support for SN730 device to vs-internal-log.
Reviewed-by Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
plugins/wdc/wdc-nvme.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 266 insertions(+)
diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c
index d198571..88c5c76 100644
--- a/plugins/wdc/wdc-nvme.c
+++ b/plugins/wdc/wdc-nvme.c
@@ -69,6 +69,8 @@
#define WDC_NVME_SN520_DEV_ID_1 0x5004
#define WDC_NVME_SN520_DEV_ID_2 0x5005
#define WDC_NVME_SN720_DEV_ID 0x5002
+#define WDC_NVME_SN730_DEV_ID 0x3714
+#define WDC_NVME_SN730_DEV_ID_1 0x3734
#define WDC_DRIVE_CAP_CAP_DIAG 0x0000000000000001
#define WDC_DRIVE_CAP_INTERNAL_LOG 0x0000000000000002
@@ -80,6 +82,21 @@
#define WDC_DRIVE_CAP_DRIVE_ESSENTIALS 0x0000000100000000
#define WDC_DRIVE_CAP_DUI_DATA 0x0000000200000000
+#define WDC_SN730_CAP_VUC_LOG 0x0000000400000000
+
+/* SN730 Get Log Capabilities */
+#define SN730_NVME_GET_LOG_OPCODE 0xc2
+#define SN730_GET_FULL_LOG_LENGTH 0x00080009
+#define SN730_GET_KEY_LOG_LENGTH 0x00090009
+#define SN730_GET_COREDUMP_LOG_LENGTH 0x00120009
+#define SN730_GET_EXTENDED_LOG_LENGTH 0x00420009
+
+#define SN730_GET_FULL_LOG_SUBOPCODE 0x00010009
+#define SN730_GET_KEY_LOG_SUBOPCODE 0x00020009
+#define SN730_GET_CORE_LOG_SUBOPCODE 0x00030009
+#define SN730_GET_EXTEND_LOG_SUBOPCODE 0x00040009
+#define SN730_LOG_CHUNK_SIZE 0x1000
+
/* Capture Diagnostics */
#define WDC_NVME_CAP_DIAG_HEADER_TOC_SIZE WDC_NVME_LOG_SIZE_DATA_LEN
#define WDC_NVME_CAP_DIAG_OPCODE 0xE6
@@ -277,6 +294,18 @@ typedef struct _WDC_DE_CSA_FEATURE_ID_LIST
__u8 featureName[WDC_DE_GENERIC_BUFFER_SIZE];
} WDC_DE_CSA_FEATURE_ID_LIST;
+typedef struct tarfile_metadata {
+ char fileName[MAX_PATH_LEN];
+ int8_t bufferFolderPath[MAX_PATH_LEN];
+ char bufferFolderName[MAX_PATH_LEN];
+ char tarFileName[MAX_PATH_LEN];
+ char tarFiles[MAX_PATH_LEN];
+ char tarCmd[MAX_PATH_LEN+MAX_PATH_LEN];
+ char currDir[MAX_PATH_LEN];
+ UtilsTimeInfo timeInfo;
+ uint8_t* timeString[MAX_PATH_LEN];
+} tarfile_metadata;
+
static WDC_DE_CSA_FEATURE_ID_LIST deFeatureIdList[] =
{
{0x00 , "Dummy Placeholder"},
@@ -580,6 +609,11 @@ static __u64 wdc_get_drive_capabilities(int fd) {
WDC_DRIVE_CAP_CA_LOG_PAGE | WDC_DRIVE_CAP_DRIVE_STATUS |
WDC_DRIVE_CAP_CLEAR_ASSERT);
break;
+ case WDC_NVME_SN730_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN730_DEV_ID_1:
+ capabilities = WDC_SN730_CAP_VUC_LOG;
+ break;
default:
capabilities = 0;
}
@@ -1049,6 +1083,236 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
return 0;
}
+static int wdc_do_get_sn730_log_len(int fd, uint32_t *len_buf, uint32_t subopcode)
+{
+ int ret;
+ uint32_t *output = NULL;
+ struct nvme_admin_cmd admin_cmd;
+
+ if ((output = (uint32_t*)malloc(sizeof(uint32_t))) == NULL) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ return -1;
+ }
+ memset(output, 0, sizeof (uint32_t));
+ memset(&admin_cmd, 0, sizeof (struct nvme_admin_cmd));
+
+ admin_cmd.data_len = 8;
+ admin_cmd.opcode = SN730_NVME_GET_LOG_OPCODE;
+ admin_cmd.addr = (uintptr_t)output;
+ admin_cmd.cdw12 = subopcode;
+ admin_cmd.cdw10 = SN730_LOG_CHUNK_SIZE / 4;
+
+ ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
+ if (ret == 0)
+ *len_buf = *output;
+ free(output);
+ return ret;
+}
+
+static int wdc_do_get_sn730_log(int fd, void * log_buf, uint32_t offset, uint32_t subopcode)
+{
+ int ret;
+ uint8_t *output = NULL;
+ struct nvme_admin_cmd admin_cmd;
+
+ if ((output = (uint8_t*)calloc(SN730_LOG_CHUNK_SIZE, sizeof(uint8_t))) == NULL) {
+ fprintf(stderr, "ERROR : WDC : calloc : %s\n", strerror(errno));
+ return -1;
+ }
+ memset(&admin_cmd, 0, sizeof (struct nvme_admin_cmd));
+ admin_cmd.data_len = SN730_LOG_CHUNK_SIZE;
+ admin_cmd.opcode = SN730_NVME_GET_LOG_OPCODE;
+ admin_cmd.addr = (uintptr_t)output;
+ admin_cmd.cdw12 = subopcode;
+ admin_cmd.cdw13 = offset;
+ admin_cmd.cdw10 = SN730_LOG_CHUNK_SIZE / 4;
+
+ ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
+ if (!ret)
+ memcpy(log_buf, output, SN730_LOG_CHUNK_SIZE);
+ return ret;
+}
+
+static int get_sn730_log_chunks(int fd, uint8_t* log_buf, uint32_t log_len, uint32_t subopcode)
+{
+ int ret = 0;
+ uint8_t* chunk_buf = NULL;
+ int remaining = log_len;
+ int curr_offset = 0;
+
+ if ((chunk_buf = (uint8_t*) malloc(sizeof (uint8_t) * SN730_LOG_CHUNK_SIZE)) == NULL) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ ret = -1;
+ goto out;
+ }
+
+ while (remaining > 0) {
+ memset(chunk_buf, 0, SN730_LOG_CHUNK_SIZE);
+ ret = wdc_do_get_sn730_log(fd, chunk_buf, curr_offset, subopcode);
+ if (!ret) {
+ if (remaining >= SN730_LOG_CHUNK_SIZE) {
+ memcpy(log_buf + (curr_offset * SN730_LOG_CHUNK_SIZE),
+ chunk_buf, SN730_LOG_CHUNK_SIZE);
+ } else {
+ memcpy(log_buf + (curr_offset * SN730_LOG_CHUNK_SIZE),
+ chunk_buf, remaining);
+ }
+ remaining -= SN730_LOG_CHUNK_SIZE;
+ curr_offset += 1;
+ } else
+ goto out;
+ }
+out:
+ free(chunk_buf);
+ return ret;
+}
+
+static int wdc_do_sn730_get_and_tar(int fd, char * outputName)
+{
+ int ret = 0;
+ void *retPtr;
+ uint8_t* full_log_buf = NULL;
+ uint8_t* key_log_buf = NULL;
+ uint8_t* core_dump_log_buf = NULL;
+ uint8_t* extended_log_buf = NULL;
+ uint32_t full_log_len = 0;
+ uint32_t key_log_len = 0;
+ uint32_t core_dump_log_len = 0;
+ uint32_t extended_log_len = 0;
+ tarfile_metadata* tarInfo = NULL;
+
+ tarInfo = (struct tarfile_metadata*) malloc(sizeof(tarfile_metadata));
+ if (tarInfo == NULL) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ ret = -1;
+ goto free_buf;
+ }
+ memset(tarInfo, 0, sizeof(tarfile_metadata));
+
+ /* Create Logs directory */
+ wdc_UtilsGetTime(&tarInfo->timeInfo);
+ memset(tarInfo->timeString, 0, sizeof(tarInfo->timeString));
+ wdc_UtilsSnprintf((char*)tarInfo->timeString, MAX_PATH_LEN, "%02u%02u%02u_%02u%02u%02u",
+ tarInfo->timeInfo.year, tarInfo->timeInfo.month, tarInfo->timeInfo.dayOfMonth,
+ tarInfo->timeInfo.hour, tarInfo->timeInfo.minute, tarInfo->timeInfo.second);
+
+ wdc_UtilsSnprintf((char*)tarInfo->bufferFolderName, MAX_PATH_LEN, "%s",
+ (char*)outputName);
+
+ retPtr = getcwd((char*)tarInfo->currDir, MAX_PATH_LEN);
+ if (retPtr != NULL)
+ wdc_UtilsSnprintf((char*)tarInfo->bufferFolderPath, MAX_PATH_LEN, "%s%s%s",
+ (char *)tarInfo->currDir, WDC_DE_PATH_SEPARATOR, (char *)tarInfo->bufferFolderName);
+ else {
+ fprintf(stderr, "ERROR : WDC : get current working directory failed\n");
+ goto free_buf;
+ }
+
+ ret = wdc_UtilsCreateDir((char*)tarInfo->bufferFolderPath);
+ if (ret)
+ {
+ fprintf(stderr, "ERROR : WDC : create directory failed, ret = %d, dir = %s\n", ret, tarInfo->bufferFolderPath);
+ goto free_buf;
+ } else {
+ fprintf(stderr, "Stored log files in directory: %s\n", tarInfo->bufferFolderPath);
+ }
+
+ ret = wdc_do_get_sn730_log_len(fd, &full_log_len, SN730_GET_FULL_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+ ret = wdc_do_get_sn730_log_len(fd, &key_log_len, SN730_GET_KEY_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+ ret = wdc_do_get_sn730_log_len(fd, &core_dump_log_len, SN730_GET_COREDUMP_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+ ret = wdc_do_get_sn730_log_len(fd, &extended_log_len, SN730_GET_EXTENDED_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ full_log_buf = (uint8_t*) calloc(full_log_len, sizeof (uint8_t));
+ key_log_buf = (uint8_t*) calloc(key_log_len, sizeof (uint8_t));
+ core_dump_log_buf = (uint8_t*) calloc(core_dump_log_len, sizeof (uint8_t));
+ extended_log_buf = (uint8_t*) calloc(extended_log_len, sizeof (uint8_t));
+
+ if (!full_log_buf || !key_log_buf || !core_dump_log_buf || !extended_log_buf) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ ret = -1;
+ goto free_buf;
+ }
+
+ /* Get the full log */
+ ret = get_sn730_log_chunks(fd, full_log_buf, full_log_len, SN730_GET_FULL_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Get the key log */
+ ret = get_sn730_log_chunks(fd, key_log_buf, key_log_len, SN730_GET_KEY_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Get the core dump log */
+ ret = get_sn730_log_chunks(fd, core_dump_log_buf, core_dump_log_len, SN730_GET_CORE_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Get the extended log */
+ ret = get_sn730_log_chunks(fd, extended_log_buf, extended_log_len, SN730_GET_EXTEND_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Write log files */
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "full_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)full_log_buf, full_log_len);
+
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "key_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)key_log_buf, key_log_len);
+
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "core_dump_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)core_dump_log_buf, core_dump_log_len);
+
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "extended_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)extended_log_buf, extended_log_len);
+
+ /* Tar the log directory */
+ wdc_UtilsSnprintf(tarInfo->tarFileName, sizeof(tarInfo->tarFileName), "%s%s", (char*)tarInfo->bufferFolderPath, WDC_DE_TAR_FILE_EXTN);
+ wdc_UtilsSnprintf(tarInfo->tarFiles, sizeof(tarInfo->tarFiles), "%s%s%s", (char*)tarInfo->bufferFolderName, WDC_DE_PATH_SEPARATOR, WDC_DE_TAR_FILES);
+ wdc_UtilsSnprintf(tarInfo->tarCmd, sizeof(tarInfo->tarCmd), "%s %s %s", WDC_DE_TAR_CMD, (char*)tarInfo->tarFileName, (char*)tarInfo->tarFiles);
+
+ ret = system(tarInfo->tarCmd);
+
+ if (ret)
+ fprintf(stderr, "ERROR : WDC : Tar of log data failed, ret = %d\n", ret);
+
+free_buf:
+ free(tarInfo);
+ free(full_log_buf);
+ free(core_dump_log_buf);
+ free(key_log_buf);
+ free(extended_log_buf);
+ return ret;
+}
+
static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
@@ -1111,6 +1375,8 @@ static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command
if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) {
snprintf(f + strlen(f), PATH_MAX, "%s", ".bin");
return wdc_do_cap_diag(fd, f, xfer_size);
+ } else if ((capabilities & WDC_SN730_CAP_VUC_LOG) == WDC_SN730_CAP_VUC_LOG) {
+ return wdc_do_sn730_get_and_tar(fd, f);
} else {
fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return -1;
--
2.13.7

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
From dc26bb70d82569730b4ce5c88f22084812a2334d Mon Sep 17 00:00:00 2001
From: Breno Leitao <leitao@debian.org>
Date: Mon, 21 Jan 2019 06:31:15 -0500
Subject: [PATCH] Fix compilation with GCC-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Printf() is being called to print an unsigned long int using the long long
identifier. This causes the following error with GCC-8:
nvme.c:3056:5: error: format %llu expects argument of type long long unsigned int, but argument 3 has type __u64 {aka long unsigned int} [-Werror=format=]
"Invalid value for block size (%llu), must be a power of two\n",
^
nvme.c:3091:6: error: format %llu expects argument of type long long unsigned int, but argument 3 has type __u64 {aka long unsigned int} [-Werror=format=]
"LBAF corresponding to block size %llu (LBAF %u) not found\n",
Adjusting the printf arguments to print the proper format.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
nvme.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nvme.c b/nvme.c
index 992c6b9..e85834d 100644
--- a/nvme.c
+++ b/nvme.c
@@ -3053,7 +3053,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
if (cfg.bs) {
if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) {
fprintf(stderr,
- "Invalid value for block size (%llu), must be a power of two\n",
+ "Invalid value for block size (%lu), must be a power of two\n",
cfg.bs);
return EINVAL;
}
@@ -3088,7 +3088,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
}
if (cfg.lbaf == 0xff) {
fprintf(stderr,
- "LBAF corresponding to block size %llu (LBAF %u) not found\n",
+ "LBAF corresponding to block size %lu (LBAF %u) not found\n",
cfg.bs, lbads);
fprintf(stderr,
"Please correct block size, or specify LBAF directly\n");
--
2.13.7

View File

@ -1,39 +0,0 @@
From 254bcd6b23436fd929e18c935322410b541ca121 Mon Sep 17 00:00:00 2001
From: Breno Leitao <leitao@debian.org>
Date: Mon, 21 Jan 2019 07:03:24 -0500
Subject: [PATCH] Fix CFLAGS parameter
Currently nvme-cli 1.7 is not compiling on Debian because the Debian helper
(compilation toolkit) does pass a CFLAGS variable, thus, avoiding the
initial definition (CFLAGS ?= -O2 -g -Wall -Werror -I.)
The problem is that -I should not be removed, otherwise the code does not
compile, with the following bug:
cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__CHECK_ENDIAN__ -g -O2 -fdebug-prefix-map=/home/breno/nvme/nvme-cli-1.7=. -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -DLIBUUID -DNVME_VERSION='"1.7"' -o plugins/intel/intel-nvme.o -c plugins/intel/intel-nvme.c
plugins/intel/intel-nvme.c:10:18: fatal error: nvme.h: No such file or directory
compilation terminated.
This patch just moves the -I parameter to part of the CFLAGS that is not
replaced by dh's CFLAGS.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 525616a..3a4e223 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-CFLAGS ?= -O2 -g -Wall -Werror -I.
-CFLAGS += -std=gnu99
+CFLAGS ?= -O2 -g -Wall -Werror
+CFLAGS += -std=gnu99 -I.
CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__
LIBUUID = $(shell $(LD) -o /dev/null -luuid >/dev/null 2>&1; echo $$?)
NVME = nvme
--
2.13.7

View File

@ -0,0 +1,26 @@
From 1176e581e44f54c617395e2f778ea8ac9808a1a3 Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Mon, 6 May 2019 11:43:23 +0200
Subject: [PATCH] nvme-cli: Check for sysfs interface before NVMe discovery
This prevents an unnecessary error message in the case that the nvme-fc
kernel module is not loaded and the
/sys/class/fc/fc_udev_device/nvme_discovery handle is not available.
---
nvme-fc-autoconnect/nvmefc-boot-connections.service | 1 +
1 file changed, 1 insertion(+)
diff --git a/nvme-fc-autoconnect/nvmefc-boot-connections.service b/nvme-fc-autoconnect/nvmefc-boot-connections.service
index aa35c15..ffa7087 100644
--- a/nvme-fc-autoconnect/nvmefc-boot-connections.service
+++ b/nvme-fc-autoconnect/nvmefc-boot-connections.service
@@ -1,5 +1,6 @@
[Unit]
Description=Auto-connect to subsystems on FC-NVME devices during boot
+ConditionPathExists=/sys/class/fc/fc_udev_device/nvme_discovery
[Service]
Type=oneshot
--
2.16.4

View File

@ -1,39 +0,0 @@
From 97274c2cf573349e637b4a55c0045488206470ad Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Date: Fri, 25 Jan 2019 08:54:32 -0700
Subject: [PATCH] nvme-cli: fix compilation with uint64_t cast
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
nvme.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/nvme.c b/nvme.c
index e85834d..8922ec2 100644
--- a/nvme.c
+++ b/nvme.c
@@ -3053,8 +3053,8 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
if (cfg.bs) {
if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) {
fprintf(stderr,
- "Invalid value for block size (%lu), must be a power of two\n",
- cfg.bs);
+ "Invalid value for block size (%"PRIu64"), must be a power of two\n",
+ (uint64_t) cfg.bs);
return EINVAL;
}
}
@@ -3088,8 +3088,8 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
}
if (cfg.lbaf == 0xff) {
fprintf(stderr,
- "LBAF corresponding to block size %lu (LBAF %u) not found\n",
- cfg.bs, lbads);
+ "LBAF corresponding to block size %"PRIu64"(LBAF %u) not found\n",
+ (uint64_t)cfg.bs, lbads);
fprintf(stderr,
"Please correct block size, or specify LBAF directly\n");
return EINVAL;
--
2.13.7

View File

@ -1,196 +0,0 @@
From bfeeaba4f49f741b2cb4c3f2f1f89f835675c485 Mon Sep 17 00:00:00 2001
From: Keith Busch <keith.busch@intel.com>
Date: Mon, 28 Jan 2019 17:50:10 -0700
Subject: [PATCH] Regen docs
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
Documentation/nvme-create-ns.1 | 12 +++++++++---
Documentation/nvme-create-ns.html | 21 ++++++++++++++++++---
Documentation/nvme-format.1 | 4 ++--
Documentation/nvme-format.html | 2 +-
.../nvme-wdc-clear-pcie-correctable-errors.1 | 4 ++--
Documentation/nvme-wdc-vs-smart-add-log.1 | 4 ++--
6 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/Documentation/nvme-create-ns.1 b/Documentation/nvme-create-ns.1
index abedcbd..8963b83 100644
--- a/Documentation/nvme-create-ns.1
+++ b/Documentation/nvme-create-ns.1
@@ -2,12 +2,12 @@
.\" Title: nvme-create-ns
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/08/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-CREATE\-NS" "1" "01/08/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-CREATE\-NS" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -37,6 +37,7 @@ nvme-create-ns \- Send NVMe Namespace management command to create namespace, re
[\-\-flbas=<flbas> | \-f <flbas>]
[\-\-dps=<dps> | \-d <dps>]
[\-\-nmic=<nmic> | \-m <nmic>]
+ [\-\-block\-size=<block\-size> | \-b <block\-size>]
.fi
.SH "DESCRIPTION"
.sp
@@ -57,7 +58,7 @@ The namespace capacity\&.
.PP
\-f, \-\-flbas
.RS 4
-The namespace formatted logical block size setting\&.
+The namespace formatted logical block size setting\&. Conflicts with \-\-block\-size argument\&.
.RE
.PP
\-d, \-\-dps
@@ -69,6 +70,11 @@ The data protection settings\&.
.RS 4
Namespace multipath and sharing capabilities\&.
.RE
+.PP
+\-b, \-\-block\-size
+.RS 4
+Target block size the new namespace should be formatted as\&. Potential FLBAS values will be values will be scanned and the lowest numbered will be selected for the create\-ns operation\&. Conflicts with \-\-flbas argument\&.
+.RE
.SH "EXAMPLES"
.sp
No examples provided yet\&.
diff --git a/Documentation/nvme-create-ns.html b/Documentation/nvme-create-ns.html
index f763f91..05225d7 100644
--- a/Documentation/nvme-create-ns.html
+++ b/Documentation/nvme-create-ns.html
@@ -433,7 +433,7 @@ thead, p.table.header {
p.table {
margin-top: 0;
}
-/* Because the table frame attribute is overridden by CSS in most browsers. */
+/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
@@ -750,7 +750,8 @@ nvme-create-ns(1) Manual Page
[--ncap=&lt;ncap&gt; | -c &lt;ncap&gt;]
[--flbas=&lt;flbas&gt; | -f &lt;flbas&gt;]
[--dps=&lt;dps&gt; | -d &lt;dps&gt;]
- [--nmic=&lt;nmic&gt; | -m &lt;nmic&gt;]</pre>
+ [--nmic=&lt;nmic&gt; | -m &lt;nmic&gt;]
+ [--block-size=&lt;block-size&gt; | -b &lt;block-size&gt;]</pre>
<div class="attribution">
</div></div>
</div>
@@ -800,6 +801,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
<dd>
<p>
The namespace formatted logical block size setting.
+ Conflicts with --block-size argument.
</p>
</dd>
<dt class="hdlist1">
@@ -824,6 +826,19 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
Namespace multipath and sharing capabilities.
</p>
</dd>
+<dt class="hdlist1">
+-b
+</dt>
+<dt class="hdlist1">
+--block-size
+</dt>
+<dd>
+<p>
+ Target block size the new namespace should be formatted as. Potential FLBAS
+ values will be values will be scanned and the lowest numbered will be
+ selected for the create-ns operation. Conflicts with --flbas argument.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -843,7 +858,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2017-02-27 10:11:57 EST
+Last updated 2019-01-28 17:49:54 MST
</div>
</div>
</body>
diff --git a/Documentation/nvme-format.1 b/Documentation/nvme-format.1
index 0c46ef1..b1f34c3 100644
--- a/Documentation/nvme-format.1
+++ b/Documentation/nvme-format.1
@@ -2,12 +2,12 @@
.\" Title: nvme-format
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/08/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-FORMAT" "1" "01/08/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-FORMAT" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/Documentation/nvme-format.html b/Documentation/nvme-format.html
index bbf179f..11ccfef 100644
--- a/Documentation/nvme-format.html
+++ b/Documentation/nvme-format.html
@@ -1013,7 +1013,7 @@ information:
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2019-01-08 17:45:58 MST
+Last updated 2019-01-28 17:42:37 MST
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-clear-pcie-correctable-errors.1 b/Documentation/nvme-wdc-clear-pcie-correctable-errors.1
index 0dbe83c..565c8b1 100644
--- a/Documentation/nvme-wdc-clear-pcie-correctable-errors.1
+++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.1
@@ -2,12 +2,12 @@
.\" Title: nvme-wdc-clear-pcie-correctable-errors
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/11/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-WDC\-CLEAR\-PC" "1" "01/11/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-WDC\-CLEAR\-PC" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/Documentation/nvme-wdc-vs-smart-add-log.1 b/Documentation/nvme-wdc-vs-smart-add-log.1
index baf5e2c..eb72efe 100644
--- a/Documentation/nvme-wdc-vs-smart-add-log.1
+++ b/Documentation/nvme-wdc-vs-smart-add-log.1
@@ -2,12 +2,12 @@
.\" Title: nvme-wdc-vs-smart-add-log
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/11/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-WDC\-VS\-SMART" "1" "01/11/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-WDC\-VS\-SMART" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
--
2.13.7

View File

@ -1,57 +0,0 @@
From 239b44138378aaa33f474893767bd2566d36d3cf Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Date: Mon, 28 Jan 2019 23:12:02 -0800
Subject: [PATCH] nvme-cli: minor cleanup for submit_io()
This is a cleanup patch which adds errno based error messages when
write() failure, this also fixes minor typo and removes unnecessary
braces.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
[fixed typo in changelog, minor style code change]
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
nvme.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/nvme.c b/nvme.c
index 8922ec2..a6686dd 100644
--- a/nvme.c
+++ b/nvme.c
@@ -4245,7 +4245,7 @@ static int submit_io(int opcode, char *command, const char *desc,
dsmgmt |= ((__u32)cfg.dspec) << 16;
}
- if (strlen(cfg.data)){
+ if (strlen(cfg.data)) {
dfd = open(cfg.data, flags, mode);
if (dfd < 0) {
perror(cfg.data);
@@ -4254,7 +4254,7 @@ static int submit_io(int opcode, char *command, const char *desc,
}
mfd = dfd;
}
- if (strlen(cfg.metadata)){
+ if (strlen(cfg.metadata)) {
mfd = open(cfg.metadata, flags, mode);
if (mfd < 0) {
perror(cfg.metadata);
@@ -4347,11 +4347,13 @@ static int submit_io(int opcode, char *command, const char *desc,
printf("%s:%s(%04x)\n", command, nvme_status_to_string(err), err);
else {
if (!(opcode & 1) && write(dfd, (void *)buffer, cfg.data_size) < 0) {
- fprintf(stderr, "failed to write buffer to output file\n");
+ fprintf(stderr, "write: %s: failed to write buffer to output file\n",
+ strerror(errno));
err = EINVAL;
} else if (!(opcode & 1) && cfg.metadata_size &&
write(mfd, (void *)mbuffer, cfg.metadata_size) < 0) {
- fprintf(stderr, "failed to write meta-data buffer to output file\n");
+ fprintf(stderr, "write: %s: failed to write meta-data buffer to output file\n",
+ strerror(errno));
err = EINVAL;
} else
fprintf(stderr, "%s: Success\n", command);
--
2.13.7

View File

@ -1,32 +0,0 @@
From f3a97fdfe4367c0a0e5705ccf0c8cfb926e264cf Mon Sep 17 00:00:00 2001
From: Keith Busch <keith.busch@intel.com>
Date: Tue, 29 Jan 2019 08:50:52 -0700
Subject: [PATCH] Regen documentation
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
Documentation/nvme-create-ns.1 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/nvme-create-ns.1 b/Documentation/nvme-create-ns.1
index 8963b83..5f751a8 100644
--- a/Documentation/nvme-create-ns.1
+++ b/Documentation/nvme-create-ns.1
@@ -2,12 +2,12 @@
.\" Title: nvme-create-ns
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/28/2019
+.\" Date: 01/29/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-CREATE\-NS" "1" "01/28/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-CREATE\-NS" "1" "01/29/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
--
2.13.7

View File

@ -1,39 +0,0 @@
From 674bffd4ea12081a7da4e94432ffaf235eb2d22b Mon Sep 17 00:00:00 2001
From: James Smart <jsmart2021@gmail.com>
Date: Mon, 4 Feb 2019 13:39:54 -0800
Subject: [PATCH] nvme-cli: fix fc trtype string
Commit 55b4ec12ffe4
("fabrics: use trtype_str when parsing a discovery log entry")
changed to use the trtypes string names in a generic fashion for
the "transport=?" string passed in the connect string to the kernel.
For FC, this meant the hardcoding of "transport=fc" was removed and
the generic code would now create "transport=fibre-channel", which
doesn't match any transport name anymore once the string is attempted
to be matched in the kernel.
Change the string used by for trtype for FC to use "fc" to restore
operation.
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
fabrics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fabrics.c b/fabrics.c
index 594789b..f5cd212 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -98,7 +98,7 @@ static const char *arg_str(const char * const *strings,
static const char * const trtypes[] = {
[NVMF_TRTYPE_RDMA] = "rdma",
- [NVMF_TRTYPE_FC] = "fibre-channel",
+ [NVMF_TRTYPE_FC] = "fc",
[NVMF_TRTYPE_TCP] = "tcp",
[NVMF_TRTYPE_LOOP] = "loop",
};
--
2.13.7

View File

@ -1,435 +0,0 @@
From 70bfe077af40aeace6c9e2b628b20cf8a34c1def Mon Sep 17 00:00:00 2001
From: Martin George <marting@netapp.com>
Date: Mon, 1 Apr 2019 09:39:56 -0700
Subject: [PATCH] nvme-cli: add netapp ontapdevices command
Add a new ontapdevices command to the NetApp plugin for
NetApp ONTAP devices.
Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Steve Schremmer <sschremm@netapp.com>
---
plugins/netapp/netapp-nvme.c | 342 +++++++++++++++++++++++++++++++++++++++++++
plugins/netapp/netapp-nvme.h | 1 +
2 files changed, 343 insertions(+)
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
index 416e74e..2951311 100644
--- a/plugins/netapp/netapp-nvme.c
+++ b/plugins/netapp/netapp-nvme.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
+#include <sys/ioctl.h>
#include "nvme.h"
#include "nvme-ioctl.h"
@@ -31,12 +32,28 @@
#define CREATE_CMD
#include "netapp-nvme.h"
+#define ONTAP_C2_LOG_ID 0xC2
+#define ONTAP_C2_LOG_SIZE 4096
+#define ONTAP_LABEL_LEN 260
+#define ONTAP_NS_PATHLEN 520
+
enum {
NNORMAL,
NJSON,
NCOLUMN,
};
+enum {
+ ONTAP_C2_LOG_SUPPORTED_LSP = 0x0,
+ ONTAP_C2_LOG_NSINFO_LSP = 0x1,
+};
+
+enum {
+ ONTAP_VSERVER_TLV = 0x11,
+ ONTAP_VOLUME_TLV = 0x12,
+ ONTAP_NS_TLV = 0x13,
+};
+
static const char *dev_path = "/dev/";
struct smdevice_info {
@@ -46,6 +63,15 @@ struct smdevice_info {
char dev[265];
};
+struct ontapdevice_info {
+ int nsid;
+ struct nvme_id_ctrl ctrl;
+ struct nvme_id_ns ns;
+ char nsdesc[4096];
+ unsigned char log_data[ONTAP_C2_LOG_SIZE];
+ char dev[265];
+};
+
#define ARRAY_LABEL_LEN 60
#define VOLUME_LABEL_LEN 60
@@ -77,6 +103,100 @@ static void netapp_nguid_to_str(char *str, __u8 *nguid)
str += sprintf(str, "%02x", nguid[i]);
}
+static void netapp_get_ns_size(char *size, long long *lba,
+ struct nvme_id_ns *ns)
+{
+ *lba = 1 << ns->lbaf[(ns->flbas & 0x0F)].ds;
+ double nsze = le64_to_cpu(ns->nsze) * (*lba);
+ const char *s_suffix = suffix_si_get(&nsze);
+
+ sprintf(size, "%.2f%sB", nsze, s_suffix);
+}
+
+static void netapp_uuid_to_str(char *str, void *data)
+{
+#ifdef LIBUUID
+ uuid_t uuid;
+ struct nvme_ns_id_desc *desc = data;
+
+ memcpy(uuid, data + sizeof(*desc), 16);
+ uuid_unparse_lower(uuid, str);
+#endif
+}
+
+static void ontap_labels_to_str(char *dst, char *src, int count)
+{
+ int i;
+
+ memset(dst, 0, ONTAP_LABEL_LEN);
+ for (i = 0; i < count; i++) {
+ if (src[i] >= '!' && src[i] <= '~')
+ dst[i] = src[i];
+ else
+ break;
+ }
+ dst[i] = '\0';
+}
+
+static void netapp_get_ontap_labels(char *vsname, char *nspath,
+ unsigned char *log_data)
+{
+ int lsp, tlv, label_len;
+ char *vserver_name, *volume_name, *namespace_name;
+ char vol_name[ONTAP_LABEL_LEN], ns_name[ONTAP_LABEL_LEN];
+ const char *ontap_vol = "/vol/";
+ int i, j;
+
+ /* get the lsp */
+ lsp = (*(__u8 *)&log_data[16]) & 0x0F;
+ if (lsp != ONTAP_C2_LOG_NSINFO_LSP)
+ /* lsp not related to nsinfo */
+ return;
+
+ /* get the vserver tlv and name */
+ tlv = *(__u8 *)&log_data[32];
+ if (tlv == ONTAP_VSERVER_TLV) {
+ label_len = (*(__u16 *)&log_data[34]) * 4;
+ vserver_name = (char *)&log_data[36];
+ ontap_labels_to_str(vsname, vserver_name, label_len);
+ } else {
+ /* not the expected vserver tlv */
+ fprintf(stderr, "Unable to fetch ONTAP vserver name\n");
+ return;
+ }
+
+ i = 36 + label_len;
+ j = i + 2;
+ /* get the volume tlv and name */
+ tlv = *(__u8 *)&log_data[i];
+ if (tlv == ONTAP_VOLUME_TLV) {
+ label_len = (*(__u16 *)&log_data[j]) * 4;
+ volume_name = (char *)&log_data[j + 2];
+ ontap_labels_to_str(vol_name, volume_name, label_len);
+ } else {
+ /* not the expected volume tlv */
+ fprintf(stderr, "Unable to fetch ONTAP volume name\n");
+ return;
+ }
+
+ i += 4 + label_len;
+ j += 4 + label_len;
+ /* get the namespace tlv and name */
+ tlv = *(__u8 *)&log_data[i];
+ if (tlv == ONTAP_NS_TLV) {
+ label_len = (*(__u16 *)&log_data[j]) * 4;
+ namespace_name = (char *)&log_data[j + 2];
+ ontap_labels_to_str(ns_name, namespace_name, label_len);
+ } else {
+ /* not the expected namespace tlv */
+ fprintf(stderr, "Unable to fetch ONTAP namespace name\n");
+ return;
+ }
+
+ snprintf(nspath, ONTAP_NS_PATHLEN, "%s%s%s%s", ontap_vol,
+ vol_name, "/", ns_name);
+}
+
static void netapp_smdevice_json(struct json_array *devices, char *devname,
char *arrayname, char *volname, int nsid, char *nguid,
char *ctrl, char *astate, char *size, long long lba,
@@ -99,6 +219,25 @@ static void netapp_smdevice_json(struct json_array *devices, char *devname,
json_array_add_value_object(devices, device_attrs);
}
+static void netapp_ontapdevice_json(struct json_array *devices, char *devname,
+ char *vsname, char *nspath, int nsid, char *uuid,
+ char *size, long long lba, long long nsze)
+{
+ struct json_object *device_attrs;
+
+ device_attrs = json_create_object();
+ json_object_add_value_string(device_attrs, "Device", devname);
+ json_object_add_value_string(device_attrs, "Vserver", vsname);
+ json_object_add_value_string(device_attrs, "Namespace_Path", nspath);
+ json_object_add_value_int(device_attrs, "NSID", nsid);
+ json_object_add_value_string(device_attrs, "UUID", uuid);
+ json_object_add_value_string(device_attrs, "Size", size);
+ json_object_add_value_int(device_attrs, "LBA_Data_Size", lba);
+ json_object_add_value_int(device_attrs, "Namespace_Size", nsze);
+
+ json_array_add_value_object(devices, device_attrs);
+}
+
static void netapp_smdevices_print(struct smdevice_info *devices, int count, int format)
{
struct json_object *root = NULL;
@@ -161,6 +300,94 @@ static void netapp_smdevices_print(struct smdevice_info *devices, int count, int
}
}
+static void netapp_ontapdevices_print(struct ontapdevice_info *devices,
+ int count, int format)
+{
+ struct json_object *root = NULL;
+ struct json_array *json_devices = NULL;
+ char vsname[ONTAP_LABEL_LEN] = " ";
+ char nspath[ONTAP_NS_PATHLEN] = " ";
+ long long lba;
+ char size[128];
+ char uuid_str[37] = " ";
+ int i;
+
+ char basestr[] = "%s, Vserver %s, Namespace Path %s, NSID %d, UUID %s, %s\n";
+ char columnstr[] = "%-16s %-25s %-50s %-4d %-38s %-9s\n";
+
+ /* default to 'normal' output format */
+ char *formatstr = basestr;
+
+ if (format == NCOLUMN) {
+ /* change output string and print column headers */
+ formatstr = columnstr;
+ printf("%-16s %-25s %-50s %-4s %-38s %-9s\n",
+ "Device", "Vserver", "Namespace Path",
+ "NSID", "UUID", "Size");
+ printf("%-16s %-25s %-50s %-4s %-38s %-9s\n",
+ "----------------", "-------------------------",
+ "--------------------------------------------------",
+ "----", "--------------------------------------",
+ "---------");
+ } else if (format == NJSON) {
+ /* prepare for json output */
+ root = json_create_object();
+ json_devices = json_create_array();
+ }
+
+ for (i = 0; i < count; i++) {
+
+ netapp_get_ns_size(size, &lba, &devices[i].ns);
+ netapp_uuid_to_str(uuid_str, devices[i].nsdesc);
+ netapp_get_ontap_labels(vsname, nspath, devices[i].log_data);
+
+ if (format == NJSON) {
+ netapp_ontapdevice_json(json_devices, devices[i].dev,
+ vsname, nspath, devices[i].nsid,
+ uuid_str, size, lba,
+ le64_to_cpu(devices[i].ns.nsze));
+ } else
+ printf(formatstr, devices[i].dev, vsname, nspath,
+ devices[i].nsid, uuid_str, size);
+ }
+
+ if (format == NJSON) {
+ /* complete the json output */
+ json_object_add_value_array(root, "ONTAPdevices", json_devices);
+ json_print_object(root, NULL);
+ }
+}
+
+static int nvme_get_ontap_c2_log(int fd, __u32 nsid, void *buf, __u32 buflen)
+{
+ struct nvme_admin_cmd get_log;
+ int err;
+
+ memset(buf, 0, buflen);
+ memset(&get_log, 0, sizeof(struct nvme_admin_cmd));
+
+ get_log.opcode = nvme_admin_get_log_page;
+ get_log.nsid = nsid;
+ get_log.addr = (__u64)(uintptr_t)buf;
+ get_log.data_len = buflen;
+
+ __u32 numd = (get_log.data_len >> 2) - 1;
+ __u32 numdu = numd >> 16;
+ __u32 numdl = numd & 0xFFFF;
+
+ get_log.cdw10 = ONTAP_C2_LOG_ID | (numdl << 16);
+ get_log.cdw10 |= ONTAP_C2_LOG_NSINFO_LSP << 8;
+ get_log.cdw11 = numdu;
+
+ err = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &get_log);
+ if (err) {
+ fprintf(stderr, "ioctl error %0x\n", err);
+ return 1;
+ }
+
+ return 0;
+}
+
static int netapp_smdevices_get_info(int fd, struct smdevice_info *item,
const char *dev)
{
@@ -188,6 +415,50 @@ static int netapp_smdevices_get_info(int fd, struct smdevice_info *item,
return 1;
}
+static int netapp_ontapdevices_get_info(int fd, struct ontapdevice_info *item,
+ const char *dev)
+{
+ int err;
+
+ err = nvme_identify_ctrl(fd, &item->ctrl);
+ if (err) {
+ fprintf(stderr, "Identify Controller failed to %s (%s)\n",
+ dev, strerror(err));
+ return 0;
+ }
+
+ if (strncmp("NetApp ONTAP Controller", item->ctrl.mn, 23) != 0)
+ /* not the right controller model */
+ return 0;
+
+ item->nsid = nvme_get_nsid(fd);
+
+ err = nvme_identify_ns(fd, item->nsid, 0, &item->ns);
+ if (err) {
+ fprintf(stderr, "Unable to identify namespace for %s (%s)\n",
+ dev, strerror(err));
+ return 0;
+ }
+
+ err = nvme_identify_ns_descs(fd, item->nsid, item->nsdesc);
+ if (err) {
+ fprintf(stderr, "Unable to identify namespace descriptor for %s (%s)\n",
+ dev, strerror(err));
+ return 0;
+ }
+
+ err = nvme_get_ontap_c2_log(fd, item->nsid, item->log_data, ONTAP_C2_LOG_SIZE);
+ if (err) {
+ fprintf(stderr, "Unable to get log page data for %s (%s)\n",
+ dev, strerror(err));
+ return 0;
+ }
+
+ strncpy(item->dev, dev, sizeof(item->dev));
+
+ return 1;
+}
+
static int netapp_nvme_filter(const struct dirent *d)
{
char path[264];
@@ -294,3 +565,74 @@ static int netapp_smdevices(int argc, char **argv, struct command *command,
free(smdevices);
return 0;
}
+
+/* handler for 'nvme netapp ontapdevices' */
+static int netapp_ontapdevices(int argc, char **argv, struct command *command,
+ struct plugin *plugin)
+{
+ const char *desc = "Display information about ONTAP devices.";
+ struct config {
+ char *output_format;
+ };
+ struct config cfg = {
+ .output_format = "normal",
+ };
+ struct dirent **devices;
+ int num, i, fd, ret, fmt;
+ struct ontapdevice_info *ontapdevices;
+ char path[264];
+ int num_ontapdevices = 0;
+
+ const struct argconfig_commandline_options opts[] = {
+ {"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format,
+ required_argument, "Output Format: normal|json|column"},
+ {NULL}
+ };
+
+ ret = argconfig_parse(argc, argv, desc, opts, &cfg, sizeof(cfg));
+ if (ret < 0)
+ return ret;
+
+ fmt = netapp_output_format(cfg.output_format);
+ if (fmt != NNORMAL && fmt != NCOLUMN && fmt != NJSON) {
+ fprintf(stderr, "Unrecognized output format: %s\n", cfg.output_format);
+ return -EINVAL;
+ }
+
+ num = scandir(dev_path, &devices, netapp_nvme_filter, alphasort);
+ if (num <= 0) {
+ fprintf(stderr, "No NVMe devices detected.\n");
+ return num;
+ }
+
+ ontapdevices = calloc(num, sizeof(*ontapdevices));
+ if (!ontapdevices) {
+ fprintf(stderr, "Unable to allocate memory for devices.\n");
+ return -ENOMEM;
+ }
+
+ for (i = 0; i < num; i++) {
+ snprintf(path, sizeof(path), "%s%s", dev_path,
+ devices[i]->d_name);
+ fd = open(path, O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "Unable to open %s: %s\n", path,
+ strerror(errno));
+ continue;
+ }
+
+ num_ontapdevices += netapp_ontapdevices_get_info(fd,
+ &ontapdevices[num_ontapdevices], path);
+
+ close(fd);
+ }
+
+ if (num_ontapdevices)
+ netapp_ontapdevices_print(ontapdevices, num_ontapdevices, fmt);
+
+ for (i = 0; i < num; i++)
+ free(devices[i]);
+ free(devices);
+ free(ontapdevices);
+ return 0;
+}
diff --git a/plugins/netapp/netapp-nvme.h b/plugins/netapp/netapp-nvme.h
index 3dd019e..d4eebd6 100644
--- a/plugins/netapp/netapp-nvme.h
+++ b/plugins/netapp/netapp-nvme.h
@@ -9,6 +9,7 @@
PLUGIN(NAME("netapp", "NetApp vendor specific extensions"),
COMMAND_LIST(
ENTRY("smdevices", "NetApp SMdevices", netapp_smdevices)
+ ENTRY("ontapdevices", "NetApp ONTAPdevices", netapp_ontapdevices)
)
);
--
2.16.4

View File

@ -1,960 +0,0 @@
From 8f963b85132074f370e5f1e8318890fdbbf605b4 Mon Sep 17 00:00:00 2001
From: Martin George <marting@netapp.com>
Date: Mon, 1 Apr 2019 09:39:57 -0700
Subject: [PATCH] nvme-cli: add netapp ontapdevices man page
Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Steve Schremmer <sschremm@netapp.com>
---
Documentation/nvme-netapp-ontapdevices.1 | 74 +++
Documentation/nvme-netapp-ontapdevices.html | 814 ++++++++++++++++++++++++++++
Documentation/nvme-netapp-ontapdevices.txt | 35 ++
3 files changed, 923 insertions(+)
create mode 100644 Documentation/nvme-netapp-ontapdevices.1
create mode 100644 Documentation/nvme-netapp-ontapdevices.html
create mode 100644 Documentation/nvme-netapp-ontapdevices.txt
diff --git a/Documentation/nvme-netapp-ontapdevices.1 b/Documentation/nvme-netapp-ontapdevices.1
new file mode 100644
index 0000000..0669457
--- /dev/null
+++ b/Documentation/nvme-netapp-ontapdevices.1
@@ -0,0 +1,74 @@
+'\" t
+.\" Title: nvme-netapp-ontapdevices
+.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\" Date: 01/08/2019
+.\" Manual: NVMe Manual
+.\" Source: NVMe
+.\" Language: English
+.\"
+.TH "NVME\-NETAPP\-ONTAPDEV" "1" "01/08/2019" "NVMe" "NVMe Manual"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+nvme-netapp-ontapdevices \- Display information about ONTAP devices
+.SH "SYNOPSIS"
+.sp
+.nf
+\fInvme netapp ontapdevices\fR [\-o <fmt> | \-\-output\-format=<fmt>]
+.fi
+.SH "DESCRIPTION"
+.sp
+Display information about ONTAP devices on the host\&. The ONTAP devices are identified using the Identify Controller data\&.
+.SH "OPTIONS"
+.PP
+\-o <fmt>, \-\-output\-format=<fmt>
+.RS 4
+Set the reporting format to
+\fInormal\fR
+(default),
+\fIcolumn\fR, or
+\fIjson\fR\&. Only one output format can be used at a time\&.
+.RE
+.SH "EXAMPLES"
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Display information, in a column\-based format, for ONTAP devices\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+# nvme netapp ontapdevices \-o column
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SH "NVME"
+.sp
+Part of the nvme\-user suite
diff --git a/Documentation/nvme-netapp-ontapdevices.html b/Documentation/nvme-netapp-ontapdevices.html
new file mode 100644
index 0000000..06ad9fb
--- /dev/null
+++ b/Documentation/nvme-netapp-ontapdevices.html
@@ -0,0 +1,814 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.10" />
+<title>nvme-netapp-ontapdevices(1)</title>
+<style type="text/css">
+/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
+
+/* Default font. */
+body {
+ font-family: Georgia,serif;
+}
+
+/* Title font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+#toctitle,
+#author, #revnumber, #revdate, #revremark,
+#footer {
+ font-family: Arial,Helvetica,sans-serif;
+}
+
+body {
+ margin: 1em 5% 1em 5%;
+}
+
+a {
+ color: blue;
+ text-decoration: underline;
+}
+a:visited {
+ color: fuchsia;
+}
+
+em {
+ font-style: italic;
+ color: navy;
+}
+
+strong {
+ font-weight: bold;
+ color: #083194;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #527bbd;
+ margin-top: 1.2em;
+ margin-bottom: 0.5em;
+ line-height: 1.3;
+}
+
+h1, h2, h3 {
+ border-bottom: 2px solid silver;
+}
+h2 {
+ padding-top: 0.5em;
+}
+h3 {
+ float: left;
+}
+h3 + * {
+ clear: left;
+}
+h5 {
+ font-size: 1.0em;
+}
+
+div.sectionbody {
+ margin-left: 0;
+}
+
+hr {
+ border: 1px solid silver;
+}
+
+p {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+ margin-top: 0;
+}
+ul > li { color: #aaa; }
+ul > li > * { color: black; }
+
+.monospaced, code, pre {
+ font-family: "Courier New", Courier, monospace;
+ font-size: inherit;
+ color: navy;
+ padding: 0;
+ margin: 0;
+}
+pre {
+ white-space: pre-wrap;
+}
+
+#author {
+ color: #527bbd;
+ font-weight: bold;
+ font-size: 1.1em;
+}
+#email {
+}
+#revnumber, #revdate, #revremark {
+}
+
+#footer {
+ font-size: small;
+ border-top: 2px solid silver;
+ padding-top: 0.5em;
+ margin-top: 4.0em;
+}
+#footer-text {
+ float: left;
+ padding-bottom: 0.5em;
+}
+#footer-badges {
+ float: right;
+ padding-bottom: 0.5em;
+}
+
+#preamble {
+ margin-top: 1.5em;
+ margin-bottom: 1.5em;
+}
+div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+ margin-top: 1.0em;
+ margin-bottom: 1.5em;
+}
+div.admonitionblock {
+ margin-top: 2.0em;
+ margin-bottom: 2.0em;
+ margin-right: 10%;
+ color: #606060;
+}
+
+div.content { /* Block element content. */
+ padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+ color: #527bbd;
+ font-weight: bold;
+ text-align: left;
+ margin-top: 1.0em;
+ margin-bottom: 0.5em;
+}
+div.title + * {
+ margin-top: 0;
+}
+
+td div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content + div.title {
+ margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+ background: #ffffee;
+ border: 1px solid #dddddd;
+ border-left: 4px solid #f0f0f0;
+ padding: 0.5em;
+}
+
+div.listingblock > div.content {
+ border: 1px solid #dddddd;
+ border-left: 5px solid #f0f0f0;
+ background: #f8f8f8;
+ padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+ padding-left: 1.0em;
+ margin-left: 1.0em;
+ margin-right: 10%;
+ border-left: 5px solid #f0f0f0;
+ color: #888;
+}
+
+div.quoteblock > div.attribution {
+ padding-top: 0.5em;
+ text-align: right;
+}
+
+div.verseblock > pre.content {
+ font-family: inherit;
+ font-size: inherit;
+}
+div.verseblock > div.attribution {
+ padding-top: 0.75em;
+ text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+ text-align: left;
+}
+
+div.admonitionblock .icon {
+ vertical-align: top;
+ font-size: 1.1em;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #527bbd;
+ padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+ padding-left: 0.5em;
+ border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+ border-left: 3px solid #dddddd;
+ padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; vertical-align: text-bottom; }
+a.image:visited { color: white; }
+
+dl {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+dt {
+ margin-top: 0.5em;
+ margin-bottom: 0;
+ font-style: normal;
+ color: navy;
+}
+dd > *:first-child {
+ margin-top: 0.1em;
+}
+
+ul, ol {
+ list-style-position: outside;
+}
+ol.arabic {
+ list-style-type: decimal;
+}
+ol.loweralpha {
+ list-style-type: lower-alpha;
+}
+ol.upperalpha {
+ list-style-type: upper-alpha;
+}
+ol.lowerroman {
+ list-style-type: lower-roman;
+}
+ol.upperroman {
+ list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+ margin-top: 0.1em;
+ margin-bottom: 0.1em;
+}
+
+tfoot {
+ font-weight: bold;
+}
+td > div.verse {
+ white-space: pre;
+}
+
+div.hdlist {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+div.hdlist tr {
+ padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+ font-weight: bold;
+}
+td.hdlist1 {
+ vertical-align: top;
+ font-style: normal;
+ padding-right: 0.8em;
+ color: navy;
+}
+td.hdlist2 {
+ vertical-align: top;
+}
+div.hdlist.compact tr {
+ margin: 0;
+ padding-bottom: 0;
+}
+
+.comment {
+ background: yellow;
+}
+
+.footnote, .footnoteref {
+ font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+ vertical-align: super;
+}
+
+#footnotes {
+ margin: 20px 0 20px 0;
+ padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+ margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+ border: none;
+ border-top: 1px solid silver;
+ height: 1px;
+ text-align: left;
+ margin-left: 0;
+ width: 20%;
+ min-width: 100px;
+}
+
+div.colist td {
+ padding-right: 0.5em;
+ padding-bottom: 0.3em;
+ vertical-align: top;
+}
+div.colist td img {
+ margin-top: 0.3em;
+}
+
+@media print {
+ #footer-badges { display: none; }
+}
+
+#toc {
+ margin-bottom: 2.5em;
+}
+
+#toctitle {
+ color: #527bbd;
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 1.0em;
+ margin-bottom: 0.1em;
+}
+
+div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+div.toclevel2 {
+ margin-left: 2em;
+ font-size: 0.9em;
+}
+div.toclevel3 {
+ margin-left: 4em;
+ font-size: 0.9em;
+}
+div.toclevel4 {
+ margin-left: 6em;
+ font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+
+span.underline { text-decoration: underline; }
+span.overline { text-decoration: overline; }
+span.line-through { text-decoration: line-through; }
+
+div.unbreakable { page-break-inside: avoid; }
+
+
+/*
+ * xhtml11 specific
+ *
+ * */
+
+div.tableblock {
+ margin-top: 1.0em;
+ margin-bottom: 1.5em;
+}
+div.tableblock > table {
+ border: 3px solid #527bbd;
+}
+thead, p.table.header {
+ font-weight: bold;
+ color: #527bbd;
+}
+p.table {
+ margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+ border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+ border-left-style: none;
+ border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+ border-top-style: none;
+ border-bottom-style: none;
+}
+
+
+/*
+ * html5 specific
+ *
+ * */
+
+table.tableblock {
+ margin-top: 1.0em;
+ margin-bottom: 1.5em;
+}
+thead, p.tableblock.header {
+ font-weight: bold;
+ color: #527bbd;
+}
+p.tableblock {
+ margin-top: 0;
+}
+table.tableblock {
+ border-width: 3px;
+ border-spacing: 0px;
+ border-style: solid;
+ border-color: #527bbd;
+ border-collapse: collapse;
+}
+th.tableblock, td.tableblock {
+ border-width: 1px;
+ padding: 4px;
+ border-style: solid;
+ border-color: #527bbd;
+}
+
+table.tableblock.frame-topbot {
+ border-left-style: hidden;
+ border-right-style: hidden;
+}
+table.tableblock.frame-sides {
+ border-top-style: hidden;
+ border-bottom-style: hidden;
+}
+table.tableblock.frame-none {
+ border-style: hidden;
+}
+
+th.tableblock.halign-left, td.tableblock.halign-left {
+ text-align: left;
+}
+th.tableblock.halign-center, td.tableblock.halign-center {
+ text-align: center;
+}
+th.tableblock.halign-right, td.tableblock.halign-right {
+ text-align: right;
+}
+
+th.tableblock.valign-top, td.tableblock.valign-top {
+ vertical-align: top;
+}
+th.tableblock.valign-middle, td.tableblock.valign-middle {
+ vertical-align: middle;
+}
+th.tableblock.valign-bottom, td.tableblock.valign-bottom {
+ vertical-align: bottom;
+}
+
+
+/*
+ * manpage specific
+ *
+ * */
+
+body.manpage h1 {
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
+ border-top: 2px solid silver;
+ border-bottom: 2px solid silver;
+}
+body.manpage h2 {
+ border-style: none;
+}
+body.manpage div.sectionbody {
+ margin-left: 3em;
+}
+
+@media print {
+ body.manpage div#toc { display: none; }
+}
+
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+var asciidoc = { // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+ function getText(el) {
+ var text = "";
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+ text += i.data;
+ else if (i.firstChild != null)
+ text += getText(i);
+ }
+ return text;
+ }
+
+ function TocEntry(el, text, toclevel) {
+ this.element = el;
+ this.text = text;
+ this.toclevel = toclevel;
+ }
+
+ function tocEntries(el, toclevels) {
+ var result = new Array;
+ var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
+ // Function that scans the DOM tree for header elements (the DOM2
+ // nodeIterator API would be a better technique but not supported by all
+ // browsers).
+ var iterate = function (el) {
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+ var mo = re.exec(i.tagName);
+ if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+ result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+ }
+ iterate(i);
+ }
+ }
+ }
+ iterate(el);
+ return result;
+ }
+
+ var toc = document.getElementById("toc");
+ if (!toc) {
+ return;
+ }
+
+ // Delete existing TOC entries in case we're reloading the TOC.
+ var tocEntriesToRemove = [];
+ var i;
+ for (i = 0; i < toc.childNodes.length; i++) {
+ var entry = toc.childNodes[i];
+ if (entry.nodeName.toLowerCase() == 'div'
+ && entry.getAttribute("class")
+ && entry.getAttribute("class").match(/^toclevel/))
+ tocEntriesToRemove.push(entry);
+ }
+ for (i = 0; i < tocEntriesToRemove.length; i++) {
+ toc.removeChild(tocEntriesToRemove[i]);
+ }
+
+ // Rebuild TOC entries.
+ var entries = tocEntries(document.getElementById("content"), toclevels);
+ for (var i = 0; i < entries.length; ++i) {
+ var entry = entries[i];
+ if (entry.element.id == "")
+ entry.element.id = "_toc_" + i;
+ var a = document.createElement("a");
+ a.href = "#" + entry.element.id;
+ a.appendChild(document.createTextNode(entry.text));
+ var div = document.createElement("div");
+ div.appendChild(a);
+ div.className = "toclevel" + entry.toclevel;
+ toc.appendChild(div);
+ }
+ if (entries.length == 0)
+ toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+ // Delete existing footnote entries in case we're reloading the footnodes.
+ var i;
+ var noteholder = document.getElementById("footnotes");
+ if (!noteholder) {
+ return;
+ }
+ var entriesToRemove = [];
+ for (i = 0; i < noteholder.childNodes.length; i++) {
+ var entry = noteholder.childNodes[i];
+ if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
+ entriesToRemove.push(entry);
+ }
+ for (i = 0; i < entriesToRemove.length; i++) {
+ noteholder.removeChild(entriesToRemove[i]);
+ }
+
+ // Rebuild footnote entries.
+ var cont = document.getElementById("content");
+ var spans = cont.getElementsByTagName("span");
+ var refs = {};
+ var n = 0;
+ for (i=0; i<spans.length; i++) {
+ if (spans[i].className == "footnote") {
+ n++;
+ var note = spans[i].getAttribute("data-note");
+ if (!note) {
+ // Use [\s\S] in place of . so multi-line matches work.
+ // Because JavaScript has no s (dotall) regex flag.
+ note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+ spans[i].innerHTML =
+ "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]";
+ spans[i].setAttribute("data-note", note);
+ }
+ noteholder.innerHTML +=
+ "<div class='footnote' id='_footnote_" + n + "'>" +
+ "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+ n + "</a>. " + note + "</div>";
+ var id =spans[i].getAttribute("id");
+ if (id != null) refs["#"+id] = n;
+ }
+ }
+ if (n == 0)
+ noteholder.parentNode.removeChild(noteholder);
+ else {
+ // Process footnoterefs.
+ for (i=0; i<spans.length; i++) {
+ if (spans[i].className == "footnoteref") {
+ var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+ href = href.match(/#.*/)[0]; // Because IE return full URL.
+ n = refs[href];
+ spans[i].innerHTML =
+ "[<a href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]";
+ }
+ }
+ }
+},
+
+install: function(toclevels) {
+ var timerId;
+
+ function reinstall() {
+ asciidoc.footnotes();
+ if (toclevels) {
+ asciidoc.toc(toclevels);
+ }
+ }
+
+ function reinstallAndRemoveTimer() {
+ clearInterval(timerId);
+ reinstall();
+ }
+
+ timerId = setInterval(reinstall, 500);
+ if (document.addEventListener)
+ document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
+ else
+ window.onload = reinstallAndRemoveTimer;
+}
+
+}
+asciidoc.install();
+/*]]>*/
+</script>
+</head>
+<body class="manpage">
+<div id="header">
+<h1>
+nvme-netapp-ontapdevices(1) Manual Page
+</h1>
+<h2>NAME</h2>
+<div class="sectionbody">
+<p>nvme-netapp-ontapdevices -
+ Display information about ONTAP devices
+</p>
+</div>
+</div>
+<div id="content">
+<div class="sect1">
+<h2 id="_synopsis">SYNOPSIS</h2>
+<div class="sectionbody">
+<div class="verseblock">
+<pre class="content"><em>nvme netapp ontapdevices</em> [-o &lt;fmt&gt; | --output-format=&lt;fmt&gt;]</pre>
+<div class="attribution">
+</div></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_description">DESCRIPTION</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Display information about ONTAP devices on the host.
+The ONTAP devices are identified using the Identify Controller data.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_options">OPTIONS</h2>
+<div class="sectionbody">
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o &lt;fmt&gt;
+</dt>
+<dt class="hdlist1">
+--output-format=&lt;fmt&gt;
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em> (default), <em>column</em>, or
+ <em>json</em>. Only one output format can be used at a time.
+</p>
+</dd>
+</dl></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_examples">EXAMPLES</h2>
+<div class="sectionbody">
+<div class="ulist"><ul>
+<li>
+<p>
+Display information, in a column-based format, for ONTAP devices.
+</p>
+<div class="listingblock">
+<div class="content">
+<pre><code># nvme netapp ontapdevices -o column</code></pre>
+</div></div>
+</li>
+</ul></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_nvme">NVME</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Part of the nvme-user suite</p></div>
+</div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated
+ 2018-11-29 13:36:56 GMT
+</div>
+</div>
+</body>
+</html>
diff --git a/Documentation/nvme-netapp-ontapdevices.txt b/Documentation/nvme-netapp-ontapdevices.txt
new file mode 100644
index 0000000..09369f1
--- /dev/null
+++ b/Documentation/nvme-netapp-ontapdevices.txt
@@ -0,0 +1,35 @@
+nvme-netapp-ontapdevices(1)
+========================
+
+NAME
+----
+nvme-netapp-ontapdevices - Display information about ONTAP devices
+
+SYNOPSIS
+--------
+[verse]
+'nvme netapp ontapdevices' [-o <fmt> | --output-format=<fmt>]
+
+DESCRIPTION
+-----------
+Display information about ONTAP devices on the host. The ONTAP devices are
+are identified using the Identify Controller data.
+
+OPTIONS
+-------
+-o <fmt>::
+--output-format=<fmt>::
+ Set the reporting format to 'normal' (default), 'column', or
+ 'json'. Only one output format can be used at a time.
+
+EXAMPLES
+--------
+* Display information, in a column-based format, for ONTAP devices.
++
+------------
+# nvme netapp ontapdevices -o column
+------------
+
+NVME
+----
+Part of the nvme-user suite
--
2.16.4

View File

@ -1,49 +0,0 @@
From 4a6c247971ce8e7a4af7f976be8906c907ef13cf Mon Sep 17 00:00:00 2001
From: James Smart <jsmart2021@gmail.com>
Date: Tue, 9 Apr 2019 13:51:54 -0700
Subject: [PATCH] nvme-cli: Revert stop-on-failure with connect-all
The patch that added special treatment for EALREADY connect failures
also changed the behavior on what happens if a discovery log contains
an entry that is not connectable by the system or host port. If it
encounters a log entry that can't be connected to, it will not attempt
to connect to any log entries beyond it. This can leave lots of devices
unconnected to.
Revert the stop-on-failure introduced by the previous patch.
Specifically, this failed for me on an FC array that had a discovery log
entry for a port that was not visible via zoning for the initiator
port being used.
Fixes: 1a922e0e121d7 ("connect-all: special treatment to EALREADY afetr write to /dev/nvme-fabrics"
Signed-off-by: James Smart <jsmart2021@gmail.com>
CC: Eyal Ben David <eyalbe@il.ibm.com>
CC: Martin George <Martin.George@netapp.com>
---
fabrics.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fabrics.c b/fabrics.c
index 2b08be5..aad399d 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -817,9 +817,12 @@ static int connect_ctrls(struct nvmf_disc_rsp_page_hdr *log, int numrec)
continue;
}
- /* otherwise error */
- ret = -instance;
- break;
+ /*
+ * don't error out. The Discovery Log may contain
+ * devices that aren't necessarily connectable via
+ * the system/host transport port. Let those items
+ * fail and continue on to the next log element.
+ */
}
return ret;
--
2.16.4

View File

@ -1,37 +0,0 @@
From 711762f31494772a0e7f08499e1b2992836e66e5 Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Thu, 11 Apr 2019 10:52:14 +0200
Subject: [PATCH] nvme-cli: Fix documentation syntax and typo
Both changes are already upstream or sent upstream.
Commit of Keith Busch: 5a7ccf9d
Co-authored-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Simon Schricker <sschricker@suse.de>
---
Documentation/nvme-netapp-ontapdevices.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/nvme-netapp-ontapdevices.txt b/Documentation/nvme-netapp-ontapdevices.txt
index 09369f1..c292758 100644
--- a/Documentation/nvme-netapp-ontapdevices.txt
+++ b/Documentation/nvme-netapp-ontapdevices.txt
@@ -1,5 +1,5 @@
nvme-netapp-ontapdevices(1)
-========================
+===========================
NAME
----
@@ -13,7 +13,7 @@ SYNOPSIS
DESCRIPTION
-----------
Display information about ONTAP devices on the host. The ONTAP devices are
-are identified using the Identify Controller data.
+identified using the Identify Controller data.
OPTIONS
-------
--
2.16.4

View File

@ -1,18 +1,17 @@
<services>
<service name="tar_scm" mode="disabled">
<service mode="disabled" name="obs_scm">
<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">1.7</param>
<param name="revision">v1.7</param>
<param name="exclude">.git</param>
<param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@.%h</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="versionrewrite-replacement">\1</param>
<param name="revision">master</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<service mode="disabled" name="tar"/>
<service mode="disabled" name="recompress">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled">
<param name="basename">nvme-cli</param>
<param name="compression">xz</param>
</service>
<service mode="disabled" name="set_version"/>
</services>

View File

@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/linux-nvme/nvme-cli.git</param>
<param name="changesrevision">4704680580b24cd7ea399e9ac679839d0414c1c9</param></service></servicedata>
<service name="obs_scm">
<param name="url">https://github.com/linux-nvme/nvme-cli.git</param>
<param name="changesrevision">75800fff4a17f6d97ef884772b88a2dfbd84251a</param></service></servicedata>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:483a2f2921e1762f790101b08002dab72480661cef5a543a1c34a54ea53ef585
size 387155

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba0ae34e20227b0eb477edea284252ffa560306c033cd6775bd5c26bc61c127e
size 228972

View File

@ -1,3 +1,106 @@
-------------------------------------------------------------------
Thu May 9 15:19:44 UTC 2019 - Simon Schricker <sschricker@suse.com>
- Update to version 1.8.1+git41.2c43c51:
* nvme-print: remove Virtual Management support from ONCS
* nvme-print: update self-test log to include 'aborted due to
sanitize'
* move to DocBook 5
* nvme-cli: add missing endianness conversions for telemetry log
page
* property: Fit print size for a property
* Add Disable IO flag to wdc_dump_dui_data function
* Reorder primary commands
* nvme-cli: add identify secondary controller list
* sanitize/get-telemetry-log: Print nvme status in case ret > 0
* print: Introduce show_nvme_status to print nvme status
* ioctl: Fix wrong return case of get_property
* ioctl: Fix double-free in a loop of get_property
* improved Documentation
* fix compilation with GCC-8
* fix CFLAGS parameter
* nvme-cli: fix compilation with uint64_t cast
* nvme-cli: minor cleanup for submit_io()
* nvme-cli: align all the macros
* wdc: Change device capability checking
* wdc: Add additional device for vs-internal-log
* wdc: Add device unit info log extraction
* wdc: Add get drive status command
* wdc: Add clear assert dump status command
* wdc: Add drive resize command
* wdc: Update device capabilities for clear pcie corr
* wdc: Update file parameter checking
* wdc: Add command to extract NAND statistics
* wdc: Add data area extraction for DUI command
* wdc: Additional device capabilities check
* nvme-cli: fix fc trtype string
* NVMe-CLI WDC Plugin - add support for additional SN840 device ID.
* WDC plugin Change vs-internal-log Command to Save Partial E6 Log Data.
* WDC Plugins vs-internal-log command unsupported on SN340.
* Fix print format specifiers
* Fix format block size usage
* Add reporting of Virtual Management support to id-ctrl
* Fix possible NULL pointer dereferences
* Fix possible memory leak on get-internal-log
* Print timestamp as a date and time string
* nvme-cli: add netapp ontapdevices command
* Add FreeBSD installation instructions
* Adding a helper to format command
* fabrics: Return negative errno when asprintf() fails
* fabrics: Return negative errno to check remove_ctrl() is failed
* nvme: Support raw_binary and json format for show-regs
* ioctl: Free memory if get_property for fabrics failed
* nvme: Use ARRAY_SIZE() macro in common.h
* nvme: Unify min(), max() macro as a common one
* nvme: Simplify description for virt-mgmt
* nvme: Simplify virt-mgmt options to lowercase
* nvme-print: Fix evaluation of ctratt on pretty print
* nvme: print I/O error to stderr
- Drop obsolete patches:
- 0001-wdc-Change-device-capability-checking.patch
- 0002-wdc-Add-additional-device-for-vs-internal-log.patch
- 0003-generate-new-documentation.patch
- 0004-Fix-compilation-with-GCC-8.patch
- 0005-Fix-CFLAGS-parameter.patch
- 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch
- 0007-Regen-docs.patch
- 0008-nvme-cli-minor-cleanup-for-submit_io.patch
- 0009-Regen-documentation.patch
- 0010-nvme-cli-fix-fc-trtype-string.patch
- 0011-nvme-cli-add-netapp-ontapdevices-command.patch
- 0012-nvme-cli-add-netapp-ontapdevices-man-page.patch
- 0013-nvme-cli-Revert-stop-on-failure-with-connect-all.patch
- 0014-nvme-cli-Increase-size-of-ONTAP-namespace-path-varia.patch
- 0015-DOC-Move-to-DocBook-5-when-using-asciidoctor.patch
- 0104-nvme-cli-Fix-documentation-syntax-and-typo.patch
- Rename downstream patch:
+ 0001-nvme_fc-auto-connect-scripts.patch
+ 0002-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
+ 0003-Add-nvmefc-connect.target.patch
+ 0004-Change-service-to-type-simple.patch
+ 0005-nvme-cli-Check-for-sysfs-interface-before-NVMe-disco.patch
- 0100-nvme_fc-auto-connect-scripts.patch
- 0101-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
- 0102-Add-nvmefc-connect.target.patch
- 0103-Change-service-to-type-simple.patch
- 0105-nvme-cli-Check-for-sysfs-interface-before-NVMe-disco.patch
-------------------------------------------------------------------
Wed May 8 16:04:34 UTC 2019 - Dominique Leuenberger <dimstar@opensuse.org>
- No longer convert via obsolete DocBook 4.5 format, but rather via
DocBook 5.x. This due to asciidoctor 2.x no longer supporting
DocBook 4.x
+ 0015-DOC-Move-to-DocBook-5-when-using-asciidoctor.patch
-------------------------------------------------------------------
Mon May 6 12:34:32 UTC 2019 - Simon Schricker <sschricker@suse.com>
- Increase size of ONTAP namespace path variable
+ 0014-nvme-cli-Increase-size-of-ONTAP-namespace-path-varia.patch
- Fix failing service on devices without fc-hardware (bsc#1133594)
+ 0105-nvme-cli-Check-for-sysfs-interface-before-NVMe-disco.patch
-------------------------------------------------------------------
Fri Apr 12 08:45:04 UTC 2019 - Simon Schricker <sschricker@suse.com>

View File

@ -12,37 +12,25 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: nvme-cli
Version: 1.7
Version: 1.8.1+git41.2c43c51
Release: 0
Summary: NVM Express user space tools
License: GPL-2.0-only
Group: Hardware/Other
URL: https://github.com/linux-nvme/nvme-cli
Source: %{name}-%{version}.tar.gz
Source: %{name}-%{version}.tar.xz
Source2: nvme-cli-rpmlintrc
Patch1: 0001-wdc-Change-device-capability-checking.patch
Patch2: 0002-wdc-Add-additional-device-for-vs-internal-log.patch
Patch3: 0003-generate-new-documentation.patch
Patch4: 0004-Fix-compilation-with-GCC-8.patch
Patch5: 0005-Fix-CFLAGS-parameter.patch
Patch6: 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch
Patch7: 0007-Regen-docs.patch
Patch8: 0008-nvme-cli-minor-cleanup-for-submit_io.patch
Patch9: 0009-Regen-documentation.patch
Patch10: 0010-nvme-cli-fix-fc-trtype-string.patch
Patch11: 0011-nvme-cli-add-netapp-ontapdevices-command.patch
Patch12: 0012-nvme-cli-add-netapp-ontapdevices-man-page.patch
Patch13: 0013-nvme-cli-Revert-stop-on-failure-with-connect-all.patch
Patch100: 0100-nvme_fc-auto-connect-scripts.patch
Patch101: 0101-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
Patch102: 0102-Add-nvmefc-connect.target.patch
Patch103: 0103-Change-service-to-type-simple.patch
Patch104: 0104-nvme-cli-Fix-documentation-syntax-and-typo.patch
# downstream patches:
Patch1: 0001-nvme_fc-auto-connect-scripts.patch
Patch2: 0002-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
Patch3: 0003-Add-nvmefc-connect.target.patch
Patch4: 0004-Change-service-to-type-simple.patch
Patch5: 0005-nvme-cli-Check-for-sysfs-interface-before-NVMe-disco.patch
BuildRequires: libuuid-devel
BuildRequires: pkgconfig
BuildRequires: xmlto
@ -61,19 +49,6 @@ dependencies.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%build
echo %{version} > version
@ -110,7 +85,9 @@ fi
%service_del_postun %services
%posttrans
/usr/bin/echo add 2>/dev/null >/sys/class/fc/fc_udev_device/nvme_discovery || true
if [ -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
%{_bindir}/echo add > /sys/class/fc/fc_udev_device/nvme_discovery
fi
%files
%license LICENSE