Skip to content

Commit f33510e

Browse files
committed
Adding fields to id-ctrl VU reigon for Intel DC drives
Signed-off-by: Ben Reese <[email protected]>
1 parent 5c1ab09 commit f33510e

1 file changed

Lines changed: 52 additions & 7 deletions

File tree

plugins/intel/intel-nvme.c

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

61+
#pragma pack(push,1)
62+
struct nvme_vu_id_ctrl_field { //CDR MR5
63+
__u8 rsvd1[3];
64+
__u8 ss;
65+
__u8 health[20];
66+
__u8 cls;
67+
__u8 nlw;
68+
__u8 scap;
69+
__u8 sstat;
70+
__u8 bl[8];
71+
__u8 rsvd2[38];
72+
__u8 ww[8]; //little endian
73+
__u8 mic_bl[4];
74+
__u8 mic_fw[4];
75+
};
76+
#pragma pack(pop)
77+
6178
static void intel_id_ctrl(__u8 *vs, struct json_object *root)
6279
{
80+
struct nvme_vu_id_ctrl_field* log = (struct nvme_vu_id_ctrl_field *)vs;
81+
82+
char health[21];
6383
char bl[9];
64-
char health[21];
84+
char ww[19];
85+
char mic_bl[5];
86+
char mic_fw[5];
6587

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

6993
bl[sizeof(bl) - 1] = '\0';
7094
health[sizeof(health) - 1] = '\0';
95+
mic_bl[sizeof(mic_bl) - 1] = '\0';
96+
mic_fw[sizeof(mic_fw) - 1] = '\0';
97+
98+
snprintf(ww, 19, "%02X%02X%02X%02X%02X%02X%02X%02X", log->ww[7],
99+
log->ww[6], log->ww[5], log->ww[4], log->ww[3], log->ww[2],
100+
log->ww[1], log->ww[0]);
101+
71102

72103
if (root) {
73-
json_object_add_value_int(root, "ss", vs[3]);
104+
json_object_add_value_int(root, "ss", log->ss);
74105
json_object_add_value_string(root, "health", health[0] ? health : "healthy");
106+
json_object_add_value_int(root, "cls", log->cls);
107+
json_object_add_value_int(root, "nlw", log->nlw);
108+
json_object_add_value_int(root, "scap", log->scap);
109+
json_object_add_value_int(root, "sstat", log->sstat);
75110
json_object_add_value_string(root, "bl", bl);
111+
json_object_add_value_string(root, "ww", ww);
112+
json_object_add_value_string(root, "mic_bl", mic_bl);
113+
json_object_add_value_string(root, "mic_fw", mic_fw);
76114
} else {
77-
printf("ss : %d\n", vs[3]);
78-
printf("health : %s\n", health[0] ? health : "healthy");
79-
printf("bl : %s\n", bl);
115+
printf("ss : %d\n", log->ss);
116+
printf("health : %s\n", log->health[0] ? health : "healthy");
117+
printf("cls : %d\n", log->cls);
118+
printf("nlw : %d\n", log->nlw);
119+
printf("scap : %d\n", log->scap);
120+
printf("sstat : %d\n", log->sstat);
121+
printf("bl : %s\n", bl);
122+
printf("ww : %s\n", ww);
123+
printf("mic_bl : %s\n", mic_bl);
124+
printf("mic_fw : %s\n", mic_fw);
80125
}
81126
}
82127

0 commit comments

Comments
 (0)