@@ -2022,6 +2022,85 @@ static int ocp_set_telemetry_profile_feature(int argc, char **argv, struct comma
20222022 return err ;
20232023}
20242024
2025+ ///////////////////////////////////////////////////////////////////////////////
2026+ ///////////////////////////////////////////////////////////////////////////////
2027+ ///////////////////////////////////////////////////////////////////////////////
2028+ ///////////////////////////////////////////////////////////////////////////////
2029+ /// DSSD Power State (Feature Identifier C8h) Get Feature
2030+ static int ocp_get_telemetry_profile_feature (int argc , char * * argv , struct command * cmd ,
2031+ struct plugin * plugin )
2032+ {
2033+ const char * desc = "Define Issue Get Feature command (FID: 0xC8) Latency Monitor" ;
2034+ const char * sel = "[0-3]: current/default/saved/supported/" ;
2035+ const char * nsid = "Byte[04-07]: Namespace Identifier Valid/Invalid/Inactive" ;
2036+
2037+ _cleanup_nvme_dev_ struct nvme_dev * dev = NULL ;
2038+
2039+ __u32 result ;
2040+ int err ;
2041+ bool uuid ;
2042+ __u8 uuid_index = 0 ;
2043+
2044+ struct config {
2045+ __u8 sel ;
2046+ __u32 nsid ;
2047+ };
2048+
2049+ struct config cfg = {
2050+ .sel = 0 ,
2051+ .nsid = 0 ,
2052+ };
2053+
2054+ OPT_ARGS (opts ) = {
2055+ OPT_BYTE ("sel" , 's' , & cfg .sel , sel ),
2056+ OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , nsid ),
2057+ OPT_FLAG ("no-uuid" , 'u' , NULL , no_uuid ),
2058+ OPT_END ()
2059+ };
2060+
2061+ err = parse_and_open (& dev , argc , argv , desc , opts );
2062+ if (err )
2063+ return err ;
2064+
2065+ uuid = !argconfig_parse_seen (opts , "no-uuid" );
2066+
2067+ if (uuid ) {
2068+ /* OCP 2.0 requires UUID index support */
2069+ err = ocp_get_uuid_index (dev , & uuid_index );
2070+ if (err || !uuid_index ) {
2071+ nvme_show_error ("ERROR: No OCP UUID index found" );
2072+ return err ;
2073+ }
2074+ }
2075+
2076+ struct nvme_get_features_args args = {
2077+ .args_size = sizeof (args ),
2078+ .fd = dev_fd (dev ),
2079+ .fid = OCP_FID_TEL_CFG ,
2080+ .nsid = cfg .nsid ,
2081+ .sel = cfg .sel ,
2082+ .cdw11 = 0 ,
2083+ .uuidx = uuid_index ,
2084+ .data_len = 0 ,
2085+ .data = NULL ,
2086+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT ,
2087+ .result = & result ,
2088+ };
2089+
2090+ err = nvme_get_features (& args );
2091+ if (!err ) {
2092+ printf ("get-feature:0xC8 %s value: %#08x\n" ,
2093+ nvme_select_to_string (cfg .sel ), result );
2094+
2095+ if (cfg .sel == NVME_GET_FEATURES_SEL_SUPPORTED )
2096+ nvme_show_select_result (0xC8 , result );
2097+ } else {
2098+ nvme_show_error ("Could not get feature: 0xC8" );
2099+ }
2100+
2101+ return err ;
2102+ }
2103+
20252104///////////////////////////////////////////////////////////////////////////////
20262105///////////////////////////////////////////////////////////////////////////////
20272106///////////////////////////////////////////////////////////////////////////////
0 commit comments