@@ -423,6 +423,66 @@ 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+ const __u8 fid = 0xc5 ;
433+ struct nvme_dev * dev ;
434+ __u32 result ;
435+ int err ;
436+
437+ struct config {
438+ __u8 sel ;
439+ __u32 nsid ;
440+ };
441+
442+ struct config cfg = {
443+ .sel = 0 ,
444+ .nsid = 0 ,
445+ };
446+
447+ OPT_ARGS (opts ) = {
448+ OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ),
449+ OPT_BYTE ("nsid" , 'n' , & cfg .nsid , nsid ),
450+ OPT_FLAG ("no-uuid" , 'u' , NULL , no_uuid ),
451+ OPT_END ()
452+ };
453+
454+ err = parse_and_open (& dev , argc , argv , desc , opts );
455+ if (err )
456+ return err ;
457+
458+ struct nvme_get_features_args args = {
459+ .args_size = sizeof (args ),
460+ .fd = dev_fd (dev ),
461+ .fid = OCP_FID_LM ,
462+ .nsid = cfg .nsid ,
463+ .sel = cfg .sel ,
464+ .cdw11 = 0 ,
465+ .uuidx = 0 ,
466+ .data_len = 0 ,
467+ .data = NULL ,
468+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT ,
469+ .result = & result ,
470+ };
471+
472+ err = nvme_get_features (& args );
473+ if (!err ) {
474+ printf ("get-feature:0xC5 %s value: %#08x
475+ \n" , nvme_select_to_string (cfg .sel ), result );
476+
477+ if (cfg .sel == NVME_GET_FEATURES_SEL_SUPPORTED )
478+ nvme_show_select_result (fid , result );
479+ } else {
480+ nvme_show_error ("Could not get feature: 0xC5" );
481+ }
482+
483+ return err ;
484+ }
485+
426486///////////////////////////////////////////////////////////////////////////////
427487///////////////////////////////////////////////////////////////////////////////
428488///////////////////////////////////////////////////////////////////////////////
0 commit comments