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

@ -20,7 +20,7 @@
#include "nvme-models.h"
#include "util/suffix.h"
#include "util/types.h"
#include "util/logging.h"
#include "logging.h"
#include "common.h"
static const uint8_t zero_uuid[16] = { 0 };
@ -1114,6 +1114,8 @@ static void stdout_subsys_config(nvme_subsystem_t s)
if (stdout_print_ops.flags & VERBOSE) {
printf("%*s model=%s\n", len, " ",
nvme_subsystem_get_model(s));
printf("%*s serial=%s\n", len, " ",
nvme_subsystem_get_serial(s));
printf("%*s firmware=%s\n", len, " ",
nvme_subsystem_get_fw_rev(s));
printf("%*s iopolicy=%s\n", len, " ",
@ -4882,6 +4884,66 @@ static void stdout_plm_config(struct nvme_plm_config *plmcfg)
printf("\tDTWIN Time Threshold :%"PRIu64"\n", le64_to_cpu(plmcfg->dtwintt));
}
static void stdout_feat_perfc_std(struct nvme_std_perf_attr *data)
{
printf("random 4 kib average read latency (R4KARL): %s (0x%02x)\n",
nvme_feature_perfc_r4karl_to_string(data->r4karl), data->r4karl);
}
static void stdout_feat_perfc_id_list(struct nvme_perf_attr_id_list *data)
{
int i;
int attri_vs;
printf("attribute type (ATTRTYP): %s (0x%02x)\n",
nvme_feature_perfc_attrtyp_to_string(data->attrtyp), data->attrtyp);
printf("maximum saveable vendor specific performance attributes (MSVSPA): %d\n",
data->msvspa);
printf("unused saveable vendor specific performance attributes (USVSPA): %d\n",
data->usvspa);
printf("performance attribute identifier list\n");
for (i = 0; i < ARRAY_SIZE(data->id_list); i++) {
attri_vs = i + NVME_FEAT_PERFC_ATTRI_VS_MIN;
printf("performance attribute %02xh identifier (PA%02XHI): %s\n", attri_vs,
attri_vs, util_uuid_to_string(data->id_list[i].id));
}
}
static void stdout_feat_perfc_vs(struct nvme_vs_perf_attr *data)
{
printf("performance attribute identifier (PAID): %s\n", util_uuid_to_string(data->paid));
printf("attribute length (ATTRL): %u\n", data->attrl);
printf("vendor specific (VS):\n");
d((unsigned char *)data->vs, data->attrl, 16, 1);
}
static void stdout_feat_perfc(enum nvme_features_id fid, unsigned int result,
struct nvme_perf_characteristics *data)
{
__u8 attri;
bool rvspa;
nvme_feature_decode_perf_characteristics(result, &attri, &rvspa);
printf("attribute index (ATTRI): %s (0x%02x)\n", nvme_feature_perfc_attri_to_string(attri),
attri);
switch (attri) {
case NVME_FEAT_PERFC_ATTRI_STD:
stdout_feat_perfc_std(data->std_perf);
break;
case NVME_FEAT_PERFC_ATTRI_ID_LIST:
stdout_feat_perfc_id_list(data->id_list);
break;
case NVME_FEAT_PERFC_ATTRI_VS_MIN ... NVME_FEAT_PERFC_ATTRI_VS_MAX:
stdout_feat_perfc_vs(data->vs_perf);
break;
default:
break;
}
}
static void stdout_host_metadata(enum nvme_features_id fid,
struct nvme_host_metadata *data)
{
@ -5111,6 +5173,9 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
printf("\tPower Loss Signaling Mode (PLSM): %s\n",
nvme_pls_mode_to_string(NVME_GET(result, FEAT_PLS_MODE)));
break;
case NVME_FEAT_FID_PERF_CHARACTERISTICS:
stdout_feat_perfc(fid, result, (struct nvme_perf_characteristics *)buf);
break;
case NVME_FEAT_FID_ENH_CTRL_METADATA:
case NVME_FEAT_FID_CTRL_METADATA:
case NVME_FEAT_FID_NS_METADATA:
@ -5159,6 +5224,14 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
d->evta & 0x1 ? "" : "Not ");
}
break;
case NVME_FEAT_FID_BP_WRITE_PROTECT:
field = NVME_FEAT_BPWPC_BP1WPS(result);
printf("\tBoot Partition 1 Write Protection State (BP1WPS): %s\n",
nvme_bpwps_to_string(field));
field = NVME_FEAT_BPWPC_BP0WPS(result);
printf("\tBoot Partition 0 Write Protection State (BP0WPS): %s\n",
nvme_bpwps_to_string(field));
break;
default:
break;
}
@ -5632,6 +5705,16 @@ static void stdout_perror(const char *msg, va_list ap)
perror(error);
}
static void stdout_key_value(const char *key, const char *val, va_list ap)
{
_cleanup_free_ char *value = NULL;
if (vasprintf(&value, val, ap) < 0)
value = NULL;
printf("%s: %s\n", key, value ? value : "Could not allocate string");
}
static void stdout_discovery_log(struct nvmf_discovery_log *log, int numrec)
{
int i;
@ -5979,6 +6062,7 @@ static struct print_ops stdout_print_ops = {
.show_perror = stdout_perror,
.show_status = stdout_status,
.show_error_status = stdout_error_status,
.show_key_value = stdout_key_value,
};
struct print_ops *nvme_get_stdout_print_ops(nvme_print_flags_t flags)