Skip to content

Commit 58f04d7

Browse files
jeff-lien-sndkigaw
authored andcommitted
wdc: OCP 2.5 Log Page Updates
Add panic count and prev panic id to Error Recovery log page (0xC1) Add debug telemetry log size to Latency Monitor log page (0xc3) Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
1 parent 72f9604 commit 58f04d7

File tree

2 files changed

+97
-48
lines changed

2 files changed

+97
-48
lines changed

plugins/wdc/wdc-nvme.c

+96-47
Original file line numberDiff line numberDiff line change
@@ -1119,14 +1119,14 @@ struct __packed wdc_bd_ca_log_format {
11191119
__u8 raw_value[8];
11201120
};
11211121

1122-
#define LATENCY_LOG_BUCKET_READ 3
1123-
#define LATENCY_LOG_BUCKET_WRITE 2
1124-
#define LATENCY_LOG_BUCKET_TRIM 1
1125-
#define LATENCY_LOG_BUCKET_RESERVED 0
1122+
#define WDC_LATENCY_LOG_BUCKET_READ 3
1123+
#define WDC_LATENCY_LOG_BUCKET_WRITE 2
1124+
#define WDC_LATENCY_LOG_BUCKET_TRIM 1
1125+
#define WDC_LATENCY_LOG_BUCKET_RESERVED 0
11261126

1127-
#define LATENCY_LOG_MEASURED_LAT_READ 2
1128-
#define LATENCY_LOG_MEASURED_LAT_WRITE 1
1129-
#define LATENCY_LOG_MEASURED_LAT_TRIM 0
1127+
#define WDC_LATENCY_LOG_MEASURED_LAT_READ 2
1128+
#define WDC_LATENCY_LOG_MEASURED_LAT_WRITE 1
1129+
#define WDC_LATENCY_LOG_MEASURED_LAT_TRIM 0
11301130

11311131
struct __packed wdc_ssd_latency_monitor_log {
11321132
__u8 feature_status; /* 0x00 */
@@ -1151,8 +1151,9 @@ struct __packed wdc_ssd_latency_monitor_log {
11511151
__le64 static_latency_timestamp[4][3]; /* 0x130 - 0x18F */
11521152
__le16 static_measured_latency[4][3]; /* 0x190 - 0x1A7 */
11531153
__le16 static_latency_stamp_units; /* 0x1A8 */
1154-
__u8 rsvd4[0x16]; /* 0x1AA */
1154+
__u8 rsvd4[10]; /* 0x1AA */
11551155

1156+
__u8 debug_telemetry_log_size[12]; /* 0x1B4 */
11561157
__le16 debug_log_trigger_enable; /* 0x1C0 */
11571158
__le16 debug_log_measured_latency; /* 0x1C2 */
11581159
__le64 debug_log_latency_stamp; /* 0x1C4 */
@@ -1220,25 +1221,29 @@ struct __packed wdc_ssd_d0_smart_log {
12201221
#define WDC_OCP_C1_GUID_LENGTH 16
12211222
#define WDC_ERROR_REC_LOG_BUF_LEN 512
12221223
#define WDC_ERROR_REC_LOG_ID 0xC1
1223-
#define WDC_ERROR_REC_LOG_VERSION1 0001
1224-
#define WDC_ERROR_REC_LOG_VERSION2 0002
12251224

12261225
struct __packed wdc_ocp_c1_error_recovery_log {
1227-
__le16 panic_reset_wait_time; /* 000 - Panic Reset Wait Time */
1228-
__u8 panic_reset_action; /* 002 - Panic Reset Action */
1229-
__u8 dev_recovery_action1; /* 003 - Device Recovery Action 1 */
1230-
__le64 panic_id; /* 004 - Panic ID */
1231-
__le32 dev_capabilities; /* 012 - Device Capabilities */
1232-
__u8 vs_recovery_opc; /* 016 - Vendor Specific Recovery Opcode */
1233-
__u8 rsvd1[3]; /* 017 - 3 Reserved Bytes */
1234-
__le32 vs_cmd_cdw12; /* 020 - Vendor Specific Command CDW12 */
1235-
__le32 vs_cmd_cdw13; /* 024 - Vendor Specific Command CDW13 */
1236-
__u8 vs_cmd_to; /* 028 - Vendor Specific Command Timeout V2 */
1237-
__u8 dev_recovery_action2; /* 029 - Device Recovery Action 2 V2 */
1238-
__u8 dev_recovery_action2_to; /* 030 - Device Recovery Action 2 Timeout V2 */
1239-
__u8 rsvd2[463]; /* 031 - 463 Reserved Bytes */
1240-
__le16 log_page_version; /* 494 - Log Page Version */
1241-
__u8 log_page_guid[WDC_OCP_C1_GUID_LENGTH]; /* 496 - Log Page GUID */
1226+
__le16 panic_reset_wait_time; /* 000 - Panic Reset Wait Time */
1227+
__u8 panic_reset_action; /* 002 - Panic Reset Action */
1228+
__u8 dev_recovery_action1; /* 003 - Device Recovery Action 1 */
1229+
__le64 panic_id; /* 004 - Panic ID */
1230+
__le32 dev_capabilities; /* 012 - Device Capabilities */
1231+
__u8 vs_recovery_opc; /* 016 - Vendor Specific Recovery Opcode */
1232+
__u8 rsvd1[3]; /* 017 - 3 Reserved Bytes */
1233+
__le32 vs_cmd_cdw12; /* 020 - Vendor Specific Command CDW12 */
1234+
__le32 vs_cmd_cdw13; /* 024 - Vendor Specific Command CDW13 */
1235+
__u8 vs_cmd_to; /* 028 - Vendor Specific Command Timeout V2 */
1236+
__u8 dev_recovery_action2; /* 029 - Device Recovery Action 2 V2 */
1237+
__u8 dev_recovery_action2_to; /* 030 - Device Recovery Action 2 Timeout V2 */
1238+
__u8 panic_count; /* 031 - Number of panics encountered */
1239+
__le64 prev_panic_ids[4]; /* 032 - 063 Previous Panic ID's */
1240+
__u8 rsvd2[430]; /* 064 - 493 Reserved Bytes */
1241+
/* 430 reserved bytes aligns with the rest */
1242+
/* of the data structure. The size of 463 */
1243+
/* bytes mentioned in the OCP spec */
1244+
/* (version 2.5) would not fit here. */
1245+
__le16 log_page_version; /* 494 - Log Page Version */
1246+
__u8 log_page_guid[WDC_OCP_C1_GUID_LENGTH]; /* 496 - Log Page GUID */
12421247
};
12431248

12441249
static __u8 wdc_ocp_c1_guid[WDC_OCP_C1_GUID_LENGTH] = { 0x44, 0xD9, 0x31, 0x21, 0xFE, 0x30, 0x34, 0xAE,
@@ -4652,20 +4657,30 @@ static int wdc_print_latency_monitor_log_normal(struct nvme_dev *dev,
46524657
printf(" Active Latency Minimum Window %d ms\n", 100*log_data->active_latency_min_window);
46534658
printf(" Active Latency Stamp Units %d\n", le16_to_cpu(log_data->active_latency_stamp_units));
46544659
printf(" Static Latency Stamp Units %d\n", le16_to_cpu(log_data->static_latency_stamp_units));
4655-
printf(" Debug Log Trigger Enable %d\n", le16_to_cpu(log_data->debug_log_trigger_enable));
4660+
if (le16_to_cpu(log_data->log_page_version) >= 4)
4661+
printf(" Debug Telemetry Log Size %"PRIu64"\n",
4662+
le64_to_cpu(*(uint64_t *)log_data->debug_telemetry_log_size));
4663+
printf(" Debug Log Trigger Enable %d\n",
4664+
le16_to_cpu(log_data->debug_log_trigger_enable));
4665+
printf(" Log Page Version %d\n",
4666+
le16_to_cpu(log_data->log_page_version));
4667+
printf(" Log page GUID 0x");
4668+
for (j = 0; j < WDC_C3_GUID_LENGTH; j++)
4669+
printf("%x", log_data->log_page_guid[j]);
4670+
printf("\n");
46564671

46574672
printf(" Read Write Deallocate/Trim\n");
46584673
for (i = 0; i <= 3; i++)
46594674
printf(" Active Bucket Counter: Bucket %d %27d %27d %27d\n",
4660-
i, le32_to_cpu(log_data->active_bucket_counter[i][LATENCY_LOG_BUCKET_READ]),
4661-
le32_to_cpu(log_data->active_bucket_counter[i][LATENCY_LOG_BUCKET_WRITE]),
4662-
le32_to_cpu(log_data->active_bucket_counter[i][LATENCY_LOG_BUCKET_TRIM]));
4675+
i, le32_to_cpu(log_data->active_bucket_counter[i][WDC_LATENCY_LOG_BUCKET_READ]),
4676+
le32_to_cpu(log_data->active_bucket_counter[i][WDC_LATENCY_LOG_BUCKET_WRITE]),
4677+
le32_to_cpu(log_data->active_bucket_counter[i][WDC_LATENCY_LOG_BUCKET_TRIM]));
46634678

46644679
for (i = 3; i >= 0; i--)
46654680
printf(" Active Measured Latency: Bucket %d %27d ms %27d ms %27d ms\n",
4666-
3-i, le16_to_cpu(log_data->active_measured_latency[i][LATENCY_LOG_MEASURED_LAT_READ]),
4667-
le16_to_cpu(log_data->active_measured_latency[i][LATENCY_LOG_MEASURED_LAT_WRITE]),
4668-
le16_to_cpu(log_data->active_measured_latency[i][LATENCY_LOG_MEASURED_LAT_TRIM]));
4681+
3-i, le16_to_cpu(log_data->active_measured_latency[i][WDC_LATENCY_LOG_MEASURED_LAT_READ]),
4682+
le16_to_cpu(log_data->active_measured_latency[i][WDC_LATENCY_LOG_MEASURED_LAT_WRITE]),
4683+
le16_to_cpu(log_data->active_measured_latency[i][WDC_LATENCY_LOG_MEASURED_LAT_TRIM]));
46694684

46704685
for (i = 3; i >= 0; i--) {
46714686
printf(" Active Latency Time Stamp: Bucket %d ", 3-i);
@@ -4682,15 +4697,15 @@ static int wdc_print_latency_monitor_log_normal(struct nvme_dev *dev,
46824697

46834698
for (i = 0; i <= 3; i++)
46844699
printf(" Static Bucket Counter: Bucket %d %27d %27d %27d\n",
4685-
i, le32_to_cpu(log_data->static_bucket_counter[i][LATENCY_LOG_BUCKET_READ]),
4686-
le32_to_cpu(log_data->static_bucket_counter[i][LATENCY_LOG_BUCKET_WRITE]),
4687-
le32_to_cpu(log_data->static_bucket_counter[i][LATENCY_LOG_BUCKET_TRIM]));
4700+
i, le32_to_cpu(log_data->static_bucket_counter[i][WDC_LATENCY_LOG_BUCKET_READ]),
4701+
le32_to_cpu(log_data->static_bucket_counter[i][WDC_LATENCY_LOG_BUCKET_WRITE]),
4702+
le32_to_cpu(log_data->static_bucket_counter[i][WDC_LATENCY_LOG_BUCKET_TRIM]));
46884703

46894704
for (i = 3; i >= 0; i--)
46904705
printf(" Static Measured Latency: Bucket %d %27d ms %27d ms %27d ms\n",
4691-
3-i, le16_to_cpu(log_data->static_measured_latency[i][LATENCY_LOG_MEASURED_LAT_READ]),
4692-
le16_to_cpu(log_data->static_measured_latency[i][LATENCY_LOG_MEASURED_LAT_WRITE]),
4693-
le16_to_cpu(log_data->static_measured_latency[i][LATENCY_LOG_MEASURED_LAT_TRIM]));
4706+
3-i, le16_to_cpu(log_data->static_measured_latency[i][WDC_LATENCY_LOG_MEASURED_LAT_READ]),
4707+
le16_to_cpu(log_data->static_measured_latency[i][WDC_LATENCY_LOG_MEASURED_LAT_WRITE]),
4708+
le16_to_cpu(log_data->static_measured_latency[i][WDC_LATENCY_LOG_MEASURED_LAT_TRIM]));
46944709

46954710
for (i = 3; i >= 0; i--) {
46964711
printf(" Static Latency Time Stamp: Bucket %d ", 3-i);
@@ -4726,7 +4741,22 @@ static void wdc_print_latency_monitor_log_json(struct wdc_ssd_latency_monitor_lo
47264741
json_object_add_value_int(root, "Active Lantency Minimum Window", 100*log_data->active_latency_min_window);
47274742
json_object_add_value_int(root, "Active Latency Stamp Units", le16_to_cpu(log_data->active_latency_stamp_units));
47284743
json_object_add_value_int(root, "Static Latency Stamp Units", le16_to_cpu(log_data->static_latency_stamp_units));
4729-
json_object_add_value_int(root, "Debug Log Trigger Enable", le16_to_cpu(log_data->debug_log_trigger_enable));
4744+
if (le16_to_cpu(log_data->log_page_version) >= 4) {
4745+
json_object_add_value_int(root, "Debug Telemetry Log Size",
4746+
le64_to_cpu(*(uint64_t *)log_data->debug_telemetry_log_size));
4747+
}
4748+
json_object_add_value_int(root, "Debug Log Trigger Enable",
4749+
le16_to_cpu(log_data->debug_log_trigger_enable));
4750+
json_object_add_value_int(root, "Log Page Version",
4751+
le16_to_cpu(log_data->log_page_version));
4752+
4753+
char guid[40];
4754+
4755+
memset((void *)guid, 0, 40);
4756+
sprintf((char *)guid, "0x%"PRIx64"%"PRIx64"",
4757+
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data->log_page_guid[8]),
4758+
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data->log_page_guid[0]));
4759+
json_object_add_value_string(root, "Log page GUID", guid);
47304760

47314761
for (i = 0; i <= 3; i++) {
47324762
for (j = 2; j >= 0; j--) {
@@ -4785,20 +4815,29 @@ static void wdc_print_error_rec_log_normal(struct wdc_ocp_c1_error_recovery_log
47854815
printf(" Vendor Specific Recovery Opcode : 0x%x\n", log_data->vs_recovery_opc);
47864816
printf(" Vendor Specific Command CDW12 : 0x%x\n", le32_to_cpu(log_data->vs_cmd_cdw12));
47874817
printf(" Vendor Specific Command CDW13 : 0x%x\n", le32_to_cpu(log_data->vs_cmd_cdw13));
4788-
if (le16_to_cpu(log_data->log_page_version) == WDC_ERROR_REC_LOG_VERSION2) {
4818+
if (le16_to_cpu(log_data->log_page_version) >= 2) {
47894819
printf(" Vendor Specific Command Timeout : 0x%x\n", log_data->vs_cmd_to);
47904820
printf(" Device Recovery Action 2 : 0x%x\n", log_data->dev_recovery_action2);
47914821
printf(" Device Recovery Action 2 Timeout : 0x%x\n", log_data->dev_recovery_action2_to);
47924822
}
4793-
printf(" Log Page Version : 0x%x\n", le16_to_cpu(log_data->log_page_version));
4794-
printf(" Log page GUID : 0x");
4823+
if (le16_to_cpu(log_data->log_page_version) >= 3) {
4824+
printf(" Panic Count : 0x%x\n", log_data->panic_count);
4825+
for (j = 0; j < 4; j++)
4826+
printf(" Previous Panic ID N-%d : 0x%"PRIx64"\n",
4827+
j+1, le64_to_cpu(log_data->prev_panic_ids[j]));
4828+
}
4829+
printf(" Log Page Version : 0x%x\n",
4830+
le16_to_cpu(log_data->log_page_version));
4831+
printf(" Log page GUID : 0x");
47954832
for (j = 0; j < WDC_OCP_C1_GUID_LENGTH; j++)
47964833
printf("%x", log_data->log_page_guid[j]);
47974834
printf("\n");
47984835
}
47994836

48004837
static void wdc_print_error_rec_log_json(struct wdc_ocp_c1_error_recovery_log *log_data)
48014838
{
4839+
int j;
4840+
char buf[128];
48024841
struct json_object *root = json_create_object();
48034842

48044843
json_object_add_value_int(root, "Panic Reset Wait Time", le16_to_cpu(log_data->panic_reset_wait_time));
@@ -4809,12 +4848,21 @@ static void wdc_print_error_rec_log_json(struct wdc_ocp_c1_error_recovery_log *l
48094848
json_object_add_value_int(root, "Vendor Specific Recovery Opcode", log_data->vs_recovery_opc);
48104849
json_object_add_value_int(root, "Vendor Specific Command CDW12", le32_to_cpu(log_data->vs_cmd_cdw12));
48114850
json_object_add_value_int(root, "Vendor Specific Command CDW13", le32_to_cpu(log_data->vs_cmd_cdw13));
4812-
if (le16_to_cpu(log_data->log_page_version) == WDC_ERROR_REC_LOG_VERSION2) {
4851+
if (le16_to_cpu(log_data->log_page_version) >= 2) {
48134852
json_object_add_value_int(root, "Vendor Specific Command Timeout", log_data->vs_cmd_to);
48144853
json_object_add_value_int(root, "Device Recovery Action 2", log_data->dev_recovery_action2);
48154854
json_object_add_value_int(root, "Device Recovery Action 2 Timeout", log_data->dev_recovery_action2_to);
48164855
}
4817-
json_object_add_value_int(root, "Log Page Version", le16_to_cpu(log_data->log_page_version));
4856+
if (le16_to_cpu(log_data->log_page_version) >= 3) {
4857+
json_object_add_value_int(root, "Panic Count", log_data->panic_count);
4858+
for (j = 0; j < 4; j++) {
4859+
sprintf(buf, "Previous Panic ID N-%d", j+1);
4860+
json_object_add_value_int(root, buf,
4861+
le64_to_cpu(log_data->prev_panic_ids[j]));
4862+
}
4863+
}
4864+
json_object_add_value_int(root, "Log Page Version",
4865+
le16_to_cpu(log_data->log_page_version));
48184866

48194867
char guid[40];
48204868

@@ -7351,9 +7399,10 @@ static int wdc_get_ocp_c1_log_page(nvme_root_t r, struct nvme_dev *dev, char *fo
73517399
log_data = (struct wdc_ocp_c1_error_recovery_log *)data;
73527400

73537401
/* check log page version */
7354-
if ((log_data->log_page_version != WDC_ERROR_REC_LOG_VERSION1) &&
7355-
(log_data->log_page_version != WDC_ERROR_REC_LOG_VERSION2)) {
7356-
fprintf(stderr, "ERROR: WDC: invalid error recovery log version - %d\n", log_data->log_page_version);
7402+
if ((log_data->log_page_version < 1) ||
7403+
(log_data->log_page_version > 3)) {
7404+
fprintf(stderr, "ERROR: WDC: invalid error recovery log version - %d\n",
7405+
log_data->log_page_version);
73577406
ret = -1;
73587407
goto out;
73597408
}

plugins/wdc/wdc-nvme.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
66
#define WDC_NVME
77

8-
#define WDC_PLUGIN_VERSION "2.9.0"
8+
#define WDC_PLUGIN_VERSION "2.9.1"
99
#include "cmd.h"
1010

1111
PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION),

0 commit comments

Comments
 (0)