Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions plugins/ocp/ocp-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2974,3 +2974,74 @@
{
return ocp_hwcomp_log(argc, argv, acmd, plugin);
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Idle Wake Up Time Configuration (Feature Identifier CAh) Get Feature
static int ocp_get_idle_wakeup_time_config_feature(int argc, char **argv,
struct command *acmd, struct plugin *plugin)

Check failure on line 2984 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

ERROR: code indent should use tabs where possible

Check failure on line 2984 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 96 exceeds 80 columns
{
const char *desc = "Define Issue Get Feature cmd (FID: 0xCA) Idle Wake Up Time";

Check failure on line 2986 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 88 exceeds 80 columns
const char *sel = "[0-3]: current/default/saved/supported/";
const char *nsid = "Byte[04-07]: Namespace Identifier Valid/Invalid/Inactive";

Check failure on line 2988 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns

_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;

Check failure on line 2991 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: Missing a blank line after declarations

Check failure on line 2991 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 81 exceeds 80 columns

__u64 result;
int err;
bool uuid;
__u8 uuid_index = 0;

struct config {
__u8 sel;
__u32 nsid;
};

struct config cfg = {
.sel = 0,
.nsid = 0,
};

OPT_ARGS(opts) = {
OPT_BYTE("sel", 's', &cfg.sel, sel),
OPT_UINT("namespace-id", 'n', &cfg.nsid, nsid),
OPT_FLAG("no-uuid", 'u', NULL, no_uuid),
OPT_END()
};

err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts);
if (err)
return err;

uuid = !argconfig_parse_seen(opts, "no-uuid");

if (uuid) {
/* OCP 2.0 requires UUID index support */
err = ocp_get_uuid_index(hdl, &uuid_index);
if (err || !uuid_index) {
nvme_show_error("ERROR: No OCP UUID index found");
return err;
}
}

err = nvme_get_features(hdl, cfg.nsid, OCP_FID_IWTC, cfg.sel, 0,
uuid_index, NULL, 0, &result);
if (!err) {
if (result == 0){

Check failure on line 3033 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

ERROR: space required before the open brace '{'
printf("get-feature:0xCA SEL=%s, Idle WakeUp Time is Disabled: %#016"PRIx64"\n",

Check failure on line 3034 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 104 exceeds 80 columns
nvme_select_to_string(cfg.sel), (uint64_t)result);
} else{

Check failure on line 3036 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

ERROR: space required before the open brace '{'
printf("get-feature:0xCA SEL=%s,Idle WakeUp Time is: %#016"PRIx64"\n",

Check failure on line 3037 in plugins/ocp/ocp-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 94 exceeds 80 columns
nvme_select_to_string(cfg.sel), (uint64_t)result);
}
if (cfg.sel == NVME_GET_FEATURES_SEL_SUPPORTED)
nvme_show_select_result(0xCA, result);
} else {
nvme_show_error("Could not get feature: 0xCA");
}

return err;
}
3 changes: 3 additions & 0 deletions plugins/ocp/ocp-nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ PLUGIN(NAME("ocp", "OCP cloud SSD extensions", OCP_PLUGIN_VERSION),
get_clear_pcie_correctable_error_counters)
ENTRY("get-telemetry-profile", "Get Telemetry Profile Feature",
ocp_get_telemetry_profile_feature)
ENTRY("get-idle-wakeup-time-config", "Get Idle Wake Up Time Configuration",
ocp_get_idle_wakeup_time_config_feature)
)
);

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