Skip to content

Commit 4e039f3

Browse files
authored
Merge pull request #584 from benreese0/master
Intel plugin: Adding fields to id-ctrl VU region
2 parents 65192d2 + 6eb13f9 commit 4e039f3

1 file changed

Lines changed: 50 additions & 7 deletions

File tree

plugins/intel/intel-nvme.c

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,68 @@ struct nvme_additional_smart_log {
5858
struct nvme_additional_smart_log_item host_bytes_written;
5959
};
6060

61+
struct nvme_vu_id_ctrl_field { //CDR MR5
62+
__u8 rsvd1[3];
63+
__u8 ss;
64+
__u8 health[20];
65+
__u8 cls;
66+
__u8 nlw;
67+
__u8 scap;
68+
__u8 sstat;
69+
__u8 bl[8];
70+
__u8 rsvd2[38];
71+
__u8 ww[8]; //little endian
72+
__u8 mic_bl[4];
73+
__u8 mic_fw[4];
74+
};
75+
6176
static void intel_id_ctrl(__u8 *vs, struct json_object *root)
6277
{
78+
struct nvme_vu_id_ctrl_field* log = (struct nvme_vu_id_ctrl_field *)vs;
79+
80+
char health[21];
6381
char bl[9];
64-
char health[21];
82+
char ww[19];
83+
char mic_bl[5];
84+
char mic_fw[5];
6585

66-
memcpy(bl, &vs[28], sizeof(bl));
67-
memcpy(health, &vs[4], sizeof(health));
86+
memcpy(bl, log->bl, sizeof(bl));
87+
memcpy(health, log->health, sizeof(health));
88+
memcpy(mic_bl, log->mic_bl, sizeof(mic_bl));
89+
memcpy(mic_fw, log->mic_fw, sizeof(mic_fw));
6890

6991
bl[sizeof(bl) - 1] = '\0';
7092
health[sizeof(health) - 1] = '\0';
93+
mic_bl[sizeof(mic_bl) - 1] = '\0';
94+
mic_fw[sizeof(mic_fw) - 1] = '\0';
95+
96+
snprintf(ww, 19, "%02X%02X%02X%02X%02X%02X%02X%02X", log->ww[7],
97+
log->ww[6], log->ww[5], log->ww[4], log->ww[3], log->ww[2],
98+
log->ww[1], log->ww[0]);
99+
71100

72101
if (root) {
73-
json_object_add_value_int(root, "ss", vs[3]);
102+
json_object_add_value_int(root, "ss", log->ss);
74103
json_object_add_value_string(root, "health", health[0] ? health : "healthy");
104+
json_object_add_value_int(root, "cls", log->cls);
105+
json_object_add_value_int(root, "nlw", log->nlw);
106+
json_object_add_value_int(root, "scap", log->scap);
107+
json_object_add_value_int(root, "sstat", log->sstat);
75108
json_object_add_value_string(root, "bl", bl);
109+
json_object_add_value_string(root, "ww", ww);
110+
json_object_add_value_string(root, "mic_bl", mic_bl);
111+
json_object_add_value_string(root, "mic_fw", mic_fw);
76112
} else {
77-
printf("ss : %d\n", vs[3]);
78-
printf("health : %s\n", health[0] ? health : "healthy");
79-
printf("bl : %s\n", bl);
113+
printf("ss : %d\n", log->ss);
114+
printf("health : %s\n", log->health[0] ? health : "healthy");
115+
printf("cls : %d\n", log->cls);
116+
printf("nlw : %d\n", log->nlw);
117+
printf("scap : %d\n", log->scap);
118+
printf("sstat : %d\n", log->sstat);
119+
printf("bl : %s\n", bl);
120+
printf("ww : %s\n", ww);
121+
printf("mic_bl : %s\n", mic_bl);
122+
printf("mic_fw : %s\n", mic_fw);
80123
}
81124
}
82125

0 commit comments

Comments
 (0)