Skip to content
Merged
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
59 changes: 59 additions & 0 deletions Documentation/nvme-ocp-get-idle-wakeup-time.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
nvme-ocp-get-idle-wakeup-time(1)
=========================================

NAME
----
nvme-ocp-get-idle-wakeup-time - Define and print idle-wakeup-time value

SYNOPSIS
--------
[verse]
'nvme ocp get-idle-wakeup-time' <device> [--sel=<select> | -s <select>] [--namespace-id=<nsid> | -n <namespace-id>]

DESCRIPTION
-----------
Define get-idle-wakeup-time.
No argument prints current mode.

The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).

This will only work on OCP compliant devices supporting this feature.
Results for any other device are undefined.

On success it returns 0, error code otherwise.

OPTIONS
-------

-s <select>::
--sel=<select>::
Select (SEL): This field specifies which value of the attributes
to return in the provided data:

-n <namespace-id>::
--namespace-id=<namespace-id>::
namespace-id (namespace-id): This field specifies which value of the attributes
to return in the provided data:
+
[]
|==================
|Select|Description
|0|Current
|1|Default
|2|Saved
|3|Supported capabilities
|4-7|Reserved
|==================

EXAMPLES
--------
* Has the program issue a get-idle-wakeup-time to retrieve the 0xCA get features.
+
------------
# nvme ocp get-idle-wakeup-time /dev/nvme0
------------

NVME
----
Part of the nvme-user suite.
71 changes: 71 additions & 0 deletions plugins/ocp/ocp-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -3039,3 +3039,74 @@

return err;
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// 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)
{
const char *desc = "Define Issue Get Feature cmd (FID: 0xCA) IWUT";
const char *sel = "[0-3]: current/default/saved/supported/";
const char *nsid = "Byte[04-07]: NSID Valid/Invalid/Inactive";

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

Check failure on line 3057 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 3057 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,
};

NVME_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));

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) {
printf("get-feature:CAh,SEL=%s,IWUT Disabled: %#016"PRIx64"\n",

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

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 87 exceeds 80 columns
nvme_select_to_string(cfg.sel), (uint64_t)result);
} else {
printf("get-feature:CAh SEL=%s,IWUT is: %#016"PRIx64"\n",

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

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 81 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 @@ -50,6 +50,8 @@ PLUGIN(NAME("ocp", "OCP cloud SSD extensions", OCP_PLUGIN_VERSION),
ocp_get_telemetry_profile_feature)
ENTRY("persistent-event-log", "Retrieve Persistent Event Log with OCP events",
ocp_get_persistent_event_log)
ENTRY("get-idle-wakeup-time", "Get Idle Wake Up Time Config",
ocp_get_idle_wakeup_time_config_feature)
)
);

Expand Down Expand Up @@ -281,6 +283,7 @@ 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 */
};

/*
Expand Down