Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
nvme-cli.12152
0008-nvme-cli-Implement-nvme_get_log13.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0008-nvme-cli-Implement-nvme_get_log13.patch of Package nvme-cli.12152
From: Scott Bauer <scott.bauer@intel.com> Date: Mon, 22 Jan 2018 13:35:34 -0700 Subject: [PATCH] nvme-cli: Implement nvme_get_log13 Git-commit: 6d89e598c6f6fea91efc3e812201677b0fc1c92c References: bsc#1099018 This fixes a portion of 722c71bb: nvme/vendor: Add get log LSP/LSO fields from 1.3 spec This fixes up the code so it can use the same interface log we've had for awhile. People who wish to pass log specific parameters can use the new API. Signed-off-by: Scott Bauer <scott.bauer@intel.com> Signed-off-by: Keith Busch <keith.busch@intel.com> --- intel-nvme.c | 16 ++++------------ memblaze-nvme.c | 4 +--- nvme-ioctl.c | 25 ++++++++++++------------- nvme-ioctl.h | 6 ++++-- nvme.c | 10 ++++------ wdc-nvme.c | 4 ---- 6 files changed, 25 insertions(+), 40 deletions(-) diff --git a/intel-nvme.c b/intel-nvme.c index be81d87..330eed7 100644 --- a/intel-nvme.c +++ b/intel-nvme.c @@ -253,9 +253,7 @@ 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(smart_log), &smart_log); + err = nvme_get_log(fd, cfg.namespace_id, 0xca, sizeof(smart_log), &smart_log); if (!err) { if (cfg.json) show_intel_smart_log_jsn(&smart_log, cfg.namespace_id, devicename); @@ -291,9 +289,7 @@ 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(log), log); + err = nvme_get_log(fd, NVME_NSID_ALL, 0xdd, sizeof(log), log); if (!err) { if (!cfg.raw_binary) printf("Intel Marketing Name Log:\n%s\n", log); @@ -353,9 +349,7 @@ 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(stats), &stats); + err = nvme_get_log(fd, NVME_NSID_ALL, 0xc5, sizeof(stats), &stats); if (!err) { if (!cfg.raw_binary) show_temp_stats(&stats); @@ -421,9 +415,7 @@ 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(stats), &stats); + err = nvme_get_log(fd, NVME_NSID_ALL, cfg.write ? 0xc2 : 0xc1, sizeof(stats), &stats); if (!err) { if (!cfg.raw_binary) show_lat_stats(&stats, cfg.write); diff --git a/memblaze-nvme.c b/memblaze-nvme.c index 863c8ff..1e092db 100644 --- a/memblaze-nvme.c +++ b/memblaze-nvme.c @@ -223,9 +223,7 @@ 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(smart_log), &smart_log); + err = nvme_get_log(fd, cfg.namespace_id, 0xca, 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 a787c25..4166e23 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -381,7 +381,7 @@ 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, __u8 lsp, __u64 lpo, +int nvme_get_log13(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo, __u32 data_len, void *data) { struct nvme_admin_cmd cmd = { @@ -402,35 +402,34 @@ int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo, cmd.cdw13 = (lpo >> 32); return nvme_submit_admin_passthru(fd, &cmd); + +} + +int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data) +{ + return nvme_get_log13(fd, nsid, log_id, NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, + data_len, data); } 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(*fw_log), fw_log); + return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_FW_SLOT, 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, 0, NVME_LOG_ERROR, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - entries * sizeof(*err_log), err_log); + return nvme_get_log(fd, 0, NVME_LOG_ERROR, 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - sizeof(*smart_log), smart_log); + return nvme_get_log(fd, nsid, NVME_LOG_SMART, 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, - size, log); + return nvme_get_log(fd, 0, NVME_LOG_DISC, 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 1861135..3507e8a 100644 --- a/nvme-ioctl.h +++ b/nvme-ioctl.h @@ -78,8 +78,10 @@ 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_log13(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, diff --git a/nvme.c b/nvme.c index e7b73af..6a40ee3 100644 --- a/nvme.c +++ b/nvme.c @@ -244,8 +244,7 @@ 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, - NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, 4096, &effects); + err = nvme_get_log(fd, NVME_NSID_ALL, 5, 4096, &effects); if (!err) show_effects_log(&effects); else if (err > 0) @@ -459,9 +458,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.lsp, cfg.lpo, - cfg.log_len, log); + err = nvme_get_log13(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", @@ -527,7 +526,6 @@ static int sanitize_log(int argc, char **argv, struct command *command, struct p return fd; 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) diff --git a/wdc-nvme.c b/wdc-nvme.c index 872934e..6051d99 100644 --- a/wdc-nvme.c +++ b/wdc-nvme.c @@ -397,7 +397,6 @@ static int wdc_nvme_check_supported_log_page(int fd, __u8 log_id) /* get the log page length */ 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); @@ -412,7 +411,6 @@ static int wdc_nvme_check_supported_log_page(int fd, __u8 log_id) } 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) { @@ -1148,7 +1146,6 @@ 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, - 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); @@ -1198,7 +1195,6 @@ 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, - 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); -- 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