1
0
Fork 0

Merging upstream version 2.14.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-22 13:00:36 +02:00
parent 0d9181726f
commit f268303a51
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
572 changed files with 4636 additions and 1730 deletions

View file

@ -22,7 +22,7 @@
#include "plugin.h"
#include "linux/types.h"
#include "util/types.h"
#include "util/logging.h"
#include "logging.h"
#include "nvme-print.h"
#include "nvme-wrap.h"
@ -423,6 +423,80 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
return err;
}
static int ocp_get_latency_monitor_feature(int argc, char **argv, struct command *cmd,
struct plugin *plugin)
{
const char *desc = "Define Issue Get Feature command (FID: 0xC5) Latency Monitor";
const char *sel = "[0-3]: current/default/saved/supported/";
const char *nsid = "Byte[04-07]: Namespace Identifier Valid/Invalid/Inactive";
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
__u32 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(&dev, 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(dev, &uuid_index);
if (err || !uuid_index) {
nvme_show_error("ERROR: No OCP UUID index found");
return err;
}
}
struct nvme_get_features_args args = {
.args_size = sizeof(args),
.fd = dev_fd(dev),
.fid = OCP_FID_LM,
.nsid = cfg.nsid,
.sel = cfg.sel,
.cdw11 = 0,
.uuidx = uuid_index,
.data_len = 0,
.data = NULL,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.result = &result,
};
err = nvme_get_features(&args);
if (!err) {
printf("get-feature:0xC5 %s value: %#08x\n",
nvme_select_to_string(cfg.sel), result);
if (cfg.sel == NVME_GET_FEATURES_SEL_SUPPORTED)
nvme_show_select_result(0xC5, result);
} else {
nvme_show_error("Could not get feature: 0xC5");
}
return err;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@ -1948,6 +2022,85 @@ static int ocp_set_telemetry_profile_feature(int argc, char **argv, struct comma
return err;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// DSSD Power State (Feature Identifier C8h) Get Feature
static int ocp_get_telemetry_profile_feature(int argc, char **argv, struct command *cmd,
struct plugin *plugin)
{
const char *desc = "Define Issue Get Feature command (FID: 0xC8) Latency Monitor";
const char *sel = "[0-3]: current/default/saved/supported/";
const char *nsid = "Byte[04-07]: Namespace Identifier Valid/Invalid/Inactive";
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
__u32 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(&dev, 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(dev, &uuid_index);
if (err || !uuid_index) {
nvme_show_error("ERROR: No OCP UUID index found");
return err;
}
}
struct nvme_get_features_args args = {
.args_size = sizeof(args),
.fd = dev_fd(dev),
.fid = OCP_FID_TEL_CFG,
.nsid = cfg.nsid,
.sel = cfg.sel,
.cdw11 = 0,
.uuidx = uuid_index,
.data_len = 0,
.data = NULL,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.result = &result,
};
err = nvme_get_features(&args);
if (!err) {
printf("get-feature:0xC8 %s value: %#08x\n",
nvme_select_to_string(cfg.sel), result);
if (cfg.sel == NVME_GET_FEATURES_SEL_SUPPORTED)
nvme_show_select_result(0xC8, result);
} else {
nvme_show_error("Could not get feature: 0xC8");
}
return err;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@ -2612,6 +2765,12 @@ static int clear_pcie_correctable_error_counters(int argc, char **argv, struct c
return ocp_clear_pcie_correctable_errors(argc, argv, cmd, plugin);
}
static int get_clear_pcie_correctable_error_counters(int argc, char **argv, struct command *cmd,
struct plugin *plugin)
{
return get_ocp_error_counters(argc, argv, cmd, plugin);
}
static int fw_activation_history_log(int argc, char **argv, struct command *cmd,
struct plugin *plugin)
{