Skip to content

Commit 4e32ec9

Browse files
brandon-paupore-sndkigaw
authored andcommitted
ocp: fix Ext SMART log page version 5 checking
The fields added in version 5 of the log page with the OCP 2.6 spec were added under the version 4 checking, which this updates to avoid issues reporting those fields with OCP 2.5 compliant drives. Signed-off-by: Brandon Paupore <[email protected]>
1 parent 0dc339a commit 4e32ec9

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

plugins/ocp/ocp-print-json.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,7 @@ static void json_smart_extended_log_v1(struct ocp_smart_extended_log *log)
226226
case 0 ... 1:
227227
break;
228228
default:
229-
case 4:
230-
json_object_add_value_uint(root, "NVMe Command Set Errata Version",
231-
log->nvme_cmdset_errata_version);
232-
json_object_add_value_uint(root, "Lowest Permitted Firmware Revision",
233-
le64_to_cpu(log->lowest_permitted_fw_rev));
229+
case 5:
234230
json_object_add_value_uint(root, "NVMe Over Pcie Errata Version",
235231
log->nvme_over_pcie_errate_version);
236232
json_object_add_value_uint(root, "NVMe Mi Errata Version",
@@ -277,6 +273,12 @@ static void json_smart_extended_log_v1(struct ocp_smart_extended_log *log)
277273
ascii += sprintf(ascii, "%c", log->dssd_firmware_build_label[i]);
278274
json_object_add_value_string(root, "Dssd firmware build label", ascii_arr);
279275
fallthrough;
276+
case 4:
277+
json_object_add_value_uint(root, "NVMe Command Set Errata Version",
278+
log->nvme_cmdset_errata_version);
279+
json_object_add_value_uint(root, "Lowest Permitted Firmware Revision",
280+
le64_to_cpu(log->lowest_permitted_fw_rev));
281+
fallthrough;
280282
case 2 ... 3:
281283
json_object_add_value_uint(root, "Errata Version Field",
282284
log->dssd_errata_version);
@@ -388,11 +390,7 @@ static void json_smart_extended_log_v2(struct ocp_smart_extended_log *log)
388390
case 0 ... 1:
389391
break;
390392
default:
391-
case 4:
392-
json_object_add_value_uint(root, "nvme_command_set_errata_version",
393-
log->nvme_cmdset_errata_version);
394-
json_object_add_value_uint(root, "lowest_permitted_firmware_revision",
395-
le64_to_cpu(log->lowest_permitted_fw_rev));
393+
case 5:
396394
json_object_add_value_uint(root, "nvme_over_pcie_errata_version",
397395
log->nvme_over_pcie_errate_version);
398396
json_object_add_value_uint(root, "nvme_mi_errata_version",
@@ -439,6 +437,12 @@ static void json_smart_extended_log_v2(struct ocp_smart_extended_log *log)
439437
ascii += sprintf(ascii, "%c", log->dssd_firmware_build_label[i]);
440438
json_object_add_value_string(root, "dssd_firmware_build_label", ascii_arr);
441439
fallthrough;
440+
case 4:
441+
json_object_add_value_uint(root, "nvme_command_set_errata_version",
442+
log->nvme_cmdset_errata_version);
443+
json_object_add_value_uint(root, "lowest_permitted_firmware_revision",
444+
le64_to_cpu(log->lowest_permitted_fw_rev));
445+
fallthrough;
442446
case 2 ... 3:
443447
json_object_add_value_uint(root, "errata_version_field",
444448
log->dssd_errata_version);

plugins/ocp/ocp-print-stdout.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,7 @@ static void stdout_smart_extended_log(struct ocp_smart_extended_log *log, unsign
168168
case 0 ... 1:
169169
break;
170170
default:
171-
case 4:
172-
printf(" NVMe Command Set Errata Version %d\n",
173-
log->nvme_cmdset_errata_version);
174-
printf(" Lowest Permitted Firmware Revision %"PRIu64"\n",
175-
le64_to_cpu(log->lowest_permitted_fw_rev));
171+
case 5:
176172
printf(" NVMe Over Pcie Errata Version %d\n",
177173
log->nvme_over_pcie_errate_version);
178174
printf(" NVMe Mi Errata Version %d\n",
@@ -218,6 +214,12 @@ static void stdout_smart_extended_log(struct ocp_smart_extended_log *log, unsign
218214
printf("%c", log->dssd_firmware_build_label[i]);
219215
printf("\n");
220216
fallthrough;
217+
case 4:
218+
printf(" NVMe Command Set Errata Version %d\n",
219+
log->nvme_cmdset_errata_version);
220+
printf(" Lowest Permitted Firmware Revision %"PRIu64"\n",
221+
le64_to_cpu(log->lowest_permitted_fw_rev));
222+
fallthrough;
221223
case 2 ... 3:
222224
printf(" Errata Version Field %d\n",
223225
log->dssd_errata_version);

0 commit comments

Comments
 (0)