Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
nvme-cli.12152
0007-nvme-vendor-Add-get-log-LSP-LSO-fields-fro...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0007-nvme-vendor-Add-get-log-LSP-LSO-fields-from-1.3-spec.patch of Package nvme-cli.12152
From: Scott Bauer <scott.bauer@intel.com> Date: Tue, 16 Jan 2018 10:46:50 -0700 Subject: [PATCH] nvme/vendor: Add get log LSP/LSO fields from 1.3 spec Git-commit: 722c71bb3246a46a784861a3874aa5017b919f49 References: bsc#1099018 Signed-off-by: Scott Bauer <scott.bauer@intel.com> [Fixed param descriptions and short opt] Signed-off-by: Keith Busch <keith.busch@intel.com> --- intel-nvme.c | 17 ++++++++++++----- linux/nvme.h | 5 +++++ memblaze-nvme.c | 4 +++- nvme-ioctl.c | 24 +++++++++++++++++++----- nvme-ioctl.h | 3 ++- nvme.c | 19 ++++++++++++++++--- wdc-nvme.c | 16 ++++++++++++---- 7 files changed, 69 insertions(+), 19 deletions(-) diff --git a/intel-nvme.c b/intel-nvme.c index bbd1313..be81d87 100644 --- a/intel-nvme.c +++ b/intel-nvme.c @@ -253,8 +253,9 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd, fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - err = nvme_get_log(fd, cfg.namespace_id, 0xca, sizeof(smart_log), - &smart_log); + err = nvme_get_log(fd, cfg.namespace_id, 0xca, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(smart_log), &smart_log); if (!err) { if (cfg.json) show_intel_smart_log_jsn(&smart_log, cfg.namespace_id, devicename); @@ -290,7 +291,9 @@ static int get_market_log(int argc, char **argv, struct command *cmd, struct plu fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - err = nvme_get_log(fd, NVME_NSID_ALL, 0xdd, sizeof(log), log); + err = nvme_get_log(fd, NVME_NSID_ALL, 0xdd, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(log), log); if (!err) { if (!cfg.raw_binary) printf("Intel Marketing Name Log:\n%s\n", log); @@ -350,7 +353,9 @@ static int get_temp_stats_log(int argc, char **argv, struct command *cmd, struct fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - err = nvme_get_log(fd, NVME_NSID_ALL, 0xc5, sizeof(stats), &stats); + err = nvme_get_log(fd, NVME_NSID_ALL, 0xc5, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(stats), &stats); if (!err) { if (!cfg.raw_binary) show_temp_stats(&stats); @@ -416,7 +421,9 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - err = nvme_get_log(fd, NVME_NSID_ALL, cfg.write ? 0xc2 : 0xc1, sizeof(stats), &stats); + err = nvme_get_log(fd, NVME_NSID_ALL, cfg.write ? 0xc2 : 0xc1, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(stats), &stats); if (!err) { if (!cfg.raw_binary) show_lat_stats(&stats, cfg.write); diff --git a/linux/nvme.h b/linux/nvme.h index 78f7fbe..162b1e0 100644 --- a/linux/nvme.h +++ b/linux/nvme.h @@ -776,6 +776,11 @@ enum { NVME_FWACT_ACTV = (2 << 3), }; +enum { + NVME_NO_LOG_LSP = 0x0, + NVME_NO_LOG_LPO = 0x0, +}; + /* Sanitize and Sanitize Monitor/Log */ enum { /* Sanitize */ diff --git a/memblaze-nvme.c b/memblaze-nvme.c index 1e092db..863c8ff 100644 --- a/memblaze-nvme.c +++ b/memblaze-nvme.c @@ -223,7 +223,9 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd, fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - err = nvme_get_log(fd, cfg.namespace_id, 0xca, sizeof(smart_log), &smart_log); + err = nvme_get_log(fd, cfg.namespace_id, 0xca, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(smart_log), &smart_log); if (!err) { if (!cfg.raw_binary) err = show_memblaze_smart_log(fd, cfg.namespace_id, devicename, &smart_log); diff --git a/nvme-ioctl.c b/nvme-ioctl.c index c0d7775..a787c25 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -381,7 +381,8 @@ int nvme_identify_ns_descs(int fd, __u32 nsid, void *data) return nvme_identify(fd, nsid, NVME_ID_CNS_NS_DESC_LIST, data); } -int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data) +int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo, + __u32 data_len, void *data) { struct nvme_admin_cmd cmd = { .opcode = nvme_admin_get_log_page, @@ -393,30 +394,43 @@ int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data) __u16 numdu = numd >> 16, numdl = numd & 0xffff; cmd.cdw10 = log_id | (numdl << 16); + if (lsp) + cmd.cdw10 |= lsp << 8; + cmd.cdw11 = numdu; + cmd.cdw12 = lpo; + cmd.cdw13 = (lpo >> 32); return nvme_submit_admin_passthru(fd, &cmd); } int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log) { - return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_FW_SLOT, sizeof(*fw_log), fw_log); + return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_FW_SLOT, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(*fw_log), fw_log); } int nvme_error_log(int fd, __u32 nsid, int entries, struct nvme_error_log_page *err_log) { - return nvme_get_log(fd, nsid, NVME_LOG_ERROR, entries * sizeof(*err_log), err_log); + return nvme_get_log(fd, 0, NVME_LOG_ERROR, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + entries * sizeof(*err_log), err_log); } int nvme_smart_log(int fd, __u32 nsid, struct nvme_smart_log *smart_log) { - return nvme_get_log(fd, nsid, NVME_LOG_SMART, sizeof(*smart_log), smart_log); + return nvme_get_log(fd, nsid, NVME_LOG_SMART, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + sizeof(*smart_log), smart_log); } int nvme_discovery_log(int fd, struct nvmf_disc_rsp_page_hdr *log, __u32 size) { - return nvme_get_log(fd, 0, NVME_LOG_DISC, size, log); + return nvme_get_log(fd, 0, NVME_LOG_DISC, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + size, log); } int nvme_feature(int fd, __u8 opcode, __u32 nsid, __u32 cdw10, __u32 cdw11, diff --git a/nvme-ioctl.h b/nvme-ioctl.h index 6a3b52b..1861135 100644 --- a/nvme-ioctl.h +++ b/nvme-ioctl.h @@ -78,8 +78,9 @@ int nvme_identify_ns(int fd, __u32 nsid, bool present, void *data); int nvme_identify_ns_list(int fd, __u32 nsid, bool all, void *data); int nvme_identify_ctrl_list(int fd, __u32 nsid, __u16 cntid, void *data); int nvme_identify_ns_descs(int fd, __u32 nsid, void *data); +int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo, + __u32 data_len, void *data); -int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data); int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log); int nvme_error_log(int fd, __u32 nsid, int entries, struct nvme_error_log_page *err_log); diff --git a/nvme.c b/nvme.c index da698c5..e7b73af 100644 --- a/nvme.c +++ b/nvme.c @@ -244,7 +244,8 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl if (fd < 0) return fd; - err = nvme_get_log(fd, NVME_NSID_ALL, 5, 4096, &effects); + err = nvme_get_log(fd, NVME_NSID_ALL, 5, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, 4096, &effects); if (!err) show_effects_log(&effects); else if (err > 0) @@ -396,6 +397,8 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl const char *log_id = "identifier of log to retrieve"; const char *log_len = "how many bytes to retrieve"; const char *aen = "result of the aen, use to override log id"; + const char *lsp = "log specific field"; + const char *lpo = "log page offset specifies the location within a log page from where to start returning data"; const char *raw_binary = "output in raw format"; int err, fd; @@ -404,6 +407,8 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl __u32 log_id; __u32 log_len; __u32 aen; + __u64 lpo; + __u8 lsp; int raw_binary; }; @@ -411,6 +416,8 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl .namespace_id = NVME_NSID_ALL, .log_id = 0xffffffff, .log_len = 0, + .lpo = NVME_NO_LOG_LPO, + .lsp = NVME_NO_LOG_LSP, }; const struct argconfig_commandline_options command_line_options[] = { @@ -419,6 +426,8 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl {"log-len", 'l', "NUM", CFG_POSITIVE, &cfg.log_len, required_argument, log_len}, {"aen", 'a', "NUM", CFG_POSITIVE, &cfg.aen, required_argument, aen}, {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary}, + {"lpo", 'o', "NUM", CFG_LONG, &cfg.lpo, required_argument, lpo}, + {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, required_argument, lsp}, {NULL} }; @@ -450,7 +459,9 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl return EINVAL; } - err = nvme_get_log(fd, cfg.namespace_id, cfg.log_id, cfg.log_len, log); + err = nvme_get_log(fd, cfg.namespace_id, cfg.log_id, + cfg.lsp, cfg.lpo, + cfg.log_len, log); if (!err) { if (!cfg.raw_binary) { printf("Device:%s log-id:%d namespace-id:%#x\n", @@ -515,7 +526,9 @@ static int sanitize_log(int argc, char **argv, struct command *command, struct p if (fd < 0) return fd; - ret = nvme_get_log(fd, 0x01, NVME_LOG_SANITIZE, NVME_SANITIZE_LOG_DATA_LEN, output); + ret = nvme_get_log(fd, 0x01, NVME_LOG_SANITIZE, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + NVME_SANITIZE_LOG_DATA_LEN, output); fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); if (ret != 0) return ret; diff --git a/wdc-nvme.c b/wdc-nvme.c index 62cf59d..872934e 100644 --- a/wdc-nvme.c +++ b/wdc-nvme.c @@ -396,7 +396,9 @@ static int wdc_nvme_check_supported_log_page(int fd, __u8 log_id) memset(data, 0, sizeof (__u8) * WDC_C2_LOG_BUF_LEN); /* get the log page length */ - ret = nvme_get_log(fd, 0xFFFFFFFF, WDC_NVME_GET_AVAILABLE_LOG_PAGES_OPCODE, WDC_C2_LOG_BUF_LEN, data); + ret = nvme_get_log(fd, 0xFFFFFFFF, WDC_NVME_GET_AVAILABLE_LOG_PAGES_OPCODE, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + WDC_C2_LOG_BUF_LEN, data); if (ret) { fprintf(stderr, "ERROR : WDC : Unable to get C2 Log Page length, ret = %d\n", ret); goto out; @@ -409,7 +411,9 @@ static int wdc_nvme_check_supported_log_page(int fd, __u8 log_id) goto out; } - ret = nvme_get_log(fd, 0xFFFFFFFF, WDC_NVME_GET_AVAILABLE_LOG_PAGES_OPCODE, hdr_ptr->length, data); + ret = nvme_get_log(fd, 0xFFFFFFFF, WDC_NVME_GET_AVAILABLE_LOG_PAGES_OPCODE, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + hdr_ptr->length, data); /* parse the data until the List of log page ID's is found */ if (ret) { fprintf(stderr, "ERROR : WDC : Unable to read C2 Log Page data, ret = %d\n", ret); @@ -1143,7 +1147,9 @@ static int wdc_get_ca_log_page(int fd, char *format) } memset(data, 0, sizeof (__u8) * WDC_CA_LOG_BUF_LEN); - ret = nvme_get_log(fd, 0xFFFFFFFF, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, WDC_CA_LOG_BUF_LEN, data); + ret = nvme_get_log(fd, 0xFFFFFFFF, WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + WDC_CA_LOG_BUF_LEN, data); if (strcmp(format, "json")) fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); @@ -1191,7 +1197,9 @@ static int wdc_get_c1_log_page(int fd, char *format, uint8_t interval) } memset(data, 0, sizeof (__u8) * WDC_ADD_LOG_BUF_LEN); - ret = nvme_get_log(fd, 0x01, WDC_NVME_ADD_LOG_OPCODE, WDC_ADD_LOG_BUF_LEN, data); + ret = nvme_get_log(fd, 0x01, WDC_NVME_ADD_LOG_OPCODE, + NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + 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) { -- 2.13.7
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor