From: Dong.Ho@wdc.com (Dong Ho)
Subject: [PATCH 1/2] wdc: Update device capabilities for clear pcie corr
Date: Mon, 4 Feb 2019 19:54:05 +0000 [thread overview]
Message-ID: <1549310038-13075-1-git-send-email-dong.ho@wdc.com> (raw)
---
plugins/wdc/wdc-nvme.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c
index 3aeb28b..2f9a541 100644
--- a/plugins/wdc/wdc-nvme.c
+++ b/plugins/wdc/wdc-nvme.c
@@ -682,7 +682,7 @@ static __u64 wdc_get_drive_capabilities(int fd) {
capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG | WDC_DRIVE_CAP_C1_LOG_PAGE);
break;
case WDC_NVME_SN200_DEV_ID:
- capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG);
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG | WDC_DRIVE_CAP_CLEAR_PCIE);
/* verify the 0xCA log page is supported */
if (wdc_nvme_check_supported_log_page(fd, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE) == true)
@@ -711,7 +711,7 @@ static __u64 wdc_get_drive_capabilities(int fd) {
case WDC_NVME_SN840_DEV_ID:
capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG |
WDC_DRIVE_CAP_DRIVE_STATUS | WDC_DRIVE_CAP_CLEAR_ASSERT |
- WDC_DRIVE_CAP_RESIZE);
+ WDC_DRIVE_CAP_RESIZE | WDC_DRIVE_CAP_CLEAR_PCIE);
/* verify the 0xCA log page is supported */
if (wdc_nvme_check_supported_log_page(fd, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE) == true)
@@ -2611,6 +2611,7 @@ static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct comma
char *desc = "Clear PCIE Correctable Errors.";
int fd;
int ret;
+ __u64 capabilities = 0;
struct nvme_passthru_cmd admin_cmd;
const struct argconfig_commandline_options command_line_options[] = {
{ NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc },
@@ -2620,8 +2621,17 @@ static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct comma
if (fd < 0)
return fd;
- if (!wdc_check_device(fd))
- return -1;
+ if (!wdc_check_device(fd)) {
+ ret = -1;
+ goto out;
+ }
+
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_CLEAR_PCIE) == 0) {
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
+ ret = -1;
+ goto out;
+ }
memset(&admin_cmd, 0, sizeof (admin_cmd));
admin_cmd.opcode = WDC_NVME_CLEAR_PCIE_CORR_OPCODE;
@@ -2630,6 +2640,7 @@ static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct comma
ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+out:
return ret;
}
static int wdc_drive_status(int argc, char **argv, struct command *command,
--
2.7.4
next reply other threads:[~2019-02-04 19:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 19:54 Dong Ho [this message]
2019-02-04 19:54 ` [PATCH 2/2] wdc: Update file parameter checking Dong Ho
2019-02-06 0:47 ` [PATCH 1/2] wdc: Update device capabilities for clear pcie corr Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1549310038-13075-1-git-send-email-dong.ho@wdc.com \
--to=dong.ho@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox