Skip to content

Commit e1bffe3

Browse files
author
Praveen Kumar B/Praveen Kumar B
committed
pulgin/ocp:Added the OCP2.7 supported Get feature FID=CAh command api
Implemented the OCP 2.7 spec supported Get Feature FID=CAh command api to fetch idle wake up time configuration Reviewed-by: Karthik Balan <[email protected]> Reviewed-by: Arunpandian J <[email protected]> Signed-off-by: Praveen Kumar B/Praveen Kumar B <[email protected]>
1 parent a83dd4d commit e1bffe3

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

plugins/ocp/ocp-nvme.c

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,3 +2974,74 @@ static int hwcomp_log(int argc, char **argv, struct command *acmd, struct plugin
29742974
{
29752975
return ocp_hwcomp_log(argc, argv, acmd, plugin);
29762976
}
2977+
2978+
///////////////////////////////////////////////////////////////////////////////
2979+
///////////////////////////////////////////////////////////////////////////////
2980+
///////////////////////////////////////////////////////////////////////////////
2981+
///////////////////////////////////////////////////////////////////////////////
2982+
/// Idle Wake Up Time Configuration (Feature Identifier CAh) Get Feature
2983+
static int ocp_get_idle_wakeup_time_config_feature(int argc, char **argv,
2984+
struct command *acmd, struct plugin *plugin)
2985+
{
2986+
const char *desc = "Define Issue Get Feature cmd (FID: 0xCA) Idle Wake Up Time";
2987+
const char *sel = "[0-3]: current/default/saved/supported/";
2988+
const char *nsid = "Byte[04-07]: Namespace Identifier Valid/Invalid/Inactive";
2989+
2990+
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
2991+
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;
2992+
2993+
__u64 result;
2994+
int err;
2995+
bool uuid;
2996+
__u8 uuid_index = 0;
2997+
2998+
struct config {
2999+
__u8 sel;
3000+
__u32 nsid;
3001+
};
3002+
3003+
struct config cfg = {
3004+
.sel = 0,
3005+
.nsid = 0,
3006+
};
3007+
3008+
OPT_ARGS(opts) = {
3009+
OPT_BYTE("sel", 's', &cfg.sel, sel),
3010+
OPT_UINT("namespace-id", 'n', &cfg.nsid, nsid),
3011+
OPT_FLAG("no-uuid", 'u', NULL, no_uuid),
3012+
OPT_END()
3013+
};
3014+
3015+
err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts);
3016+
if (err)
3017+
return err;
3018+
3019+
uuid = !argconfig_parse_seen(opts, "no-uuid");
3020+
3021+
if (uuid) {
3022+
/* OCP 2.0 requires UUID index support */
3023+
err = ocp_get_uuid_index(hdl, &uuid_index);
3024+
if (err || !uuid_index) {
3025+
nvme_show_error("ERROR: No OCP UUID index found");
3026+
return err;
3027+
}
3028+
}
3029+
3030+
err = nvme_get_features(hdl, cfg.nsid, OCP_FID_IWTC, cfg.sel, 0,
3031+
uuid_index, NULL, 0, &result);
3032+
if (!err) {
3033+
if (result == 0){
3034+
printf("get-feature:0xCA SEL=%s, Idle WakeUp Time is Disabled: %#016"PRIx64"\n",
3035+
nvme_select_to_string(cfg.sel), (uint64_t)result);
3036+
} else{
3037+
printf("get-feature:0xCA SEL=%s,Idle WakeUp Time is: %#016"PRIx64"\n",
3038+
nvme_select_to_string(cfg.sel), (uint64_t)result);
3039+
}
3040+
if (cfg.sel == NVME_GET_FEATURES_SEL_SUPPORTED)
3041+
nvme_show_select_result(0xCA, result);
3042+
} else {
3043+
nvme_show_error("Could not get feature: 0xCA");
3044+
}
3045+
3046+
return err;
3047+
}

plugins/ocp/ocp-nvme.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ PLUGIN(NAME("ocp", "OCP cloud SSD extensions", OCP_PLUGIN_VERSION),
4848
get_clear_pcie_correctable_error_counters)
4949
ENTRY("get-telemetry-profile", "Get Telemetry Profile Feature",
5050
ocp_get_telemetry_profile_feature)
51+
ENTRY("get-idle-wakeup-time-config", "Get Idle Wake Up Time Configuration",
52+
ocp_get_idle_wakeup_time_config_feature)
5153
)
5254
);
5355

@@ -279,5 +281,6 @@ enum ocp_dssd_feature_id {
279281
OCP_FID_DSSDPS, /* DSSD Power State */
280282
OCP_FID_TEL_CFG, /* Telemetry Profile */
281283
OCP_FID_DAEC, /* DSSD Asynchronous Event Configuration */
284+
OCP_FID_IWTC, /* Idle Wake Up Time Configuration */
282285
};
283286
#endif /* OCP_NVME_H */

0 commit comments

Comments
 (0)