nvme-cli: Implement nvme_get_log13
PATCH 1/1 nvme-cli: Implement nvme_get_log13
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 at intel.com>
--- intel-nvme.c | 16 ++++------------ memblaze-nvme.c | 4 +--- nvme-ioctl.c | 45 ++++++++++++++++++++------------------------- nvme-ioctl.h | 6 ++++-- nvme.c | 6 +++--- wdc-nvme.c | 10 +++++----- 6 files changed, 37 insertions(+), 50 deletions(-)
intel-nvme.c +4 -12
@@ -255,9 +255,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,if (fd <0 )return fd; - 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);
@@ -295,9 +293,7 @@ static int get_market_log(int argc, char **argv, struct command *cmd, struct pluif (fd <0 )return fd; - 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);
@@ -359,9 +355,7 @@ static int get_temp_stats_log(int argc, char **argv, struct command *cmd, structif (fd <0 )return fd; - 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);
@@ -429,9 +423,7 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, structif (fd <0 )return fd; - 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);
memblaze-nvme.c +1 -3
@@ -225,9 +225,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,if (fd <0 )return fd; - 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);
nvme-ioctl.c +20 -25
88 lines not on this page · raw message
nvme-ioctl.h +4 -2
@@ -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_get_telemetry_log (int fd,void *lp,int generate_report,size_t log_page_size,__u64 offset);
nvme.c +3 -3
@@ -579,9 +579,9 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *plreturn 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",
wdc-nvme.c +5 -5
@@ -590,7 +590,7 @@ 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); +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;
@@ -604,7 +604,7 @@ 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); + 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);
@@ -1339,7 +1339,7 @@ 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); +WDC_CA_LOG_BUF_LEN , data);if (strcmp (format,"json" ))fprintf (stderr,"NVMe Status:%s(%x)\n" ,nvme_status_to_string (ret), ret);
@@ -1388,7 +1388,7 @@ 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); +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 ) {
@@ -2075,7 +2075,7 @@ static int wdc_do_drive_essentials(int fd, char *dir, char *key)memset (dataBuffer,0 , dataBufferSize); ret =nvme_get_log (fd,WDC_DE_GLOBAL_NSID , deVULogPagesList[vuLogIdx].logPageId, -NVME_NO_LOG_LSP ,NVME_NO_LOG_LPO , dataBufferSize, dataBuffer); + dataBufferSize, dataBuffer);if (ret) {fprintf (stderr,"ERROR : WDC : nvme_get_log() for log page 0x%x failed, ret = %d\n" , deVULogPagesList[vuLogIdx].logPageId, ret);
Signature · 1 line
2.11.0
PATCH 1/1 nvme-cli: Implement nvme_get_log13
Quoted 6 lines · Scott Bauer
This fixes a portion of
722c71bb:
nvme/vendor: Add get log LSP/LSO fields from 1.3 specThis 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.
Thanks, Scott. Applied.