@@ -423,6 +423,65 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
423423 return err ;
424424}
425425
426+ static int ocp_get_latency_monitor_feature (int argc , char * * argv , struct command * cmd ,
427+ struct plugin * plugin )
428+ {
429+ const char * desc = "Define Issue Get Feature command (FID : 0xC5) Latency Monitor" ;
430+ const char * sel = "[0-3]: current/default/saved/supported/" ;
431+ const char * nsid = "Byte[04-07]:Namespace Identifier Valid/Invalid/Inactive" ;
432+ struct nvme_dev * dev ;
433+ __u32 result ;
434+ int err ;
435+
436+ struct config {
437+ __u8 sel ;
438+ __u32 nsid ;
439+ };
440+
441+ struct config cfg = {
442+ .sel = 0 ,
443+ .nsid = 0 ,
444+ };
445+
446+ OPT_ARGS (opts ) = {
447+ OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ),
448+ OPT_BYTE ("nsid" , 'n' , & cfg .nsid , nsid ),
449+ OPT_FLAG ("no-uuid" , 'u' , NULL , no_uuid ),
450+ OPT_END ()
451+ };
452+
453+ err = parse_and_open (& dev , argc , argv , desc , opts );
454+ if (err )
455+ return err ;
456+
457+ struct nvme_get_features_args args = {
458+ .args_size = sizeof (args ),
459+ .fd = dev_fd (dev ),
460+ .fid = OCP_FID_LM ,
461+ .nsid = cfg .nsid ,
462+ .sel = cfg .sel ,
463+ .cdw11 = 0 ,
464+ .uuidx = 0 ,
465+ .data_len = 0 ,
466+ .data = NULL ,
467+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT ,
468+ .result = & result ,
469+ };
470+
471+ err = nvme_get_features (& args );
472+ if (!err ) {
473+ printf ("get-feature:0xC5 %s value: %#08x\n" ,
474+ nvme_select_to_string (cfg .sel ), result );
475+
476+ if (cfg .sel == NVME_GET_FEATURES_SEL_SUPPORTED )
477+ nvme_show_select_result (0xC5 , result );
478+ } else {
479+ nvme_show_error ("Could not get feature: 0xC5" );
480+ }
481+
482+ return err ;
483+ }
484+
426485///////////////////////////////////////////////////////////////////////////////
427486///////////////////////////////////////////////////////////////////////////////
428487///////////////////////////////////////////////////////////////////////////////
0 commit comments