diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-03 08:17:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-03 08:17:29 +0000 |
commit | 61c4ff8b2ddc3841050c17a5f87791653dbd2b7b (patch) | |
tree | e97b4f25c511372d73bdd96c389c5f468d99138a /plugins/wdc | |
parent | Adding upstream version 2.4. (diff) | |
download | nvme-cli-573fa445a5a78b3fa054676bf7d8c806b52c8994.tar.xz nvme-cli-573fa445a5a78b3fa054676bf7d8c806b52c8994.zip |
Adding upstream version 2.4+really2.3.upstream/2.4+really2.3
This reverts commit f42531334c05b7f49ae43c0a27e347a487fb2667.
Diffstat (limited to 'plugins/wdc')
-rw-r--r-- | plugins/wdc/wdc-nvme.c | 88 | ||||
-rw-r--r-- | plugins/wdc/wdc-nvme.h | 2 |
2 files changed, 41 insertions, 49 deletions
diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index 2d5d173..cf185be 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -996,14 +996,10 @@ struct __attribute__((__packed__)) wdc_bd_ca_log_format { __u8 raw_value[8]; }; -#define LATENCY_LOG_BUCKET_READ 3 -#define LATENCY_LOG_BUCKET_WRITE 2 -#define LATENCY_LOG_BUCKET_TRIM 1 -#define LATENCY_LOG_BUCKET_RESERVED 0 - -#define LATENCY_LOG_MEASURED_LAT_READ 2 -#define LATENCY_LOG_MEASURED_LAT_WRITE 1 -#define LATENCY_LOG_MEASURED_LAT_TRIM 0 +#define READ 0 +#define WRITE 1 +#define TRIM 2 +#define RESERVED 3 struct __attribute__((__packed__)) wdc_ssd_latency_monitor_log { __u8 feature_status; /* 0x00 */ @@ -1018,7 +1014,7 @@ struct __attribute__((__packed__)) wdc_ssd_latency_monitor_log { __u8 active_latency_min_window; /* 0x0C */ __u8 rsvd2[0x13]; /* 0x0D */ - __le32 active_bucket_counter[4][4]; /* 0x20 - 0x5F */ + __le32 active_bucket_counter[4][4] ; /* 0x20 - 0x5F */ __le64 active_latency_timestamp[4][3]; /* 0x60 - 0xBF */ __le16 active_measured_latency[4][3]; /* 0xC0 - 0xD7 */ __le16 active_latency_stamp_units; /* 0xD8 */ @@ -4110,21 +4106,19 @@ static int wdc_print_latency_monitor_log_normal(struct nvme_dev *dev, printf(" Read Write Deallocate/Trim \n"); for (i = 0; i <= 3; i++) { printf(" Active Bucket Counter: Bucket %d %27d %27d %27d \n", - i, le32_to_cpu(log_data->active_bucket_counter[i][LATENCY_LOG_BUCKET_READ]), - le32_to_cpu(log_data->active_bucket_counter[i][LATENCY_LOG_BUCKET_WRITE]), - le32_to_cpu(log_data->active_bucket_counter[i][LATENCY_LOG_BUCKET_TRIM])); + i, le32_to_cpu(log_data->active_bucket_counter[i][READ]), le32_to_cpu(log_data->active_bucket_counter[i][WRITE]), + le32_to_cpu(log_data->active_bucket_counter[i][TRIM])); } - for (i = 3; i >= 0; i--) { + for (i = 0; i <= 3; i++) { printf(" Active Measured Latency: Bucket %d %27d ms %27d ms %27d ms \n", - 3-i, le16_to_cpu(log_data->active_measured_latency[i][LATENCY_LOG_MEASURED_LAT_READ]), - le16_to_cpu(log_data->active_measured_latency[i][LATENCY_LOG_MEASURED_LAT_WRITE]), - le16_to_cpu(log_data->active_measured_latency[i][LATENCY_LOG_MEASURED_LAT_TRIM])); + i, le16_to_cpu(log_data->active_measured_latency[i][READ]), le16_to_cpu(log_data->active_measured_latency[i][WRITE]), + le16_to_cpu(log_data->active_measured_latency[i][TRIM])); } - for (i = 3; i >= 0; i--) { - printf(" Active Latency Time Stamp: Bucket %d ", 3-i); - for (j = 2; j >= 0; j--) { + for (i = 0; i <= 3; i++) { + printf(" Active Latency Time Stamp: Bucket %d ", i); + for (j = 0; j <= 2; j++) { if (le64_to_cpu(log_data->active_latency_timestamp[i][j]) == -1) printf(" N/A "); else { @@ -4137,21 +4131,19 @@ static int wdc_print_latency_monitor_log_normal(struct nvme_dev *dev, for (i = 0; i <= 3; i++) { printf(" Static Bucket Counter: Bucket %d %27d %27d %27d \n", - i, le32_to_cpu(log_data->static_bucket_counter[i][LATENCY_LOG_BUCKET_READ]), - le32_to_cpu(log_data->static_bucket_counter[i][LATENCY_LOG_BUCKET_WRITE]), - le32_to_cpu(log_data->static_bucket_counter[i][LATENCY_LOG_BUCKET_TRIM])); + i, le32_to_cpu(log_data->static_bucket_counter[i][READ]), le32_to_cpu(log_data->static_bucket_counter[i][WRITE]), + le32_to_cpu(log_data->static_bucket_counter[i][TRIM])); } - for (i = 3; i >= 0; i--) { + for (i = 0; i <= 3; i++) { printf(" Static Measured Latency: Bucket %d %27d ms %27d ms %27d ms \n", - 3-i, le16_to_cpu(log_data->static_measured_latency[i][LATENCY_LOG_MEASURED_LAT_READ]), - le16_to_cpu(log_data->static_measured_latency[i][LATENCY_LOG_MEASURED_LAT_WRITE]), - le16_to_cpu(log_data->static_measured_latency[i][LATENCY_LOG_MEASURED_LAT_TRIM])); + i, le16_to_cpu(log_data->static_measured_latency[i][READ]), le16_to_cpu(log_data->static_measured_latency[i][WRITE]), + le16_to_cpu(log_data->static_measured_latency[i][TRIM])); } - for (i = 3; i >= 0; i--) { - printf(" Static Latency Time Stamp: Bucket %d ", 3-i); - for (j = 2; j >= 0; j--) { + for (i = 0; i <= 3; i++) { + printf(" Static Latency Time Stamp: Bucket %d ", i); + for (j = 0; j <= 2; j++) { if (le64_to_cpu(log_data->static_latency_timestamp[i][j]) == -1) printf(" N/A "); else { @@ -4187,38 +4179,38 @@ static void wdc_print_latency_monitor_log_json(struct wdc_ssd_latency_monitor_lo json_object_add_value_int(root, "Debug Log Trigger Enable", le16_to_cpu(log_data->debug_log_trigger_enable)); for (i = 0; i <= 3; i++) { - for (j = 2; j >= 0; j--) { - sprintf(buf, "Active Bucket Counter: Bucket %d %s", i, operation[2-j]); - json_object_add_value_int(root, buf, le32_to_cpu(log_data->active_bucket_counter[i][j+1])); + for (j = 0; j <= 2; j++) { + sprintf(buf, "Active Bucket Counter: Bucket %d %s", i, operation[j]); + json_object_add_value_int(root, buf, le32_to_cpu(log_data->active_bucket_counter[i][j])); } } - for (i = 3; i >= 0; i--) { - for (j = 2; j >= 0; j--) { - sprintf(buf, "Active Measured Latency: Bucket %d %s", 3-i, operation[2-j]); + for (i = 0; i <= 3; i++) { + for (j = 0; j <= 2; j++) { + sprintf(buf, "Active Measured Latency: Bucket %d %s", i, operation[j]); json_object_add_value_int(root, buf, le16_to_cpu(log_data->active_measured_latency[i][j])); } } - for (i = 3; i >= 0; i--) { - for (j = 2; j >= 0; j--) { - sprintf(buf, "Active Latency Time Stamp: Bucket %d %s", 3-i, operation[2-j]); + for (i = 0; i <= 3; i++) { + for (j = 0; j <= 2; j++) { + sprintf(buf, "Active Latency Time Stamp: Bucket %d %s", i, operation[j]); json_object_add_value_int(root, buf, le64_to_cpu(log_data->active_latency_timestamp[i][j])); } } for (i = 0; i <= 3; i++) { - for (j = 2; j >= 0; j--) { - sprintf(buf, "Static Bucket Counter: Bucket %d %s", i, operation[2-j]); - json_object_add_value_int(root, buf, le32_to_cpu(log_data->static_bucket_counter[i][j+1])); + for (j = 0; j <= 2; j++) { + sprintf(buf, "Static Bucket Counter: Bucket %d %s", i, operation[j]); + json_object_add_value_int(root, buf, le32_to_cpu(log_data->static_bucket_counter[i][j])); } } - for (i = 3; i >= 0; i--) { - for (j = 2; j >= 0; j--) { - sprintf(buf, "Static Measured Latency: Bucket %d %s", 3-i, operation[2-j]); + for (i = 0; i <= 3; i++) { + for (j = 0; j <= 2; j++) { + sprintf(buf, "Static Measured Latency: Bucket %d %s", i, operation[j]); json_object_add_value_int(root, buf, le16_to_cpu(log_data->static_measured_latency[i][j])); } } - for (i = 3; i >= 0; i--) { - for (j = 2; j >= 0; j--) { - sprintf(buf, "Static Latency Time Stamp: Bucket %d %s", 3-i, operation[2-j]); + for (i = 0; i <= 3; i++) { + for (j = 0; j <= 2; j++) { + sprintf(buf, "Static Latency Time Stamp: Bucket %d %s", i, operation[j]); json_object_add_value_int(root, buf, le64_to_cpu(log_data->static_latency_timestamp[i][j])); } } @@ -10576,7 +10568,7 @@ static int wdc_vs_temperature_stats(int argc, char **argv, if (ret != 0) goto out; - /* convert from kelvins to degrees Celsius */ + /* convert from Kelvin to degrees Celsius */ temperature = ((smart_log.temperature[1] << 8) | smart_log.temperature[0]) - 273; /* retrieve HCTM Thermal Management Temperatures */ diff --git a/plugins/wdc/wdc-nvme.h b/plugins/wdc/wdc-nvme.h index cdd9615..242cf9a 100644 --- a/plugins/wdc/wdc-nvme.h +++ b/plugins/wdc/wdc-nvme.h @@ -5,7 +5,7 @@ #if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ) #define WDC_NVME -#define WDC_PLUGIN_VERSION "2.3.1" +#define WDC_PLUGIN_VERSION "2.1.2" #include "cmd.h" PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION), |